How to perform xcorr2 only in one direction?

6 ビュー (過去 30 日間)
Nut 2016 年 10 月 6 日
編集済み: Nut 2016 年 10 月 24 日
I'm working on two images having the same dimensions. They don't require to be aligned vertically, but only horizontally. Thus, because the images are very big, I would like to perform the xcorr2 function, but only in the horizontal direction, avoiding the unnecessary overlaps, to save time (currently, it takes about 75 minutes).
Is this possible? How?
Thanks for your answers.

回答 (1 件)

Dimitris Iliou
Dimitris Iliou 2016 年 10 月 14 日
If I understand correctly, you are trying to use xcorr2 to align two images and also improve the processing time.
In general, xcorr2 is a function used to compare 2-D arrays; not specifically images.
That said, I would like to suggest two different things:
  1. xcorr2 allows you to use gpuArrays which will allow you to use the Parallel Computing Toolbox. This method has two caveats; the prerequisites to use this method are: (1) Parallel Computing Toolbox, (2) A CUDA-enabled GPU
  2. Instead of using xcrorr2 you could use the imregcorr function that is designed to work with images.
  • To use this function you would need to have the Image Processing Toolbox
  • You can find more details about this function in the following link:
In general, MATLAB has a set of functions that allow the automatic registration of images. Please see the following link for more details:
  1 件のコメント
Nut 2016 年 10 月 24 日
編集済み: Nut 2016 年 10 月 24 日
I just had a look, your suggestions are not exactly the operation I asked, however the second one may fulfil my needs the same. I will try it.
Both your answers are very interesting, especially the second one. I didn't know the image registration techniques, so thank you very much, really great tip!
PS: I was trying to align the images using xcorr2 function because its documentation explains how to solve a similar problem, so I was using that method. As you correctly said, it entails a conversion from uint8 to double.



Find more on Printing and Saving in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by