Changing Cameras Midway Through Code

Discussion related to "under the hood" OpenMV topics.
potatoesareyummy
Posts: 3
Joined: Sat Sep 08, 2018 7:41 am

Changing Cameras Midway Through Code

Postby potatoesareyummy » Sat Sep 08, 2018 7:43 am

Hi everyone,
is it possible to change cameras in the middle of your code (i.e having the rgb camera for say 20 seconds before moving to a greyscale one)?
Thanks!!
User avatar
kwagyeman
Posts: 2462
Joined: Sun May 24, 2015 2:10 pm

Re: Changing Cameras Midway Through Code

Postby kwagyeman » Sat Sep 08, 2018 11:46 am

Yeah, just set the sensor pix format to grayscale and then skip a few frames.
Nyamekye,
potatoesareyummy
Posts: 3
Joined: Sat Sep 08, 2018 7:41 am

Re: Changing Cameras Midway Through Code

Postby potatoesareyummy » Sun Sep 09, 2018 6:16 am

So would it be something like:

Code: Select all

sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.RGB565) # Set pixel format to RGB565 (or GRAYSCALE)
sensor.set_framesize(sensor.QVGA)   # Set frame size to QVGA (320x240)
sensor.skip_frames(time = 2000)     # Wait for settings take effect.
while(time <20):
.......
sensor.reset()                      # Reset and initialize the sensor.
sensor.set_pixformat(sensor.GRAYSCALE) 
sensor.set_framesize(sensor.VGA)  
sensor.skip_frames(time = 2000)     # Wait for settings take effect.
......
User avatar
kwagyeman
Posts: 2462
Joined: Sun May 24, 2015 2:10 pm

Re: Changing Cameras Midway Through Code

Postby kwagyeman » Sun Sep 09, 2018 11:08 am

Yep!
Nyamekye,

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 4 guests