Thread Subject: image merge

Subject: image merge

From: Abel Brown

Date: 8 Aug, 2008 12:35:05

Message: 1 of 3

hi all

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.

can someone point me in the right direction?

Thanks!

Subject: image merge

From: roberson@ibd.nrc-cnrc.gc.ca (Walter Roberson)

Date: 8 Aug, 2008 16:46:06

Message: 2 of 3

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

Subject: image merge

From: Abel Brown

Date: 11 Aug, 2008 00:46:03

Message: 3 of 3

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.

Tags for this Thread

Everyone's Tags:

Add a New Tag:

Separated by commas
Ex.: root locus, bode

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Tag Activity for This Thread
Tag Applied By Date/Time
image photo merge Abel Brown 8 Aug, 2008 08:40:18
rssFeed for this Thread

Contact us at files@mathworks.com