0
$\begingroup$

I'm trying to automatically detect if an image is a collage vs a single photograph. I'm not too concerned with difficult cases of artistic collages. What I'm trying to solve is rectangular collages like below. I've tried edge detection (canny) + vertical and horizontal sobel filtering + line detection (Hough transform) to try to identify perpendicular lines but am getting too many false positives. I'm not very good at image processing so any input would be welcome. Thx!

enter image description here enter image description here

$\endgroup$
0
$\begingroup$

Here is a basic answer with some rapid experiments to show you what is possible to do with Morpholocical operations. Note that it is just a proof of concept, not a viable solution and you should improve it to better fit your problem.

First filter your image to detect edges. I used Canny but you may use a more appropriate one.

enter image description here

Then filter the BW result to keep only vertical and horizontal (hypothetical) lines by eroding the result with line structural elements. Here is the result for the erosion with a horizontal line of 5px:

enter image description here

Lastly sum each eroded images on its corresponding dimension. Here is the result of the sum of the previous image on the 2nd dimension:

enter image description here

From here you have to chose a threshold in order to infer the presence (or absence) of a collage. In the previous graph the sharp peaks indicate the position of horizontal boudaries of frames. A threshold value of 100 may be appropriate as it indicated that more that $1/3$ of the horizontal line is populated with edge pixels.

$\endgroup$
  • $\begingroup$ Thanks a lot. This looks promising. What do you mean by "eroding the result"? Like a horizontal or vertical Sobel filter? $\endgroup$ – mkohram Aug 2 '18 at 2:50
  • $\begingroup$ No, erosion is a morphological operation, check the link in first paragraph. $\endgroup$ – Louis Lac Aug 2 '18 at 8:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.