I think that you will never get good results without a real user telling the program what to do. Think of it this way: how will your program decide when there is more than one interesting object (for example: 2 cars)? what if the object you want is actually a mountain in the background? what if there is nothing interesting in the picture, so nothing to choose as an object for cropping? etc. etc.
With that said, if you can make assumptions such as: there will be only one object, then you can go using image recognition algorithms .
Now that I think about it. I recently gave a lecture on artificial intelligence in robots and robotic research methods. Their study continued linguistic interaction, evolution, and language recognition . But for this, they also needed some simple pattern recognition algorithms to process the perceived environment. One of the tricks they used was to create a 3D graphic of the image, where x and y, where the normal x and y axis and the z axis were the brightness of this particular point, then they used the same technique for red-green values, and blue yellow. And so they had something (relatively) that they could use to distinguish objects from the perceived environment.
(I'm sorry, but I can’t find a link to the good diagrams that they showed how it all worked).
In any case, the fact is that they were not interested (so much) in pattern recognition, so they created something that worked well enough and used something less advanced and, therefore, less time-consuming, so you can create something simple for this difficult task.
Also, any good image editing program has some kind of magic wand that will choose with the right amount of settings, the object of interest that you are pointing to may be worth your time and that.
So this will basically mean that you:
- must make some assumptions, otherwise it will fail.
- probably best served by methods from AI and, more specifically, pattern recognition
- you can see paint.NET and their algorithm for their magic wand
- try to use the fact that a good photograph will have an object of interest somewhere in the middle of the image
.. but I'm not saying that this is the solution to your problem, maybe something simpler can be used.
Oh, and I will continue to search for these links, they contain some really valuable information about this topic, but I can’t promise anything.
sven
source share