<< 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

Next revision Both sides next revision
wiki:v2:using_color_codes [2018/04/09 21:52]
jfrench - Imported by DokuWiki Advanced Plugin
wiki:v2:using_color_codes [2018/06/08 00:41]
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 ​(firmware versions 1.0.0 and higher).+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.
  
 {{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 ​Pixy 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. ​Pixy 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. 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.
  
  
Line 24: Line 24:
  
  
-==== Getting ​Pixy to track Color Codes ====+==== Getting ​Pixy2 to track Color Codes ====
  
 Here is a good video on color codes: Here is a good video on color codes:
Line 31: Line 31:
  
  
-In order to get color codes working on Pixy, you need to do the following:+In order to get color codes working on Pixy2, you need to do the following:
  
   - Make sure that the **Color code mode** parameter in the **Expert** tab is not 0 (disabled). (It should be 1 [enabled] by default.)   - Make sure that the **Color code mode** parameter in the **Expert** tab is not 0 (disabled). (It should be 1 [enabled] by default.)
-  - Teach Pixy the color code signatures needed for the color codes you are using.+  - Teach Pixy2 the color code signatures needed for the color codes you are using.
  
-To teach Pixy the color code signatures, bring up PixyMon and choose Raw mode. Put a color code in front of Pixy 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, 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:
  
 {{wiki:​img:​106a2d3a86ba6c294ac6a50ae4d53e667fb1e055.jpg?​300}} {{wiki:​img:​106a2d3a86ba6c294ac6a50ae4d53e667fb1e055.jpg?​300}}
Line 44: Line 44:
 {{wiki:​img:​f457b031d6ec558d422818f7e9d01df8c2751445.jpg?​300}} {{wiki:​img:​f457b031d6ec558d422818f7e9d01df8c2751445.jpg?​300}}
  
-Pixy 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:​img:​08b0c5f0dbda14fd5eef858909cdaecfe83cc639.jpg?​300}}\\
 {{wiki:​img:​ace71ea3ca24e74031a6bdd333dde618c35443ee.jpg?​300}} {{wiki:​img:​ace71ea3ca24e74031a6bdd333dde618c35443ee.jpg?​300}}
  
-Repeat this process until all the unique colors are taught to Pixy 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:​dcc32578f2709aa72720a7d13ddeeb36177da929.jpg?​300}}\\
Line 56: Line 56:
 {{wiki:​img:​6e1aabd42555ca183dfe53c05c83cc7011dd6a8d.jpg?​300}} {{wiki:​img:​6e1aabd42555ca183dfe53c05c83cc7011dd6a8d.jpg?​300}}
  
-When all color code signatures have been taught, ​Pixy should be identifying color codes that are present, using the color code signatures that you just taught it. You'll see something similar (below) in Cooked mode:+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 it. You'll see something similar (below) in Cooked mode:
  
 {{wiki:​img:​d611b3827428f3de59769388d444052279d77dbd.jpg?​300}}\\ {{wiki:​img:​d611b3827428f3de59769388d444052279d77dbd.jpg?​300}}\\
Line 66: Line 66:
 {{wiki:​img:​317fdf44a99902fadcbb775b065aa4416f36ba33.jpg?​300}} {{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 Pixy will "​decode"​ each one! The possibilities are almost endless.+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:​img:​5e6f96353aa9a4dfbda3bf9380bcd5a7b75c80ca.jpg?​300}} {{wiki:​img:​5e6f96353aa9a4dfbda3bf9380bcd5a7b75c80ca.jpg?​300}}
Line 75: Line 75:
 ==== What's this "color code signature"​ business? How are color code signatures different from normal signatures? ==== ==== What's this "color code signature"​ business? How are color code signatures different from normal signatures? ====
  
-As you know, Pixy has seven color signatures that it can learn/​remember. Each signature can either be a **normal signature** or a **color code signature**. All signatures that you teach Pixy are considered **normal** unless you choose a **Set CC signature** option from the **Action** menu. Color code signatures, as you can probably guess, are only used for color codes. In other words, these signatures need to form a color code (two or more color code signatures) for Pixy to recognize them as an object and report them. This is the default color code behavior, but the **Color code mode** can change this (see below).+As you know, Pixy2 has seven color signatures that it can learn/​remember. Each signature can either be a **normal signature** or a **color code signature**. All signatures that you teach Pixy2 are considered **normal** unless you choose a **Set CC signature** option from the **Action** menu. Color code signatures, as you can probably guess, are only used for color codes. In other words, these signatures need to form a color code (two or more color code signatures) for Pixy2 to recognize them as an object and report them. This is the default color code behavior, but the **Color code mode** can change this (see below).
  
  
-==== How color codes are reported ==== 
  
-Color code objects are returned as special object blocks, which are very similar to normal object blocks (see below). +==== What about the angle that's reported? ====
- +
-<​code>​ +
-Color code object block +
- +
-Bytes    16-bit words   ​Description +
----------------------------------------------------------------- +
-0, 1     ​0 ​             sync (0xaa56) +
-2, 3     ​1 ​             checksum (sum of all 16-bit words 2-6) +
-4, 5     ​2 ​             color code number +
-6, 7     ​3 ​             x center of object +
-8, 9     ​4 ​             y center of object +
-10, 11   ​5 ​             width of object +
-12, 13   ​6 ​             height of object +
-14, 15   ​7 ​             ​angle of object (only applies to color code objects) +
-</​code>​ +
-But the sync code is different (0xaa56 instead of 0xaa55) and instead of the signature number (word 1) returning a single number between 1 and 7, color code object blocks return a an octal (base 8) number with each digit being the signature number of the detected tag (16 bits can represent up to 5 octal digits). For example, the color code above, which consists of 3 tags, signatures 1, 2, and 3, in order, is 123 in octal (base 8), or 83 in decimal. This can be confusing -- the fact that the color code numbers are represented in octal. Here are some useful converters: [[http://​www.rapidtables.com/​convert/​number/​octal-to-decimal.htm|octal to decimal]] and [[http://​www.rapidtables.com/​convert/​number/​decimal-to-octal.htm|decimal to octal]].+
  
 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 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.
Line 103: Line 86:
 ==== Color code modes ==== ==== Color code modes ====
  
-Pixy 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.+  - **0=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.+  - **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.
  
-  - **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).+  - **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).
  
-  - **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.+  - **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.
  
 Now, that may have been confusing... We expect most people will find that mode 1 is the most useful, so if in doubt, use mode 1! Now, that may have been confusing... We expect most people will find that mode 1 is the most useful, so if in doubt, use mode 1!
wiki/v2/using_color_codes.txt · Last modified: 2018/06/08 19:09 by pixycam