60268dea8608567ecb3f7fe4132b6bc687a32c64..c227f3b327ee9f6cfd7e3dc5eb2b96418aee8a47
2019-08-23 SpeedProg
added some new sets
c227f3 diff | tree
2019-08-23 SpeedProg
added some code related to finding the set
ff863f diff | tree
2 files modified
20 ■■■■ changed files
config.py 2 ●●● patch | view | raw | blame | history
opencv_dnn.py 18 ●●●● patch | view | raw | blame | history
config.py
@@ -19,7 +19,7 @@
                    'c17',
                    'ddt', 'v17', 'ddu', 'cm2', 'ss1', 'gs1', 'c18', 'ima']
    # Supplemental sets
    set_sup_list = ['hop', 'arc', 'pc2', 'cns', 'cn2', 'e01', 'e02', 'bbd', 'war', 'm19', 'a25', 'm20']
    set_sup_list = ['hop', 'arc', 'pc2', 'cns', 'cn2', 'e01', 'e02', 'bbd', 'war', 'm19', 'a25', 'm20', 'rna', 'grn']
    all_set_list = set_2003_list + set_2015_list + set_box_list + set_sup_list
    #all_set_list = ['war', 'mir', 'm19', 'bbd', 'ima']
    all_set_list = ['m20']
opencv_dnn.py
@@ -68,8 +68,22 @@
            if card_img is None:
                print('WARNING: card %s is not found!' % img_name)
                continue
            set_img = card_img[575:638, 567:700]
            """
            img_cc = cv2.cvtColor(card_img, cv2.COLOR_BGR2GRAY)
            img_thresh = cv2.adaptiveThreshold(img_cc, 255, cv2.ADAPTIVE_THRESH_MEAN_C, cv2.THRESH_BINARY_INV, 11, 5)
            # Dilute the image, then erode them to remove minor noises
            kernel = np.ones((3, 3), np.uint8)
            img_dilate = cv2.dilate(img_thresh, kernel, iterations=1)
            img_erode = cv2.erode(img_dilate, kernel, iterations=1)
            cnts, hier = cv2.findContours(img_erode, cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
            cnts2 = sorted(cnts, key=cv2.contourArea, reverse=True)
            cnts2 = cnts2[:10]
            if True:
                cv2.drawContours(img_cc, cnts2, -1, (0, 255, 0), 3)
                #cv2.imshow('Contours', card_img)
                #cv2.waitKey(10000)
            """
            set_img = card_img[595:635, 600:690]
            #cv2.imshow(card_info['name'], set_img)
            # Compute value of the card's perceptual hash, then store it to the database
            #img_art = Image.fromarray(card_img[121:580, 63:685])  # For 745*1040 size card image