4

I have a lot of photos with tanks. Every tank has holes where shoul be inserted metal plate.

tank photo

I need to find all holes without plate.

I tried to search circles by HoughCircles, used training haar classifier, but did not get an acceptable result.

Holes are small (about 30x30px), lighting is not permanent.

I would appreciate any ideas.

Thanks!

Linkorn
  • 417
  • 1
  • 4
  • 13
  • 1
    What are the results you got? Since the edges of those plates are in high contrast with the rest of the surface, if you are able to detect the circles, than you could make a ROI around each one of them and use hough lines detection to find out, if there is a line through the area of the circle, or not. – j.kaspar Mar 28 '16 at 16:06
  • Thanks! i need count all empty holes. In my current version i use haar classifier (it was trained on holes with plates but somehow it finds empty holes too), and in this holes i try to use lines detection, It's works sometimes, but some photos have shadows at the tanks and lines not enought contrast. – Linkorn Mar 29 '16 at 06:29

4 Answers4

2

If the lightning is the problem, you could try to do following: (the result depends on how problematic those shadows are)

1) maximize the contrast (described nicely here)

2) canny edge detector. Tweak the parameters to detect the edges correctly, process the image through the detector and do the operations (detect circles, make ROIs, detect lines in them) on the output.

3) if it is possible, a "hardware" solution would make a big difference - try to even the light conditions by adding some light to the camera. I can imagine, that it is the hardest part, but unfortunatelly, not everything can be solved by a software

You may need to combine the steps, to get reliable result.

BTW: the haar clasifier is not the best solution, but it could also work. It depends on how much samples did you provide and also on the light conditions, as mentioned above

j.kaspar
  • 751
  • 1
  • 11
  • 29
  • Thank you, j.kaspar! For haar classifier I prepared about 600 positive samples ([example](https://yadi.sk/d/jQcbSNWYqarED)), but it found empty holes too. Maybe i use incorrect negative samples - i collected a lot of factory backgrounds and tanks with empty holes ([example](https://yadi.sk/d/u-KJdlC1qareJ)). – Linkorn Mar 30 '16 at 08:14
2

Big thanks for all advice! In result I came to the complex decision:

  1. haar classifier found all holes;
  2. next, I use HoughCircles and throw out wrong holes;
  3. Each hole I convert to binary format and calculate white and black pixels around center.

It's works good for my purposes.

enter image description here

Linkorn
  • 417
  • 1
  • 4
  • 13
1

I would try to do that with different steps:

  1. Hough circle detection on the entire image, in order to detect ONLY this bright circle that is the tank border. It will give you the region of interest.
  2. Hough circle only into the ROI, on the gradient/edges image in order to detect all the small holes. You already know what are the holes dimensions/radii, so you can filter the results.
  3. for each small hole detected, an edge detection in order to check if the plate is present.

Can you share the original image (without the red indication)? I may find some time to do a test.

FiReTiTi
  • 5,597
  • 12
  • 30
  • 58
  • FiReTiTi, [original images](https://dl.dropboxusercontent.com/u/32710/so.zip) , 1_09-03-16_9-34-16.jpg has one empty hole. My current steps: i found all holes, every hole i convert to binary format and calculate white dots around center. This method works good, but some top holes have a perspective and plate is not in center. Thanks! – Linkorn Mar 30 '16 at 08:00
  • The white circle is not present on every image, which makes the ROI difficult to determine. I have to revise what I said. – FiReTiTi Mar 31 '16 at 22:21
1

It is better to divide the problem into two parts: 1. Region of interest detection. this part can be done by using image processing techniques. a. rgb to gray scal conversion. b. the white circle should be very clear. It can be detected by any of the shape detectors.

  1. the next step is to find if any of the holes exist. a. based on color you can detect the these circles that you wanna test. b. I suggest using 3 different features. HOG, GM, and SSIM. Based on my experience I think these features will lead to good results. you can use bag of visual words or sparse coding to combine features for each circle. c. use viola jones dclassifier. this is an adaboost classifier that can use multiple features.
Bashar Haddad
  • 369
  • 2
  • 10