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!
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.
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:
Lastly sum each eroded images on its corresponding dimension. Here is the result of the sum of the previous image on the 2nd dimension:
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.