<< return to Pixycam.com

Pixy custom algorithm

Hi,

I’ve got a basic proof of concept running on a computer with a webcam and opencv.
The camera is facing top-down mounted at the top of a frame covered by a cloth surface.
As I ‘poke’ through the surface I’m currently looking at where (horizontally) and how far this happens.

I also had a look through the forums for similar posts and as far as I can tell I can modify the existing source code,
like Sondre’s post(http://www.cmucam.org/boards/9/topics/5308). Is this the recommended route to take at the moment ?

I also saw a mention of a FirmwareSDK. Is there an estimated release date ?

Also, back to the surface tracking basic algorithm, here’s what OpenCV functions I’m using:

  • cvtColor
  • blur
  • minMaxLoc
  • threshold(Otsu)
  • erode
  • dilate
  • findContours
  • convexHull
  • approxPolyDP

I assume some will be easier to port than others, especially approxPolyDP and convexHull.
Is it realistic to attempt and run all these on Pixy’s CPU ?

Thanks,
George

Hello George,
Pixy has about 128K of RAM available for algorithms. I’m not sure how much RAM is required for the functions you’ve listed, but that’s probably the first question that needs to be answered. Sondre’s code is a good example of how to test an algorithm and it uses Pixy’s actual image data.

Edward

Hi George!

Does your algorithm depend on multiple frames? Or does it work on a single image?
Pixy also uses a 72K bank of ram (SRAM1_LOC) for storing images, but only 1 image at a time, and of the smallest resolution.
With the smallest resolution, each image takes 320*200 = 64KBytes. So if you have to compare 2 successive images, you need to grab half of the frame(320x100 or 160x200) twice, do analysis, and then the same for the next half. This can be done using an offset, but you should have minimum 2 pixel overlap of the halfes. This is because before you can use the raw frame in your algorithm, it needs to be interpolated, and when interpolating you have to skip the bottom and top row, as well as the left and rightmost columns.

But I recommend implementing your algorithm in pixyMon first, just keep these limitations in mind when doing so, so that porting your algorithm from pixymon to the firmware is less of a hassle.

See this post for a short intro to how I implemented my algorithms in pixymon http://www.cmucam.org/boards/9/topics/5320 (currently the last reply).

I hope this was helpful, and good luck!

Hi Sondre,

Thank you for the explanations, these are very helpful.
At the moment I’m only using a single frame.

I may reduce the resolution quite a bit as well to gain speed
because I might be able to get away with less precision for this particular project.

Testing in pixyMon first sounds like a valuable tip.
I’ll be sure to get the algorithm working there first before committing to firmware changes.

Thanks a lot,
George