Camera Sensor - QuirkyCort/gears GitHub Wiki
This simulates a low resolution camera.
Working Principles (Simulator)
It works by simulating a virtual camera at the sensor location and capturing an image.
Get RGB / HSV
These functions returns a 3 dimensional array (...row, column, RGB/HSV) containing the RGB or HSV values. RGB values ranges from 0 to 255. For HSV, H ranges from 0 to 359, S and V ranges from 0 to 100.
Find Blobs
find_blobs(thresholds, pixels_threshold=10)
This function finds blobs that matches the specified color and returns a list of matches. thresholds
is a list of 6 values defining the HSV values you want to match; (minH, maxH, minS, maxS, minV, maxV). pixels_threshold
is used to filter out small blobs where the pixel count is less than pixels_threshold
.
The return value is a list of matches. Each match is a list containing [pixel_count, centroid_x_position, centroid_y_position, bounding_box_x, bounding_box_y, bounding_box_width, bounding_box_height]. The list of matches are always sorted according to pixel_count, so that the largest blob (...by pixel_count) is always at the start of the list.
Configurations
Default values are shown below.
"type": "ColorSensor",
"options": {
"sensorResolution": 100,
"sensorMinRange": 0.1,
"sensorFov": 1.3
}
sensorResolution: The resolution of the image captured by the virtual camera. The default is an 100x100 image. You generally should not change this.
sensorMinRange: Anything closer than this range (...in cm) will not be seen by the virtual camera.
sensorFov: The sensor's field of view (...in radian). The default of 1.3 is around (74.5 degrees).