Пример #1
0
def main():
    image_file = sys.argv[1]

    img = cv.imread(image_file, cv.IMREAD_COLOR)

    (blue_points, red_points) = image_processor.process(img)

    output_points(blue_points)
    output_points(red_points)
Пример #2
0
def main():
    while True:
        img = cam_srv.image()
        imgproc.process(img)
Пример #3
0
log.basicConfig(
    level=log.DEBUG,
    format='%(asctime)s %(message)s',
)

configuration = camera.Configuration()
configuration.host = "192.168.137.20:9001/camera"
# configuration.debug = True

# create an instance of the API class
camera_api = camera.DefaultApi(camera.ApiClient(configuration))

while True:

    try:
        # Get image.
        response: HTTPResponse = camera_api.image_get(_preload_content=False)
        pprint(response)

        np_arr = np.frombuffer(response.data, np.uint8)
        img = cv.imdecode(np_arr, cv.IMREAD_COLOR)
        log.info(f"Img size {img.shape[:2]}")
        cv.imwrite("camera_image.png", img)

        result = imgproc.process(img)
        log.info(f"Proc result {result}")

    except ApiException as e:
        print("Exception when calling DefaultApi->image_get: %s\n" % e)
Пример #4
0
images_path = sys.argv[1]
image_files = [path.join(images_path, file)
               for file in os.listdir(images_path)
               if path.isfile(path.join(images_path, file))]
image_count = len(image_files)
print(image_files)

i = 0
while True:
    i %= image_count
    image_file = image_files[i]
    print(image_file)

    img = cv.imread(image_file, cv.IMREAD_COLOR)
    (blue_points, red_points) = image_processor.process(img)
    print("BLUE points: " + str(blue_points))
    print("RED points: " + str(red_points))

    key = cv.waitKey()
    print("Key pressed: {}".format(key))
    if key == 81 or key == 8:
        # left arrow or backspace
        i -= 1
    elif key == 27:
        # ESC
        cv.destroyAllWindows()
        break
    else:
        i += 1
Пример #5
0
def process():
    img = cam_srv.image()

    result = imgproc.process(img)
    processed_imgs.on_next(robot_finder.ProcessedImg(img, *result))