Skip to content

Commit 6c34ad0

Browse files
authored
Add documentation for detecting round color blobs (#366)
* Add documentation for detecting round color blobs * Updating color-processing docs with changes made in SDK 11.0
1 parent 46c53a7 commit 6c34ad0

16 files changed

+318
-29
lines changed

docs/source/color_processing/color-locator-challenge/color-locator-challenge.rst

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -555,16 +555,9 @@ example, that can overlap if desired.
555555

556556
Using two processors
557557

558-
This ends the tutorial's 3 pages on ColorLocator:
559558

560-
* :doc:`Discover <../color-locator-discover/color-locator-discover>`,
561-
* :doc:`Explore <../color-locator-explore/color-locator-explore>`,
562-
* **Challenge**
563-
564-
The final page of this tutorial provides optional info on :doc:`Color Spaces
565-
<../color-spaces/color-spaces>`.
566-
567-
Best of luck as you apply these tools to your Autonomous and TeleOp OpModes!
559+
The next ColorLocator page called :doc:`Color Locator (Round Blobs) <../color-locator-round-blobs/color-locator-round-blobs>`
560+
covers detection of round objects.
568561

569562
============
570563

docs/source/color_processing/color-locator-discover/color-locator-discover.rst

Lines changed: 24 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,17 @@ Java section below:
7575

7676
2. Click ``Create New OpMode``\ , enter a new name such as
7777
"ColorLocator_Monica_v01", and select the Sample OpMode
78-
``ConceptVisionColorLocator``.
78+
``ConceptVisionColorLocator_Rectangle``.
7979

80-
3. At the top of the Blocks screen, you can change the type from "TeleOp"
80+
3. Near the beginning of the OpMode code, change `ARTIFACT_PURPLE` to `BLUE`.
81+
82+
4. At the top of the Blocks screen, you can change the type from "TeleOp"
8183
to "Autonomous", since this Sample OpMode does not use gamepads.
8284

83-
4. If using the built-in camera of an RC phone, drag out the relevant
85+
5. If using the built-in camera of an RC phone, drag out the relevant
8486
Block from the left-side ``VisionPortal.Builder`` toolbox.
8587

86-
5. Save the OpMode, time to try it!
88+
6. Save the OpMode, time to try it!
8789

8890
.. tab-item:: Java
8991
:sync: java
@@ -92,15 +94,17 @@ Java section below:
9294

9395
2. In the ``teamcode`` folder, add/create a new OpMode with a name such
9496
as "ColorLocator_Javier_v01.java", and select the Sample OpMode
95-
``ConceptVisionColorLocator.java``.
97+
``ConceptVisionColorLocator_Rectangle.java``.
98+
99+
3. Near the beginning of the OpMode code, change `ARTIFACT_PURPLE` to `BLUE`.
96100

97-
3. At about Line 63, you can change ``@TeleOp`` to ``@Autonomous``\ ,
101+
4. At about Line 63, you can change ``@TeleOp`` to ``@Autonomous``\ ,
98102
since this Sample OpMode does not use gamepads.
99103

100-
4. If using the built-in camera of an RC phone, follow the OpMode
104+
5. If using the built-in camera of an RC phone, follow the OpMode
101105
comments to specify that camera.
102106

103-
5. Click "Build", time to try it!
107+
6. Click "Build", time to try it!
104108

105109
Running the Sample OpMode
106110
+++++++++++++++++++++++++
@@ -197,12 +201,16 @@ In this example, the Region of Interest (ROI) contains only one Blob of the
197201
default target color BLUE. You could probably move your camera to achieve the
198202
same result - with the help of previews.
199203

200-
The **first column** shows the **Area**, in pixels, of the Blob (contour, not
204+
The **first column** shows the (X, Y) position of the **Center** of the boxFit
205+
rectangle. With the origin at the full image's top left corner, X increases to
206+
the right and Y increases downward.
207+
208+
The **second column** shows the **Area**, in pixels, of the Blob (contour, not
201209
boxFit). By default, the Sample OpMode uses a **filter** to show Blobs between
202210
50 and 20,000 pixels. Also by default, the Sample uses a **sort** tool to
203211
display multiple Blobs in descending order of Area (largest is first).
204212

205-
The **second column** shows the **Density** of the Blob contour. From the
213+
The **third column** shows the **Density** of the Blob contour. From the
206214
Sample comments:
207215

208216
..
@@ -212,7 +220,7 @@ Sample comments:
212220
contour. The density is the ratio of Contour-area to Convex Hull-area.*
213221

214222

215-
The **third column** shows the **Aspect Ratio of the boxFit**, the best-fit
223+
The **fourth column** shows the **Aspect Ratio of the boxFit**, the best-fit
216224
rectangle around the contour:
217225

218226
..
@@ -226,9 +234,8 @@ rectangle around the contour:
226234
**tilted** at some angle, namely not horizontal. This will be discussed
227235
more in a later page.
228236

229-
The **fourth column** shows the (X, Y) position of the **Center** of the boxFit
230-
rectangle. With the origin at the full image's top left corner, X increases to
231-
the right and Y increases downward.
237+
The fifth and sixth columns are described in a later page called
238+
:doc:`Color Locator (Round Blobs) <../color-locator-round-blobs/color-locator-round-blobs>`.
232239

233240
Blob Formation
234241
--------------
@@ -326,6 +333,9 @@ After that, the following page called :doc:`Challenge
326333
<../color-locator-challenge/color-locator-challenge>` shows how to **access
327334
more OpenCV features** not covered in the Sample OpMode.
328335

336+
Then a page called :doc:`Color Locator (Round Blobs)
337+
<../color-locator-round-blobs/color-locator-round-blobs>` covers detection of round objects.
338+
329339
============
330340

331341
*Questions, comments and corrections to [email protected]*
1.24 KB
Loading
-223 Bytes
Loading

docs/source/color_processing/color-locator-explore/color-locator-explore.rst

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,13 @@ Target Color Range
4646
The "target color" is actually a **range** of numerical color values, for a
4747
better chance of finding the desired color.
4848

49-
Each **Swatch** name (BLUE, RED, YELLOW, GREEN) has been pre-programmed with a
49+
Each **Swatch** name (BLUE, RED, YELLOW, GREEN, ARTIFACT_PURPLE, ARTIFACT_GREEN) has been pre-programmed with a
5050
range of color values to detect most shades of that color, in most lighting
5151
conditions.
5252

5353
The values for Red, Blue and Yellow were tuned for the plastic game pieces
54-
(called Samples) from INTO THE DEEP.
54+
(called Samples) from INTO THE DEEP. The values for ARTIFACT_PURPLE and ARTIFACT_GREEN
55+
were tuned for the plastic game pieces from DECODE.
5556

5657
Select and read the Blocks **or** Java section below:
5758

@@ -496,6 +497,8 @@ Here's a conceptual note from co-developer `@Windwoes <https://github.com/Windwo
496497
Next, this tutorial's :doc:`Challenge <../color-locator-challenge/color-locator-challenge>` page shows how to
497498
**access more OpenCV features** not covered in the Sample OpMode.
498499

500+
Then a page called :doc:`Color Locator (Round Blobs) <../color-locator-round-blobs/color-locator-round-blobs>` covers detection of round objects.
501+
499502
============
500503

501504
*Questions, comments and corrections to [email protected]*

0 commit comments

Comments
 (0)