MATLAB Answers

how to join two image

501 views (last 30 days)
Ibrahim Thorig
Ibrahim Thorig on 13 May 2014
I have two fragments of one image, i want join these two piece. someone please tell me how to join these two fragments.
thanks in advance

  0 Comments

Sign in to comment.

Answers (2)

Benjamin Avants
Benjamin Avants on 13 May 2014
You should use the cat() function.
if your images are A and B and you want to merge them so that you get AB (A on the left with be on the right) the command looks like this:
newImg = cat(2,A,B);
If you want A on top of B:
newImg = cat(1,A,B);

  3 Comments

Image Analyst
Image Analyst on 13 May 2014
He's probably looking at torn scraps of paper, which people have asked about before. Think dead sea scrolls or forensic reconstruction.
Benjamin Avants
Benjamin Avants on 13 May 2014
If Image Analyst is correct, the solution to your problem is much more complicated and will take a great deal of work to implement. To my knowledge, no such algorithm has been submitted as a File Exchange program.
If the two pieces are aligned and sized the same, you may be able to merge them manually by displaying them both in the same figure and shifting one of the images until it is properly lined up with the other one. Knowing the offsets, you could then merge the image data using those offsets to end up with your final image. Obviously this would be impractical if you have many such pieces to align. It also would not work well if the image pieces are rotated at all or are scaled differently.
The merging process would also be non-trivial, as a decision would need to be made for each overlapping pixel as to which pixel should be incorporated into the final image.
V VENKATA KRISHNAN 14BEC0060
Hey, Once we have used concatenation, how can we deconcatenate to obtain the exact previous images?

Sign in to comment.


Image Analyst
Image Analyst on 13 May 2014
Have you checked out these similar questions: http://www.mathworks.com/matlabcentral/answers/?term=tag%3A%22torn%22

  0 Comments

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!