Blob detection in Matlab

preview_player
Показать описание
I recorded myself moving a piece of pink card around in front of my camera facing my door (with extraneous items dotted around the frame). Using Matlab and a very simple algorithmic chain, I was able to track the position of the blob in the frame.

Chain of processing:
Downsample image from 1920x1080 to 160x120
Downsample pixel bitdepth from RGB888 to RGB332 (and back to RGB888 again, to ensure the image function worked)
Convert to YUV using the matrix method
Threshold the image using U and V channels
Count through the columns of each row. When a non black pixel is encountered, increment a variable, otherwise decrement a variable. Using a peak detector, find the X pixel where this variable is at a maximum and note the X position. For every non black pixel, increment mass.
Use another peak detector for the rows, noting the row with the largest value to obtain Y position.
Plot!

As you can see, this will only work for one blob although it could be further expanded to work for more blobs (if separated by black space). The reason my flow method may seem somewhat convoluted (the pixel bit depth downsampling isn't required) is because I'm hoping to implement this in an FPGA with a real time camera.

Рекомендации по теме
Комментарии
Автор

It seems like a good job.
CImplementation is in Code or simulink? (code I guess)

So lately 2 years went by. Did you made it to the FPGA? IF yes how VHDL/HLS/SV?

kemagorar