# Automatically detect an image collage

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!

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.