|
roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson) wrote in
message <g7ht8e$avd$1@canopus.cc.umanitoba.ca>...
> In article <g7hehp$lkc$1@fred.mathworks.com>,
> Abel Brown <brown.2179@osu.edu> wrote:
>
> >i have about 2000 images of a long column (top to bottom, in
> >order) and i would like to merge all of them into one
> >continuous image. Many even have a red line that was drawn
> >on the column for reference when merging. I have the image
> >processing & neural network toolbox etc I just dont know
> >where to start.
>
> Calculate the total number of rows in the images. Add one row
> per image for the dividing row. Allocate an array with that
> many rows and whose width is the width of the widest image.
> If the images are not all the same width, you will need to
figure
> out what background colour you wish to use to pad the narrower
> images.
>
> Now do something like:
>
> redrow = repmat([1 0 0], WidestImage, 1);
> startrow = 1;
> for K = 1:2000
> if K ~= 1
> NewImage(startrow,:,:) = redrow;
> startrow = startrow + 1;
> end
> [thisheight, thiswidth, numcolors] = size(TheImages{K});
> NewImage(startrow:startrow+thisheight-1, 1:thiswidth, :)
= ...
> TheImages{K};
> startrow = startrow + thisheight;
> end
>
>
> If all of the images are exactly the same width and the
images are
> stored in a cell array, then there are ways to put the new
matrix
> together all at once in a single call using cell2mat (and
you can
> even "shuffle" the seperating row in at the same time.)
> --
> "Nothing recedes like success." -- Walter
Winchell
Thanks x 10! I really appreciate your response.
However, the images are not perfect top to bottom. the
images have overlap and need aligned both vertically and
horizontally. (the red line simplifies the horizontal
alignment ) I was thinking of something more like Photoshops
photomerge function just with matlab instead.
|