Esempio n. 1
0
def view_json():
    # List all the files
    lg = ListGenerator()
    json_file_list = lg.generate_list(MARK_DIR, ['json'])

    # Show the image one by one.
    for file_name in tqdm(json_file_list):
        preview_json(file_name)
Esempio n. 2
0
def view_pts():
    # List all the files
    lg = ListGenerator()
    pts_file_list = lg.generate_list(MARK_DIR, ['pts'])

    # Show the image one by one.
    for file_name in pts_file_list:
        preview(file_name)
Esempio n. 3
0
def main():
    lg = ListGenerator()
    files_to_check = lg.generate_list('/data/dataset/public/coco', ['jpg'])
    print("Total files: {}".format(len(files_to_check)))

    gray_img_list = []
    num_checked = 0
    for each_file in tqdm(files_to_check):
        img = cv2.imread(each_file, cv2.IMREAD_ANYCOLOR)

        # Preview gray images.
        if len(img.shape) != 3:
            gray_img_list.append(each_file)
            cv2.imshow("gray", img)
            if cv2.waitKey(100) == 27:
                break

    print("Total gray images: {}".format(len(gray_img_list)))
def main():
    # create a CLAHE object (Arguments are optional).
    clahe = cv.createCLAHE(clipLimit=2, tileGridSize=(4, 4))

    # Read in images.
    target_dir = '/home/robin/Desktop/libvideo_processing/demo/image'
    file_list = ListGenerator().generate_list(target_dir, ['jpg'])

    for each_img in file_list:
        img = cv.imread(each_img)
        img_hsv = cv.cvtColor(img, cv.COLOR_BGR2HSV)
        v_a = clahe.apply(img_hsv[:, :, 2])
        v_e = cv.equalizeHist(img_hsv[:, :, 2])
        img_hsv_a = img_hsv.copy()
        img_hsv_e = img_hsv.copy()
        img_hsv_a[:, :, 2] = v_a
        img_hsv_e[:, :, 2] = v_e

        img_adpequalhist = cv.cvtColor(img_hsv_a, cv.COLOR_HSV2BGR)
        img_ehist = cv.cvtColor(img_hsv_e, cv.COLOR_HSV2BGR)

        res = np.hstack(
            (img, img_ehist, img_adpequalhist))  # stacking images side-by-side

        # Show result.
        cv.imshow("preview", res)
        cv.waitKey()

    # Read in a video file.
    cap = cv.VideoCapture(
        '/home/robin/Desktop/libvideo_processing/demo/video.mp4')
    while True:
        _, img = cap.read()
        img = cv.cvtColor(img, cv.COLOR_BGR2GRAY)
        img = cv.resize(img, (0, 0), img, 0.5, 0.5)

        cl1 = clahe.apply(img)
        res = np.hstack((img, cl1))  # stacking images side-by-side

        # Show result.
        cv.imshow("preview", res)
        cv.waitKey(30)