Query: understanding the blob algorithm

248 views
Skip to first unread message

simon.d.levy

unread,
Jul 29, 2015, 1:15:12 AM7/29/15
to pixy_firmware_sdk
So, following Rich's advice, I've  added my own "cooked" mode to PixyMon, by copy-pasting the code from the cccblobs module (since that was the one that was obviously working).  This is my usual approach with anything this complicated: copy and gradually modify.

Now, I think understand the basic logic of these modules:

(1) The module's constructor calls a class from the common folder (e.g. Blobs), passing the common class a pointer to the queue of qvals (four-tuples) that the module will create
(2) One of the module's render methods (like renderCMV2()) calls the rls() method, which in turn calls handleLine()
(3) handleLine() runs on each line of the image, processing pixels and queuing up qvals (four-tuples)
(4) After the qvals are queued up, the render method calls the common class's workhorse function (Blobs::blobify())
(5) The workhorse function dequeues the qvals and processes them (Blobs:runlengthAnalysis())

So here's my question: how much of the algorithm-specific work is done in the PixyMon module (handleLine()) and how much in the common code (runlengthAnalysis()) ? Obviously it will be easier if most of the work is done in the common code (Blobs), but I'm unfamiliar with content of the qvals, how they're constructed, etc. 

Any tips would be appreciated!

simon.d.levy

unread,
Jul 29, 2015, 8:45:09 PM7/29/15
to pixy_firmware_sdk, simon....@gmail.com
Sorry, guys: I should've tried the CMUCam forum first!  Just found this post explaining things pretty clearly :^)

Rich LeGrand

unread,
Jul 29, 2015, 10:51:14 PM7/29/15
to simon.d.levy, pixy_firmware_sdk
Hi Simon, 
Sorry for the sluggish response.  I've been out of radio contact for the last couple days.    Keep the questions coming --- I'll be able to answer when I'm back in the office on Friday.  

thanks,
--rich  

--
You received this message because you are subscribed to the Google Groups "pixy_firmware_sdk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to pixy_firmware_...@googlegroups.com.
To post to this group, send email to pixy_fir...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/pixy_firmware_sdk/ad9a711e-a059-4a29-aade-48ecf52da761%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.



--

simon.d.levy

unread,
Jul 29, 2015, 11:06:52 PM7/29/15
to pixy_firmware_sdk, ri...@charmedlabs.com
No worries, man!  As I noted above, I actually found a good tip on the forum: handleLine is using the Bayer-coded (RGGB) four-byte pixels to help with blob registration.  Based on this understanding, I added a little debugging routine that dumps the image out as grayscale to a PGM file (grayscale being a preliminary to optical flow calculation).  (R + G1/2 + G2/2 + B)/3 gives a reasonable grayscale, avoiding the floating-point computations used by the more balanced formulas.

Also found an awesome benchmarking page for the whole range of optical-flow algorithms, and Matlab code for many of them.  Can't wait to code this up and run it on the Pixy!

Of course, any additional insights will be appreciated :^)   Meanwhile -- safe travels!
Reply all
Reply to author
Forward
0 new messages