Sensor

Sensor is used to set up parameters of the photosensitive elements.

For example:

import sensor# import the module of photosensitive element 

# set the camera 
sensor.reset()# reset the photosensitive elements
sensor.set_pixformat(sensor.RGB565)# set it as chromatic 
sensor.set_framesize(sensor.QVGA)# set the framesize of the picture 设
sensor.skip_frames()# skip n pictures and wait before the photosensitive elements become stable after changing settings and skipping several frames 

# take photos all the time 
while(True):
    img = sensor.snapshot()# take a photo; img is the object of an image

Reset

  • sensor.reset()

reset the sensor

Set colors/black-and-white

  • sensor.set_pixformat()
    • sensor.GRAYSCALE: set grayscale with each pixel 8bit
    • sensor.RGB565: color with each pixel 16bit

Set the framesize of the picture

  • sensor.set_framesize()
    • sensor.QQVGA: 160x120
    • sensor.QQVGA2: 128x160 (on LCD shield)
    • sensor.HQVGA: 240x160
    • sensor.QVGA: 320x240
    • sensor.VGA: 640x480 (only when OpenMV Cam M7 processes pictures in grayscale pattern or collect images in colors)
    • sensor.QQCIF: 88x72
    • sensor.QCIF: 176x144
    • sensor.CIF: 352x288

Skip several frames

  • sensor.skip_frames(n=10)

skip n pictures and wait before the photosensitive elements become stable after changing settings and skipping several frames

Take a picture

  • sensor.snapshot()

take a picture, then return an Image object.

Auto gain/White balance

  • sensor.set_auto_gain()

Set auto gain true or false. You need to set auto gain false when you use color tracking.

  • sensor.set_auto_whitebal()

Set white balance true or false. You need to set white balance false when you use color tracking.

Set window ROI

sensor.set_windowing(roi)

ROI: The term ROI, region of interest, means extracting the subimage which you are to process from the whole image.

sensor.set_framesize(sensor.VGA) #  high resolution
sensor.set_windowing((640, 80)) # extract the center area with 640*80

The form of ROI is(x, y, w, h). SeeUsage of statistics

Set the flip

  • sensor.set_hmirror(True)

flip on horizontal direction

  • sensor.set_vflip(True)

flip on vertical direction

results matching ""

    No results matching ""