예제 #1
0

class TestPoint(Structure):
    _fields_ = [('ballAngle', c_int), ('ballDis', c_int)]


if __name__ == '__main__':
    TRACE('test main line')
    # テスト用共有メモリの準備
    shmem = Value(TestPoint, 0)

    imageProcessing = ImageProcessing()

    file_path = 'data/temp/camera_capture_wall_6.jpg'

    TRACE(file_path)
    stream = cv2.imread(file_path)

    ball_angle, ball_distance, station_angle, station_distance, wall_x, wall_size = imageProcessing.imageProcessingFrame(
        stream, shmem)

    cv2.imshow('Frame', cv2.flip(stream, -1))
    cv2.moveWindow('Frame', 0, 30)
    cv2.moveWindow('MaskRED', 482, 30)
    cv2.moveWindow('MaskYELLOW', 964, 30)
    cv2.moveWindow('MaskGREEN', 1446, 30)
    cv2.moveWindow('MaskBLACK', 0, 530)
    cv2.waitKey(0)

    cv2.destroyAllWindows()
예제 #2
0
    # テスト用共有メモリの準備
    shmem = Value(TestPoint, 0)

    # モータ制御インスタンスの生成
    imageProcessing = ImageProcessing()

    p_imageProcessing = Process(target=imageProcessing.target, args=(shmem, ))

    file_list = glob.glob("./camera_distance/0degree/*jpg")
    TRACE(file_list)

    for file in file_list:
        TRACE(file)
        stream = cv2.imread(file)

        yellow_goal_angle, yellow_goal_distance, blue_goal_angle, blue_goal_distance, field_center_angle, field_center_distance = imageProcessing.imageProcessingFrame(
            stream, shmem)

        cv2.imshow('Frame', stream.transpose((1, 0, 2)))
        cv2.moveWindow('Frame', 0, 30)
        cv2.moveWindow('MaskYellow', 482, 30)
        cv2.moveWindow('MaskBlue', 964, 30)
        cv2.moveWindow('MaskWall', 482, 502)
        cv2.waitKey(0)

    p_imageProcessing.start()
    TRACE('p_imageProcessing started')

    cv2.destroyAllWindows()
    # p_imageProcessing.join()