MATLAB Answers


how to registering an Image?

Asked by aboomnea
on 20 Jun 2013

i want to Registering an Image by this image

so i can get final image like this(this image from another example)

i try to use this code but it dose not work i get error


Shashank Prasanna
on 20 Jun 2013

What is the error?

on 21 Jun 2013

xbegin =


xend =


ybegin =


yend =

 Subscript   indices must either be real positive integers or logicals.
    Error in try_regist (line 84)
    extracted_onion = peppers(ybegin:yend,xbegin:xend,:);

2 Answers

Answer by Alex Taylor
on 21 Jun 2013

Looking at these images, I see at least two potential problems:

1) Visually, it's tough for me to see where the regions of alignment are in these two images. This may be a very tough registration problem.

2) The resolution of these two images looks like it may be quite different. If this is the case, Normalized Cross Correlation will not work. A straightforward use of correlation is only translation invariant.

You might want to take a look at imregister/imregtform as an alternative algorithm.

- Alex


Answer by Alex Taylor
on 21 Jun 2013

After looking again, I can see the features that correspond in these two images. If you don't have a lot of images like these to work with in a batch, the easiest path to success will probably be manually selecting the point correspondences using cpselect and then using cp2tform/imtransform to obtain your registered image. I did this and obtained reasonable results.

 help cpselect


on 22 Jun 2013

i want to do it Automatically

Image Analyst
on 22 Jun 2013

Where did the first image come from? It looks like it's segmented and masked from something, possibly the first image which means that they'd already be registered. Anyway, did you try imregister like Alex suggested? Though I have doubts because I just don't see enough information in your first image to register with any image at all.

on 23 Jun 2013

yes my first image comes from segmented and masked and some other process . "Image Analyst" my project is detect cancer in liver from CT image. i try imregister i got this image not like i want

thank you every one "Alex Taylor" "Image Analyst" i use this code and i got this image

bw = im2bw(processed_image);
  Ifill = imfill(bw,'holes');
  Iarea = bwareaopen(Ifill,1);
  boundary = bwboundaries(Iarea);
   [m,n] = size(boundary);
   imshow(original); hold on; 
   for k = 1 : m           % Loop through all blobs.
     b = boundary{k};

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today