<< return to Pixycam.com

User Tools

Site Tools


wiki:v2:using_color_codes

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
wiki:v2:using_color_codes [2018/06/08 00:41]
pixycam
wiki:v2:using_color_codes [2018/06/08 19:09] (current)
pixycam
Line 8: Line 8:
 ==== Introduction ==== ==== Introduction ====
  
-So, what’s a “color code”? A color code (CC) is two or more color tags placed close together. ​Pixy can detect and decode CCs and present them as detected objects.+So, what’s a “color code”? A color code (CC) is two or more color tags placed close together. ​Pixy2 can detect and decode CCs and present them as detected objects.
  
 {{wiki:​img:​35119fecded9e123af00cd80ab41301333ccd450.jpg}} {{wiki:​img:​35119fecded9e123af00cd80ab41301333ccd450.jpg}}
  
-For example, using 2-tag CCs (like the photo above) and limiting yourself to a palette of 4 colors (i.e. teaching Pixy2 4 different color signatures),​ you can generate up to 12 unique objects. ​That's just the tip of the iceberg - 3, 4, and 5-tag CCs with more / different colors allow for many, many more unique objects. Pixy2 will detect and report color codes with up to 5 tags arranged in a line. With 5 tags, thousands of unique codes are possible.+For example, using 2-tag CCs (like the photo above) and limiting yourself to a palette of 4 colors (i.e. teaching Pixy2 4 different color signatures),​ you can generate up to 12 unique objects. 3, 4, and 5-tag CCs with more / different colors allow for many, many more unique objects. Pixy2 will detect and report color codes with up to 5 tags arranged in a line. With 5 tags, thousands of unique codes are possible.
  
  
Line 19: Line 19:
 CCs are useful if you have lots of objects you want to detect and identify -- more than could be detected with the seven separate color signatures alone. CCs also improve detection accuracy by decreasing false positive detections. That is, there is a lower probability that specific colors will occur both in a specific order and close together. The drawback is that you need to place a CC on each object you’re interested in detecting. Often the object you’re interested in (yellow ball, purple toy) has a unique color signature and CCs aren’t needed. Objects with CCs and objects without CCs can be used side-by-side with no problems, so you are free to use CCs for some objects and not others. CCs are useful if you have lots of objects you want to detect and identify -- more than could be detected with the seven separate color signatures alone. CCs also improve detection accuracy by decreasing false positive detections. That is, there is a lower probability that specific colors will occur both in a specific order and close together. The drawback is that you need to place a CC on each object you’re interested in detecting. Often the object you’re interested in (yellow ball, purple toy) has a unique color signature and CCs aren’t needed. Objects with CCs and objects without CCs can be used side-by-side with no problems, so you are free to use CCs for some objects and not others.
  
-CCs also give you an accurate angle estimate of the object (in addition to the position and size). This is a “freebie” that some applications may find useful. The angle estimate, decoded CCs, regular objects and all of their positions and sizes are all provided at 50 frames per second.+CCs also give you an accurate angle estimate of the object (in addition to the position and size). This is a “freebie” that some applications may find useful. The angle estimate, decoded CCs, regular objects and all of their positions and sizes are all provided at 60 frames per second.
  
 CCs might be particularly useful for helping a robot navigate. For example, an indoor environment with CCs uniquely identifying each doorway and hallway would be both low-cost and robust. CCs might be particularly useful for helping a robot navigate. For example, an indoor environment with CCs uniquely identifying each doorway and hallway would be both low-cost and robust.
Line 26: Line 26:
 ==== Getting Pixy2 to track Color Codes ==== ==== Getting Pixy2 to track Color Codes ====
  
-Here is a good video on color codes:+In order to get color codes working on Pixy2, you need to do the following:
  
-{{youtube>​LDF0GCqES4U?​480x360)}}+  - Run the _color\_connected\_components_ program by selecting it in the **Program** menu 
 +  - Make sure that the **Color code mode** parameter in the [[wiki:​v2:​ccc_expert|Expert tab]] is not disabled. It should be enabled by default. 
 +  - Set the view to **Blocks, video, detected pixels** in the [[wiki:​v2:​ccc_view_menu|View menu]]. ​ This will provide good feedback while you are teaching the color code signatures (see below).
  
  
-In order to get color codes working on Pixy2, you need to do the following:+{{wiki:v2:​image_306.png}}
  
-  - Make sure that the **Color code mode** parameter in the **Expert** tab is not 0 (disabled). (It should be 1 [enabled] by default.) 
-  - Teach Pixy2 the color code signatures needed for the color codes you are using. 
  
-To teach Pixy2 the color code signatures, ​bring up PixyMon and choose Raw mode. Put a color code in front of Pixy2 and select **Action➜Set CC signature 1** and select the first color in the color code. The photos below show the steps for a 4-tag color code:+To teach Pixy2 the color code signatures, ​put a color code in front of Pixy2 and select **Action➜Set CC signature 1** and select the first color in the color code. The photos below show the steps for a 4-tag color code:
  
-{{wiki:img:106a2d3a86ba6c294ac6a50ae4d53e667fb1e055.jpg?300}}+{{wiki:v2:image_304.png}}
  
 Then outline the first tag on the color code: Then outline the first tag on the color code:
  
-{{wiki:img:f457b031d6ec558d422818f7e9d01df8c2751445.jpg?300}}+{{wiki:v2:image_307.png}}
  
 Pixy2 will then generate the first color code signature and store it. Next, select **Action➜Set CC signature 2** for the second color in the color code and select the next tag. Pixy2 will then generate the first color code signature and store it. Next, select **Action➜Set CC signature 2** for the second color in the color code and select the next tag.
  
-{{wiki:img:08b0c5f0dbda14fd5eef858909cdaecfe83cc639.jpg?300}}\\ +{{wiki:v2:image_317.png}}\\ 
-{{wiki:img:ace71ea3ca24e74031a6bdd333dde618c35443ee.jpg?300}}+{{wiki:v2:image_309.png}} 
  
 Repeat this process until all the unique colors are taught to Pixy2 as color codes, so here we go for the 3rd and 4th colors: Repeat this process until all the unique colors are taught to Pixy2 as color codes, so here we go for the 3rd and 4th colors:
  
-{{wiki:​img:​dcc32578f2709aa72720a7d13ddeeb36177da929.jpg?​300}}\\ 
-{{wiki:​img:​cacb13e307effd1a33b982517209f7dbd214ca82.jpg?​300}}\\ 
-{{wiki:​img:​e5c5968ae307c19552d6c6d10fc198d70516aa16.jpg?​300}}\\ 
-{{wiki:​img:​6e1aabd42555ca183dfe53c05c83cc7011dd6a8d.jpg?​300}} 
  
-When all color code signatures have been taught, Pixy2 should be identifying color codes that are present, using the color code signatures that you just taught itYou'll see something similar (below) in Cooked mode:+{{wiki:​v2:​image_310.png}}\\ 
 +{{wiki:v2:​image_311.png}}\\ 
 +{{wiki:​v2:​image_312.png}}\\ 
 +{{wiki:​v2:​image_314.png}} 
  
-{{wiki:​img:​d611b3827428f3de59769388d444052279d77dbd.jpg?​300}}\\ +When all color code signatures have been taught, Pixy2 should be identifying color codes that are present, using the color code signatures that you just taught itYou'll see something similar (below):
-{{wiki:img:​46337557e319be7f8a9a5e1b420823ea1f9159cb.jpg?​300}}+
  
-And here's what you'll see in Default mode:+{{wiki:v2:​image_315.png}}\\ 
 +{{wiki:​v2:​image_316.png}}
  
-{{wiki:​img:​5aa792593f4adbb18affd5d2404803a5f9fd98fe.jpg?​300}}\\ +Once you get all of the signatures programmed, you can mix them up and Pixy2 will "​decode"​ each one
-{{wiki:​img:​317fdf44a99902fadcbb775b065aa4416f36ba33.jpg?​300}}+
  
-The really cool part is that once you get all of the colors programmed, you can mix them up and Pixy2 will "​decode"​ each one! The possibilities are almost endless.+{{wiki:​v2:​image_319.png}}
  
-{{wiki:​img:​5e6f96353aa9a4dfbda3bf9380bcd5a7b75c80ca.jpg?​300}} 
  
-And that's the gist of color codes -- fairly simple, really. 
  
  
Line 81: Line 79:
 ==== What about the angle that's reported? ==== ==== What about the angle that's reported? ====
  
-The way color codes are reported raises a question -- since color codes can be in any orientation,​ aren't there two possible ways to report a color code? For example, a color code that has three tags consisting of: color code signature 1, next to color code signature 2, next to color code signature 3, could have an octal representation of 123, or possibly 321. Which representation is used? The smaller numerical representation (123) is always reported for consistency.+The angle value that'​s ​reported raises a question -- since color codes can be in any orientation,​ aren't there two possible ways to report a color code? For example, a color code that has three tags consisting of: color code signature 1, next to color code signature 2, next to color code signature 3, could have an octal representation of 123, or possibly 321. Which representation is used? The smaller numerical representation (123) is always reported for consistency. ​ In other words, 321 will never be reported because it's considered invalid.  ​
  
  
Line 88: Line 86:
 Pixy2 supports four different color code modes through the **Color code mode** parameter. Pixy2 supports four different color code modes through the **Color code mode** parameter.
  
-  - **0=disabled:** No color codes are detected or reported. Objects that match color code signatures are reported as normal objects.+  - **Disabled:** No color codes are detected or reported. Objects that match color code signatures are reported as normal objects.
  
-  - **1=enabled:** This is the default mode. Detected color code objects are reported, along with normal objects. However, objects that match color code signatures, but are not part of a color code (two or more color code signatures) are not reported.+  - **Enabled:** This is the default mode. Detected color code objects are reported, along with normal objects. However, objects that match color code signatures, but are not part of a color code (two or more color code signatures) are not reported.
  
-  - **2=color ​codes only:** Objects that match color signatures (whether they are normal signatures or color code signatures) are reported only if they are part of color codes (two or more signatures).+  - **Color codes only:** Objects that match color signatures (whether they are normal signatures or color code signatures) are reported only if they are part of color codes (two or more signatures).
  
-  - **3=mixed:** In this mode, color code objects are reported along with normal objects. Additionally,​ objects that match color code signatures, but are not part of a color code are also reported.+  - **Mixed:** In this mode, color code objects are reported along with normal objects. Additionally,​ objects that match color code signatures, but are not part of a color code are also reported.
  
-Now, that may have been confusing... We expect most people will find that mode is the most useful, so if in doubt, ​use mode 1!+Now, that may have been confusing... We expect most people will find that **Enabled** ​mode is the most useful, so if in doubt, ​just stick with that.  ​
  
  
wiki/v2/using_color_codes.1528418493.txt.gz · Last modified: 2018/06/08 00:41 by pixycam