Class «lineSensor»
Last updated
Last updated
This article is automatically translated from Russian by Google Translator.
Camera in line sensor mode.
Detects the dominant color in the vertical bar in the center of the frame and remembers it as a line color. Then the "read" method starts returning data for that line.
Turns the camera on and initializes it inline sensor mode. The boolean parameter determines whether to display the image from the camera (true
- display).
The boolean parameter defines whether to display the image from the camera:
true
— output,
false
— don't output.
Returns an array with the following data in its cells:
the zero cell is the X coordinate of the line center relative to the center of the frame (from -100 to 100, -100 is the center of the line on the edge of the frame on the left);
in the first cell - the probability of crossing (the number from 0 to 100, showing how many points of the line color are in the horizontal stripe in the frame center);
the second cell - the relative size of the line, a number from 0 to 100 (100 - the line occupies almost the whole frame, 0 - the line is absent in the frame).
Turns off the video camera and stops the sensor.
Method
Description
Detects the dominant color in the vertical bar in the center of the frame and remembers it as a line color.
Turns the camera on and initializes it inline sensor mode.
Returns an array with the X coordinate of the center of the line relative to the center of the frame, the probability of a crossover, and the relative size of the line.
Turns off the video camera and stops the sensor.