<< return to Pixycam.com

Determie Object Speed and Distance

I was wondering if the PIXY can track an object like an automobile going between 50-125 miles per hours. If yes, how would it do that since I saw the getBlocks API but I didn’t see any time for these block that would tell me the time of an object.

I am new to this camera so I don’t really know all that it can do.

Any help on this would be great.

I’ve never tried this, but there’s a possibility that it would work. For fast objects, you need good lighting to reduce motion blur. To detect velocity, you can use Pixy2’s blocks[] object and the m_x, m_y, m_index and m_age fields to infer the velocity over 2 or more frames.


Hope this helps!


Thanks for responding and giving me something to look into.

How many max frames per second does the camera function at. I have seen 50 and then 60 in some places.

Also does 1 block represent 1 frame?

Thanks again

Pixy2’s maximum framerate is around 62 FPS. To get the framerate, you can call getFPS():


You can set the frames per second by setting “min frames per second” parameter:


A block is a detected object. There may be several blocks in a frame.


Thanks Edward… I do understand how that all works now…

one other question is there any way to determine distance travel of an object by using the frames and blocks within the frame?


Hello Keith,
You can determine the number of pixels a given block travels between frames by matching the m_index values of the blocks between frames, so that you are referring to the same object.

But pixels are not the same as physical distance. Relating pixels to physical distance is a different problem. An object can move away from the camera 1 meter (for example) and not move within Pixy’s image, although you would expect it to get smaller. Relating physical movement based on movement within an image can be tricky…


Thanks I have been looking at that as a possible way to calculate distance. I guess I would need to know the PPI pixels per inch. Is that possible?


It’s possible to determine the “pixels per inch”, but bear in mind that this value changes based on the distance from the camera. If the object is far, the “PPI” is small. If the object is close, the PPI is large.

If your object is at a given (known, consistent) distance from the camera, the PPI will stay constant (more or less) and you can measure it by moving an object a known distance (1 foot, for example) parallel to the camera’s image plane, such that the distance from the camera doesn’t change and seeing how far within the image the object has moved in pixels. You then divide the pixels by distance (1 foot) and then you get pixels per foot for that distance. This is called camera calibration and once you’ve done it, you can recover real distances with that pixels/foot value.

If your object is moving non-parallel to the image plane (such that the distance from the camera changes) things are going to get much more complicated.

Hope this helps.


One thing I wasn’t sure about is at the time I do a get blocks and read the x,y is the resolution always the same or are you saying this resolution changes base on the distance and or other factors?

Thanks for your help,

I belong to an archery club and saw a post on this site that is related to what I would like to do. That is find the velocity of an arrow.

So based on what you said if I only track one object such as an arrow from 6 ft or so (as it passed in front of the camera) and I could calculate the Pixel movement, then calculate velocity.

A question I have is the resolution of the x,y in the blocks for this object. From what I read it seems that somewhere around (315,207) is what the x,y represents. Is that true?


This is the resolution Pixy2 uses, correct.

Measuring the speed of a object traveling at 100 to 200 mph (arrow speed) is challenging, mostly because of motion blur. Motion blur will smear the object with the background, so the color that Pixy sees will be different than when the object is sitting still.

If the object is large, the problem is simplified, because motion blur affects larger objects less. And you can move the Pixy back from the motion so that the object isn’t moving so fast across the image.

The fact that the arrow is skinny makes things more difficult.

You will need very bright lighting at least. Hope this helps.


Thanks, actually this would be for very young user just starting out. I don’t think they would get over 80-100 mph from what I have seem so far. Also if I added a bright color sticker around the shaft it may help.

Anyways thanks for all your help… I may give it a try!