Last updated
Last updated
Mean of area detection works through using rectangles you can specify, and then getting the average color over that entire area of the rectangle to determine if it should choose that "spot". For instance, in Centerstage 2023-2024, there are three spike marks. You can easily see two of them so it makes it easy to detect. In this case, you would choose which two to look at, and then assume if it isn't those, it must be the other one. We call this "assuming a third". Hence how in the pipeline we have created, there are Detection Builders and Assumed Builders.
When creating the pipeline, you will pass in two detection builders. These consist of a Rectangle with two points (TopLeft, BottomRight)
This allows you to define a box that the detection will specifically look at.
Next, you will define a name for this detection. For instance, with my example of CenterStage earlier, it could be "left" or "center".
Next you will define a lower and upper scalar color.
For color spaces, you will pass in your own color space you want to use. This uses an ENUM that is defined in this module called CSpace. You can make it use RGB, YCrCb, HSV, or HLS. For instance, if you wanted to use RGB, you would pass in CSpace.RGB.
Next, you will define a function for the program to execute when it selects this detection. A very convenient way to do this is have BlinkinLED lights and setting them to different colors depending on the detection, a very easy way to make sure it is working correctly. Another way this could be used is to set a variable to different numbers so you know which detection has been selected.
For instance, a complete code module using this could look like:
This makes the complete detector as well as also setting up the Assumed, which in this case would be center.
If you have any questions, feel free to open an issue on the github repository for this project