예제 #1
0
        if (len(filenames) == 0):
            print("Input folder is empty")
        # time_start = time.time()
        for filename in filenames:
            counter+=1
            # if not counter % 4==0:
            #     continue
            print("current count is ",counter)
            t1 = time.time()
            print("current sample image is ",filename)
            title, ext = os.path.splitext(os.path.basename(filename))
            # time_stamp = title.split("_")[0]
            x_pos = title.split("_")[0]
            y_pos = title.split("_")[1]
            temp_name,bbox_info,min_dist_val=find_template_2(ref_id,[float(x_pos),float(y_pos)],df)
            print("current template image is ", temp_name)
            if temp_name==1:
                print("waiting for image with id ",ref_id)
                if show:
                    imgk=cv2.imread(os.path.join(root,filename))
                    cv2.putText(imgk, "ID NOT FOUND", (10, 10), cv2.FONT_HERSHEY_PLAIN, 1, (0, 0, 0), 1)
                    cv2.imshow("img5", imgk)
                    # cv2.imshow('img', img)
                    ch = cv2.waitKey(0)
                    if ch & 0XFF == ord('q'):
                        cv2.destroyAllWindows()
                    cv2.destroyAllWindows()
                continue

            ####################################################################
        if (len(filenames) == 0):
            print("Input folder is empty")
        # time_start = time.time()
        for filename in filenames:
            counter += 1
            if not counter % 4 == 0:
                continue
            print("current count is ", counter)
            t1 = time.time()
            print("current sample image is ", filename)
            title, ext = os.path.splitext(os.path.basename(filename))
            time_stamp = title.split("_")[0]
            x_pos = title.split("_")[1]
            y_pos = title.split("_")[2]
            temp_name, bbox_info = find_template_2(
                ref_id, [float(x_pos), float(y_pos)], df)
            print("current template image is ", temp_name)
            if temp_name == 1:
                print("waiting for image with id ", ref_id)
                if show:
                    imgk = cv2.imread(os.path.join(root, filename))
                    cv2.putText(imgk, "ID NOT FOUND", (10, 10),
                                cv2.FONT_HERSHEY_PLAIN, 1, (0, 0, 0), 1)
                    cv2.imshow("img5", imgk)
                    # cv2.imshow('img', img)
                    ch = cv2.waitKey(0)
                    if ch & 0XFF == ord('q'):
                        cv2.destroyAllWindows()
                    cv2.destroyAllWindows()
                continue