By imptr


2018-11-08 23:24:59 8 Comments

I have images that contain transparent rectangular overlay similar to the following images: Image1 Image2. My goal is to detect if these rectangular boxes exist (location doesn't matter). These boxes will always have edges parallel to the sides of the image.

Assumptions:

  • The transfer function of how the transparent rectangles are drawn is now known
  • The sides of the rectangles will also be parallel to the image

Attempted Solution 1: Color Detection

So far, I've tried color detection via cv.threshold as well as using band-pass filters with the cv2.inRange() on multiple color spaces (HSV, LUV, XYZ etc). The issue with color detection is that I am also capturing too much noise to effectively just tune for the pixels for the transparent area. I tried laying the masks using cv2.bitwiseAnd but still can't tune the noise down to a negligible state. I tried only isolating for large groups of pixels using morphological transformations but this still fails.

Attempted Solution 2: Edge Detection + Edge Validation

My second try at detecting the box involved applying cv2.bilateralFilter and then generating hough lines via cv2.Canny,cv2.HoughLinesP. Although I am detecting a significant number of edges related to the transparent box, I also get many miscellaneous edges.

To filter out false edges, I take each line segment and check a few sample pixels to the left and right sides. By applying something something similar to what I believe the transfer function is (cv2.addWeighted) I checked to see if if I can reproduce the similar values. Unfortunately, this also doesn't work well enough to tell the difference between edges from the transparent box vs "real edges." Result From Edge Detection

Any thoughts on how I might detect these boxes is highly appreciated!

0 comments

Related Questions

Sponsored Content

23 Answered Questions

[SOLVED] Image Processing: Algorithm Improvement for 'Coca-Cola Can' Recognition

21 Answered Questions

[SOLVED] Peak detection in a 2D array

1 Answered Questions

2 Answered Questions

[SOLVED] OpenCV edge detection on PNG image with alpha layer

7 Answered Questions

[SOLVED] Simple and fast method to compare images for similarity

0 Answered Questions

Detecting Rectangular Shapes in edge image with OpenCV

3 Answered Questions

[SOLVED] Detect Plants in a grass Image

3 Answered Questions

1 Answered Questions

Sponsored Content