1

I am performing the following steps:

  • I insert a mark in an original image img1 to obtain a watermarked image img2.
  • I crop the the watermarked image to obtain img3.
  • I want to crop a particular part of the original image img1 to obtain the same part like img3.

My question is how to find where the cropped part is located in the orignal image?

Eitan T
  • 32,660
  • 14
  • 72
  • 109
  • 1
    This sounds a bit too trivial. Does `img2` have the same dimensions as `img1`? Do you have the code for extracting `img3`? – Eitan T Nov 23 '12 at 16:22
  • Why dont you just use the same row and column indices for cropping the img1 that you used to crop img2? e.g. im3 = img2(cropIndices); img1a = img1(cropIndices); – jerad Nov 23 '12 at 16:48
  • This is the same question answered [here](http://stackoverflow.com/questions/11360297/matlab-how-to-find-out-if-a-matrix-is-in-another-martrix/12084000). – carandraug Nov 23 '12 at 21:05

1 Answers1

1

You could use cross-correlation http://www.mathworks.ch/ch/help/images/ref/normxcorr2.html

Here is an example http://www.mathworks.ch/products/demos/image/cross_correlation/imreg.html

If the cropped image has been resized I think your problem is more similar to this one http://thydzik.com/matlab-scaled-image-normalized-cross-correlation/

lib
  • 2,918
  • 3
  • 27
  • 53