Search code examples
c#opencvimage-processingemgucvsurf

Detecting truck wheels


I am currently working on a project which we have a set of photos of trucks going by a camera. I need to detect what type of truck it is (how many wheels it has). So I am using EMGU to try to detect this.

Problem I have is I cannot seem to be able to detect the wheels using EMGU's HoughCircle detection, it doesn't detect all the wheels and will also detect random circles in the foliage.

So I don't know what I should try next, I tried implementing SURF algo to match wheels between them but this does not seem to work either since they aren't exactly the same, is there a way I could implement a "loose" SURF algo?

This is what I start with.

This is what I get after the Hough Circle detection. Many erroneous detections, has some are not even close to having a circle and the back wheels are detected as a single one for some reason.

Hough Circles

Would it be possible to either confirm that the detected circle are actually wheels using SURF and matching them between themselves? I am a bit lost on what I should do next, any help would be greatly appreciated.

(sorry for the bad English)

UPDATE

Here is what i did. I used blob tracking to be able to find the blob in my set of photos. With this I effectively can locate the moving truck. Then i split the rectangle of the blob in two and take the lower half from there i know i get the zone that should contain the wheels which greatly increases the detection. I will then run a light intensity loose check on the wheels i get. Since they are in general more black i should get a decently low value for those and can discard anything that is too white, 180/255 and up. I also know that my circles radius cannot be greater than half the detection zone divided by half.

After dectection


Solution

  • In this answer I describe an approach that was tested successfully with the following images:

    The image processing pipeline begins by either downsampling the input image, or performing a color reduction operation to decrease the amount data (colors) in the image. This creates smaller groups of pixels to work with. I chose to downsample:

    The 2nd stage of the pipeline performs a gaussian blur in order to smooth/blur the images:

    Next, the images are ready to be thresholded, i.e binarized:

    The 4th stage requires executing Hough Circles on the binarized image to locate the wheels:

    The final stage of the pipeline would be to draw the circles that were found over the original image:

    This approach is not a robust solution. It's meant only to inspire you to continue your search for answers.

    I don't do C#, sorry. Good luck!