<< return to Pixycam.com

Pixy 2 - barcodes


#1

I know there was no official support for barcodes before, but the Pixy 2 promo video shows them in use (road sigs). I’ve read somewhere that Pixy 2 can handle 4-byte barcodes. Is there any documentation that covers it? How to generate the bars?


#2

Hello Adam,
We were taking bets on when someone would bring this up :slight_smile: — it’s a hole in the documentation.

We’re working on generating some PNG files with the barcodes. These should be easy to manipulate, integrate into artwork, etc. They will be up next week.

This is sorta lame, but here’s an OpenOffice Drawing file that we used for testing:
https://drive.google.com/file/d/1CZF4t0ztrZseuolvWft2L7YK7ZgTAUcO/view?usp=sharing
And the PDF version:
https://drive.google.com/file/d/1CZF4t0ztrZseuolvWft2L7YK7ZgTAUcO/view?usp=sharing

Hopefully it is usable until we get the barcode resources posted.

Edward


#3

Hi Edward,
Knowing how much you’re overwhelmed with work I really appreciate your responsiveness :slight_smile:
Both URLs are actually linked to the same PDF but nevermind - that already gives me a good understanding.
Do I need to memorise the barcodes somehow or they are already in Pixy’s ROM?
Can Pixy read more than one barcode at once?


#4

If we’d place a black/white OLED display into Pixy’s view, could we control a Bot by only showing different barcodes, or does it need a crossing line and barcode to change direction?


#5

Ah, I goofed with the link – here’s the odf (OpenOffice Drawing) file:

https://drive.google.com/file/d/157vk-Lo_TCS2IyVVWfFlGjZhpCsoTJoz/view?usp=sharing

The codes are already in Pixy’s ROM/algorithm, so no teach is necessary. Pixy can read lots of codes at the same time.

Edward


#6

Regarding OLEDs – that’s an interesting question. I assume it would work(?) There doesn’t need to be any line/vector for PIxy2 to detect/decode barcodes.

Regarding changing direction, branching, turning (lots of words to describe) at intersections, this is controlled (usually) by setNextTurn() in the line tracking API:

https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api

Let me know if this doesn’t answer your question.

Edward


#7

That’s good to know! Is there a chance Pixy_1 will get a FW upgrade for barcode reading, too?


#8

I just noticed the barcodes can’t be rotated or upside down. I was trying to work out this shortcoming with something like this:
Untitled%20drawing%20(1)

But no success. I guess simple QR codes could be more applicable in real life situations.


#9

Hello Adam,
The Pixy2 barcode scheme was chosen after testing some different options. We chose barcodes, and barcodes specifically oriented perpendicular to the robot’s direction of motion because of motion blur.

This was a surprise to us – but it makes sense.

The robot in the Pixy2 video is moving about 1.5 feet per second. The integration time of Pixy2’s image sensor is about 5ms with its lamp on. In 5ms, the robot moves about 1/10 of an inch — that’s the motion blur Pixy2 will see. Any features about the same size as 1/10" or smaller will be smeared. If you orient the barcodes differently, the motion blur tends to dominate.

QR codes would be worse — assuming we’re talking about sufficiently zippy robots. QR codes could be useful elsewhere, of course.

Anyway, your idea of making a multi-oriented barcode is pretty cool! The problem is that the barcode detector looks for whitespace around the barcode, both on the left and right side. So try moving the codes farther apart.

Anyway, you’re doing something we didn’t think of – can you describe your application?

Edward


#10

Maybe it would help to add a CC image to a barcode? Pixy would read the angle of the CC image and could align the barcode accordingly.


#11

So far I find Pixy prone to the problem of changing light conditions. I’d like to build a bot that travels around a room from one marker to another. I was trying to use CCs but then a bit more of the daylight and the bot gets lost. I was thinking of using barcodes instead but then, a picture could be approached from various directions.
The ideal would be something like ArUco markers. I think they are used by Lego as well as they are well-supported in OpenCV https://docs.opencv.org/3.4.1/d5/dae/tutorial_aruco_detection.html


#12

HI Olli,
The line tracking algorithm (which includes the barcodes) and color connected components (which includes color codes) are separate programs, which might make this difficult.

Edward


#13

Hello Adam,
Thanks for the suggestion! They are used by LEGO? At any rate, we’ll add this to our suggested features.

Edward


#14

Barcodes are now available as PNGs. yay!


#15

Hi edge,
i have a question.

Is the reading of the bar-codes also possible with pixycam 1 or only with pixy2?


#16

Only Pixy2. Thanks!

Jesse


#17

How can i get the value of barcodes to do something?
I know there is a function that print all the parameters of the barcodes, but i need to get only the value


#18

Hello Davide,
Here is the line tracking API:
https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_api

getMainFeatures() gets all features including barcodes. You can then read pixy.line.numBarcodes to see how many barcodes are present. The barcodes are in pixy.line.barcodes[0] for the first barcode and pixy.line.barcodes[1] for the second, etc, if they exist.

Hope this helps.

Edward


#19

Hello Edge, Im trying to make an application with QR/barcodes, they are around 25 different QR/barcode. Can Pixy read them all at once?

What is the effective distance to read them all?
Also, on this post someone mantioned ArUco, does pixy support this library?


#20

Hi, Pixy doesn’t support ArUco, nor does it track QR codes. It can track the barcodes that are included in our documentation: https://github.com/charmedlabs/pixy2/raw/master/documents/other/all_codes.pdf

More info here: https://docs.pixycam.com/wiki/doku.php?id=wiki:v2:line_quickstart