I am trying to determine the position of an object with very little “hue”. It is made of an 1000mm x 1000mm aluminium sheet with a black plastic frame around it. The frame is about 10mm thicker than the sheet. I`m thinking about using different colored laser lines modules together with Pixy. If i point the laser module with an angle against the object, the line will look like this: - ___ - , with an center line and two stub lines, at the point where the sheet and frame meets because of the height difference. So the big question is, can pixy determine the lenght and position if the center line? This will determine the objects lenght. If so, I will add another line with a different color parallel to the first line to make a color code. This is to determine the objects Y position and the angle of the objekt. If that works, I will add an third and fourth line crosswise to be able to determine the X position. There will total of 4 different laser colored lines on the object, overlapping each other. Can Pixy track all of those lines and CC-objects? As an bonus, I would also like to determina the objects distanse from the camera. I guess it will be possible just by measuring how the lines get smaller further away the object is from the camera. Also, the lines will separate more when the distance is larger.
See the attached file for how I am imaging this would work. I have not yet been able to test it IRL. I will use an Arduino for this.
interesting question. Pixy is good at detecting contiguous blocks of color - lines are a little challenging, depending on how thin they are. That said, if Pixy is close enough, it should be able to detect them - the minimum size is 4x1 pixels in the camera sensor.
Once Pixy is detecting objects, it will report X-Y coordinates as well as area of regular objects. It will also report the angle of color-code objects. You can do some math in your code to work out distance, although it may not be very robust.
Worth a shot, I’d say!
Hope this helps,
Thanks a lot for your answer!
I have managet to detect two lines now in the default mode, but not in cooked mode. why is it like that? see attached photo.
I can not get a color code out of the lines when they are not next to each other, is there a way around this?
Cooked mode is actually half-resolution of default mode. Usually this doesn’t matter much, as cooked mode is used mostly for debugging, but it looks like you found a good example of where cooked and default differ significantly/functionally.
Some update on the project.
I have successfully detected a red laser cross line, a specially if i adjust the lens out of focus. My aluminium object is reflecting the laser lines quite well. The line needs to be quite thick to get a secure reading. I either adjust the pixy to see the laser line be exposed all over the aluminuim object, or just to see the cross. Anyway, I now get the objects x and y position and area. I will try it out further.
Looks interesting! Reducing the camera brightness helps as well. Laser light tends to overexpose the sensor, leading to saturation. Using a low brightness (exposure) will allow the camera to get a good hue value (red) without saturation, which can distort the hue (orange, yellow, white, instead of red)
Hi Anders, i’m curious about how you were able to track the line and see color at the same time. How did you do it? If it’s possible, can I see the code you used? It´s for a project I have in a month and I need to track lines and see a green spot.