How to only send self-allocated framebuffer to OpenMV IDE?

Discussion related to "under the hood" OpenMV topics.
iamseer
Posts: 8
Joined: Wed Jul 04, 2018 2:25 pm

How to only send self-allocated framebuffer to OpenMV IDE?

Postby iamseer » Sun Dec 16, 2018 10:08 am

Hi,

I met the same problem to this: https://stackoverflow.com/questions/527 ... openmv-ide

I want to show my own image for debugging purpose. However, it seems OpenMV sends my framebuffer and camera framebuffer alternatively. Currently, I have to use an LCD to show the framebuffer I want, but the LCD is slow and inconvenient.

Is there a way to disable OpenMV sending camera framebuffer? I've attached a sample code which flashes framebuffer viewer in IDE

Thanks.

Code: Select all

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)

clock = time.clock()
invImg = sensor.alloc_extra_fb(sensor.width(), sensor.height(), sensor.RGB565)

while(True):
    clock.tick()
    img = sensor.snapshot()
    invImg.replace(img)
    invImg.invert()
    print(invImg.compressed_for_ide(), end="")
    print(clock.fps())
User avatar
iabdalkader
Posts: 845
Joined: Sun May 24, 2015 3:53 pm

Re: How to only send self-allocated framebuffer to OpenMV IDE?

Postby iabdalkader » Tue Dec 18, 2018 8:41 am

Hi, if you don't need the snapshot you could just overwrite it :

Code: Select all

import sensor, image, time

sensor.reset()
sensor.set_pixformat(sensor.RGB565)
sensor.set_framesize(sensor.QVGA)
sensor.skip_frames(time = 2000)
clock = time.clock()

while(True):
    clock.tick()        
    img = sensor.snapshot()
    img.invert()
    print(clock.fps())
If you still need it, you could copy the inv image back to img:

Code: Select all

while(True):
    clock.tick()        
    img = sensor.snapshot()
    invImg.replace(img)
    invImg.invert()
    img.replace(invImg)
    print(clock.fps())

Return to “Technical Discussion”

Who is online

Users browsing this forum: Bing [Bot] and 190 guests