How do I use a low resolution photo cropped as a guide to re-crop a copy of a higher resolution original?

I have a low resolution square photo that was cropped (by the user) from high quality, not square, original. Then the low-resolution photo was resized down to thumbnail. I would like to automatically (without user intervention) redo the original photo in the same way to get a copy of the square version with a higher resolution. I do not have access to the original crop coordinates. All I have are two photos.

Here are some sample images (from my Facebook profile) to illustrate what I mean:

Original high-resolution photo - Cropped, then reduced, square photo

Again, the goal is to use a small photo as a guide to get a square photo with a higher resolution from the source.

The only limitations to the solution are:

  • Community: I use this for profile photos, so if it only works on faces that are perfectly acceptable! No need to generalize to all kinds of random images; photographs of people are a great place to start.
  • Platform: I use Node, but I would be happy to run this process in Ruby, Python, Java or C ++ (with Node bindings). It will almost certainly work on Heroku or AWS.
  • Speed: it will be very fast. For this to be useful, it had to run online, as I would block the user interface waiting for this action.

Does anyone have any ideas? I don’t know much about image processing, so I don’t know where to start.

EDIT: For Facebook in particular, there is a solution that is not so difficult. Harvest source data is available for profile images: https://graph.facebook.com/bcherry/profile?fields=pic_crop

This will help me overcome my immediate hurdle, but it may not be a long-term solution, so the answers below are still very useful for a more general problem.

+5
source share
3 answers

Javascript-ness , " " , .

- - , .

EDIT: script ImageMagick, , . NormCrossCorr " , , ."

, !

+1

, javascript. python. :

scikits-image

PIL

0

, , . , , / . - , , , .

If there was some kind of averaging in scaling or too much loss of image compression, you could best blur both images in Gaussian and try to match local minima or maxima of primary colors based on local features of blurry images. Again, the match should be fuzzy.

0
source

All Articles