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?
We were taking bets on when someone would bring this up — 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:
And the PDF version:
Hopefully it is usable until we get the barcode resources posted.
Knowing how much you’re overwhelmed with work I really appreciate your responsiveness
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?
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?
Ah, I goofed with the link – here’s the odf (OpenOffice Drawing) file:
The codes are already in Pixy’s ROM/algorithm, so no teach is necessary. Pixy can read lots of codes at the same time.
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:
Let me know if this doesn’t answer your question.
That’s good to know! Is there a chance Pixy_1 will get a FW upgrade for barcode reading, too?
I just noticed the barcodes can’t be rotated or upside down. I was trying to work out this shortcoming with something like this:
But no success. I guess simple QR codes could be more applicable in real life situations.
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?
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.
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
The line tracking algorithm (which includes the barcodes) and color connected components (which includes color codes) are separate programs, which might make this difficult.
Thanks for the suggestion! They are used by LEGO? At any rate, we’ll add this to our suggested features.
i have a question.
Is the reading of the bar-codes also possible with pixycam 1 or only with pixy2?
Only Pixy2. Thanks!
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
Here is the line tracking 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 for the first barcode and pixy.line.barcodes for the second, etc, if they exist.
Hope this helps.