Pixy resolution

Added by Ramesh Warusavitharana 7 months ago

Using optical sensor resolution of the pixy is 640 x 240. But following states it can detect x coordinates upto 320 and y coordinates upto 200. what is the reason for this? [i want to make a distance measurement meter using pixy]

pixy.blocks[i].x The x location of the center of the detected object (0 to 319)
pixy.blocks[i].y The y location of the center of the detected object (0 to 199)
pixy.blocks[i].width The width of the detected object (1 to 320)
pixy.blocks[i].height The height of the detected object (1 to 200)

Untitled.png (5.3 kB)


Replies (9)

RE: Pixy resolution - Added by Edward Getz 7 months ago

Hello Ramesh,
The sensor is actually 1280x800 resolution, but because of RAM limitations Pixy can't process a frame that large. The output resolution of the color connected-components algorithm that Pixy uses is 320x200.

Hope this helps.

Edward

RE: Pixy resolution - Added by Tim sy 5 months ago

I've had the exact same question after measuring the limits of the outputs...
So let me get this straight, you advertise that the cmucam5 works on 1280x800@25 fps or 640x400@50 fps, but actually the customers get a resolution of 320x200 and there's now way to get a stream from any of the declared options without modifying the firmware?
And even if we did, there's not enough RAM to make the processing.
The pixymon image quality is so bad that I can't even extract the intrinsic values of the camera. I just bought 4 of them and they are useless to my project...

RE: Pixy resolution - Added by Jesse French 5 months ago

Hi Tim,

sorry to hear you are frustrated! Just to be clear - the sensor used in Pixy is capable of 1280x800, but we cut that in half to achieve 50fps framrate. So Pixy processes a 640x400 resolution frame but because of the color interpolation, the effective resolution is 320x200.

I'm not sure what you mean when you say "extract the intrinsic values of the camera."

What is your project?

Thanks,
Jesse

RE: Pixy resolution - Added by Tim sy 5 months ago

Its a part of an engineering project at the university.
Our system, among other things, tracks a colored ball using 2 webcams with an algorithm similar to yours.
We wanted to change the feedback system (cameras) to free up computation power and thus reduce delay. The tracking is done in stereo and then triangulated to receive 3d position. in order to do that, you must take into account the lens distortion near the edges (which are pretty harsh with the cmucam, no offense).
This is a relatively simple process, that also cuts away some of the picture. You can find a quick reference here:
https://www.mathworks.com/videos/camera-calibration-with-matlab-81233.html

The thing is, that the end-user resolution is, as stated, 320x200, which leaves very little room for actual data after cropping.
And, to calibrate the intrinsic values (lens distortion), you need to shoot some checker boards, but the results aren't conclusive because of the quality (see attached photo of an item being shot from up close), and we haven't started talking about items 2-3 or more meters away.

Is there any way to bypass this? add external RAM? anything?

quality.JPG (51.5 kB)

RE: Pixy resolution - Added by Jesse French 5 months ago

Got it, thank you for the info! That's very helpful.

Short answer: there's no way to increase the RAM, or bypass this unfortunately. Pixy is optimized for identifying color blobs and tracking them at 50fps. One approach would be to use a different lens - Pixy has a standard M12 lens thread, and you could use a lens with shorter focal length (Pixy ships with 2.8mm focal length) so the effective image is larger.

The grittiest details:
When you are viewing in PixyMon, you are actually getting a lower-res than when Pixy is processing frames - we need to downsample from 640x400 because Pixy doesn't have enough contiguous RAM to grab at 640x400, and there is also a blockiness in PixyMon that's introduced because we're downsampling a Bayer pattern.

But that's just when grabbing raw/cooked frames. When Pixy is processing color blobs, there is no downscaling. Pixy does this by pre-processing in the M0 core and eliminating lots of "uninteresting" pixels--- this allows us to process the entire frame with a small amount of memory (we don't need to store each pixel). It also makes things fast.

Cheers,
Jesse

RE: Pixy resolution - Added by Tim sy 5 months ago

I understand. but I have to ask: if when using UART or SPI (or others), the maximum "object center" is 320/200, as well as size if we take the cam so close that the object covers the entire frame.

My question is: what good is it to process a 640x400 frame if the outcome is 320x200 whether I use pixymon or not?

RE: Pixy resolution - Added by Jesse French 5 months ago

Right - when you are in the default mode, Pixy is performing a color interpolation of the 640x400 frame. The color interpolation is a nearest neighbors algorithm, which grabs the nearest color to get an RGB value. The result is that the largest x value is 319 and the largest y value is 199. This is how the tracking algorithm works.

"What good is it..."? Well, it's twice as good as processing a 320x200 frame...then you'd end up with 160x100 values, which sounds like it would be even worse for your application. Not sure what you're getting at. Pixy does the task it's designed for - basic, rapid, relatively robust object tracking for under $100.

I'm sorry I can't do more for you!

Best,
Jesse

RE: Pixy resolution - Added by Tim sy 5 months ago

Well, I must say that the pixy does the work it does pretty well.
Its just that its a little misleading to state about 640x400 when that feature is only available as a black box and not to the end-user.
To exaggerate, imagine I would advertise that my product does the same thing in 4K HD quality. But post-market, state that the camera interpolates color on a 10th-degree filter basis, leaving the end user with a 320x200 outcome...
Then there is not much use or benefit for the fact that the process originally runs on 2160p. Again, its an extreme version of the same situation, but I hope you see where I'm getting at.

I know it came out a little snide, and I'll survive the 300$, but I just feel like the product did not provide what I was hoping for. Maybe I also aim my hopes up too high.

Cheers and best regards,
Tim

RE: Pixy resolution - Added by Edward Getz 5 months ago

Hi Tim,
I see your point. I'll see what I can do about changing so it's not misleading as you describe.

You might consider using a more general purpose camera like the Raspberry Pi camera. It has good specs and is a blank slate -- good for research I'm guessing. I wish I had these kinds of choices when I was in school :)

Edward

(1-9/9)