Composite image?

Composite image of how to implement the processed images via find_line function, by adding to the original image and record the mpeg video format,Thank you!

See the mjpeg example script in the IDE. You then just need to take the MJPEG recording code and add that to the output of the find_line function drawn on the image.

Thanks kwagyeman! But how to the find_line image(new image) add to the original(old image) image,and composit one image to recording? Thank you !

I can’t understand what you are asking. I understand there may be a language barrier issue but I need you to put a lot more effort into your questions so that I can answer them. Please try to write a clear explanation of what you want to do.

Sorry kwagyeman,I want to this effect as follow video for mjpeg video format.

Thanks!

Okay I think I understand, the problem is the original image is overwritten by the edge detector and converted to binary image to support higher resolution.

A workaround for this is to capture a new image after finding lines:

while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    img = sensor.snapshot() # Take a picture and return the image.
    img.find_edges(image.EDGE_CANNY, threshold=(50, 80))  # Find edges
    lines = img.find_lines(threshold=50) # Find lines.
    
    #Note new image
    img = sensor.snapshot()
    for l in lines: img.draw_line(l, color=(127)) # Draw lines
    print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while

Then write the new image.

If you want a color image you can switch the sensor format on the fly, note you need to capture 2 images to flush the buffer so it’s going to be very slow:

while(True):
    clock.tick() # Track elapsed milliseconds between snapshots().
    sensor.set_pixformat(sensor.GRAYSCALE) # or sensor.RGB565
    img = sensor.snapshot() # Take a picture and return the image.
    img.find_edges(image.EDGE_CANNY, threshold=(50, 80))  # Find edges
    lines = img.find_lines(threshold=50) # Find lines.
    sensor.set_pixformat(sensor.RGB565) # or sensor.RGB565
    img = sensor.snapshot()
    for l in lines: img.draw_line(l, color=(255, 0, 0)) # Draw lines
    print(clock.fps()) # Note: Your OpenMV Cam runs about half as fast while
    img = sensor.snapshot()

Then use the mjpeg saving code once you have the marked up image to save to disk.

Thanks kwagyeman and iabdalkader kindly support!