This is called &quot;salient region detection&quot; and some current approaches (there are many) include detecting the contrast between each pixel and the global or regional average color or luminosity. Areas of high contrast are likely to be regions which are considered interesting. Once you have those regions, you would have to have a separate algorithm which maximizes the placement of a rectangle (the crop) to get the greatest coverage of &quot;interestingness&quot;.<p>You could also combine this with face detection, so that a picture of someone in a bikini doesn&#x27;t end up cropping just to their midsection, since going by surface area, the torso could have more high-contrast pixels than the face.<p>Here&#x27;s one approach which has open source C++ code:
<a href="http:&#x2F;&#x2F;mmcheng.net&#x2F;effisalobj&#x2F;" rel="nofollow">http:&#x2F;&#x2F;mmcheng.net&#x2F;effisalobj&#x2F;</a>