MATLAB Answers

aboomnea

how to registering an Image?

Asked by aboomnea
on 20 Jun 2013

i want to Registering an Image http://s23.postimg.org/c9ulo5n6z/140.jpg by this image http://s23.postimg.org/mnvfhe7xn/image.jpg

so i can get final image like this(this image from another example) http://s16.postimg.org/3z0zh2w0l/image.jpg

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

http://www.mathworks.com/help/images/examples/registering-an-image-using-normalized-cross-correlation.html

  2 Comments

Shashank Prasanna
on 20 Jun 2013

What is the error?

aboomnea
on 21 Jun 2013

xbegin =

    50

xend =

   561

ybegin =

-219

yend =

   292
 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

  0 Comments


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

  3 Comments

aboomnea
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.

aboomnea
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 http://s18.postimg.org/nh74dipm1/untitled.jpg not like i want

thank you every one "Alex Taylor" "Image Analyst" i use this code and i got this image http://s22.postimg.org/w4rwb9ek1/semi_final.jpg

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

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply today