Ejemplo n.º 1
0
    def test_statink_weapon_name2(self):
        # 画像認識された時に得られる文字列を stat.ink キーに正しく変換
        # できるかテスト
        statink = self._load_StatInk()

        from ikalog.utils import IkaGlyphRecoginizer
        weapons = IkaGlyphRecoginizer()
        weapons.load_model_from_file('data/weapons.knn.data')

        for weapon_ja in weapons.weapon_names:
            assert statink.encode_weapon_name(weapon_ja)
Ejemplo n.º 2
0
    def test_statink_weapon_name2(self):
        # 画像認識された時に得られる文字列を stat.ink キーに正しく変換
        # できるかテスト
        statink = self._load_StatInk()

        from ikalog.utils import IkaGlyphRecoginizer
        weapons = IkaGlyphRecoginizer()
        weapons.load_model_from_file('data/weapons.knn.data')

        for weapon_ja in weapons.weapon_names:
            assert statink.encode_weapon_name(weapon_ja)
Ejemplo n.º 3
0
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.
#

import cv2
import os
import sys

sys.path.append('.')
base_dir = sys.argv[1]

from ikalog.utils import IkaGlyphRecoginizer

weapons = IkaGlyphRecoginizer()
weapons.load_model_from_file('data/weapons.knn.data')
weapons.knn_train()

results = {}
for root, dirs, files in os.walk(base_dir):
    l = []
    for file in files:
        if file.endswith(".png"):
            filename = os.path.join(root, file)
            img = cv2.imread(filename)
            answer, distance = weapons.match(img)
            if not (answer in results):
                results[answer] = []

            results[answer].append( { 'filename': filename, 'distance': distance } )
Ejemplo n.º 4
0
    # file にリスト書き出し
    f = open('weapons.html', 'w')
    f.write('<p>%s</p>' % s)
    for weapon in sorted(sort_zumi.keys()):
        f.write('<h3>%s</h3>' % weapon)
        print('<h3>%s</h3>' % weapon)
        for t in sorted(sort_zumi[weapon]):
            f.write('<font size=-4>%s</font><img src=%s alt="%s">' %
                    (t[0], t[1], t[0]))
            print('<font size=-4>%s</font><img src=%s alt="%s">' %
                  (t[0], t[1], t[0]))

    f.close()
    return s

weapons = IkaGlyphRecoginizer()

learnImageGroup(weapons, "14式竹筒銃・甲", dir="14式竹筒銃・甲")
learnImageGroup(weapons, "3Kスコープ", dir="3Kスコープ")
learnImageGroup(weapons, "3Kスコープカスタム", dir="3Kスコープカスタム")
learnImageGroup(weapons, "L3リールガン", dir="L3リールガン")
learnImageGroup(weapons, "L3リールガンD", dir="L3リールガンD")
learnImageGroup(weapons, "H3リールガン", dir="H3リールガン")
learnImageGroup(weapons, "H3リールガンD", dir="H3リールガンD")
learnImageGroup(weapons, "N-ZAP85", dir="N-ZAP85")
learnImageGroup(weapons, "N-ZAP89", dir="N-ZAP89")
learnImageGroup(weapons, "オクタシューターレプリカ", dir="オクタシューター")
learnImageGroup(weapons, "カーボンローラー", dir="カーボンローラー")
learnImageGroup(weapons, "カーボンローラーデコ", dir="カーボンローラーデコ")
learnImageGroup(weapons, "ガロン52", dir="ガロン52")
learnImageGroup(weapons, "ガロン96", dir="ガロン96")
Ejemplo n.º 5
0
    f = open('weapons.html', 'w')
    f.write('<p>%s</p>' % s)
    for weapon in sorted(sort_zumi.keys()):
        f.write('<h3>%s</h3>' % weapon)
        print('<h3>%s</h3>' % weapon)
        for t in sorted(sort_zumi[weapon]):
            f.write('<font size=-4>%s</font><img src=%s alt="%s">' %
                    (t[0], t[1], t[0]))
            print('<font size=-4>%s</font><img src=%s alt="%s">' %
                  (t[0], t[1], t[0]))

    f.close()
    return s


weapons = IkaGlyphRecoginizer()

learnImageGroup(weapons, "14式竹筒銃・甲", dir="14式竹筒銃・甲")
learnImageGroup(weapons, "3Kスコープ", dir="3Kスコープ")
learnImageGroup(weapons, "3Kスコープカスタム", dir="3Kスコープカスタム")
learnImageGroup(weapons, "L3リールガン", dir="L3リールガン")
learnImageGroup(weapons, "L3リールガンD", dir="L3リールガンD")
learnImageGroup(weapons, "H3リールガン", dir="H3リールガン")
learnImageGroup(weapons, "H3リールガンD", dir="H3リールガンD")
learnImageGroup(weapons, "N-ZAP85", dir="N-ZAP85")
learnImageGroup(weapons, "N-ZAP89", dir="N-ZAP89")
learnImageGroup(weapons, "オクタシューターレプリカ", dir="オクタシューター")
learnImageGroup(weapons, "カーボンローラー", dir="カーボンローラー")
learnImageGroup(weapons, "カーボンローラーデコ", dir="カーボンローラーデコ")
learnImageGroup(weapons, "ガロン52", dir="ガロン52")
learnImageGroup(weapons, "ガロン96", dir="ガロン96")