content of two Images into one image

I have 2 folders each containing equal number of images. I need to create a new folder which contain images which have the contents of both folder images in single image. For example one folder named A contain 100 images in each of it contain picture of a boy on left side of the image. Another Folder named B contain 100 images each contain the image of a girl on right side of the image. I need to create a new folder named C which contain 100 images in each image have picture of boy and girl on the left and right side respectively. Is there any way to perform such operation on matlab. Please help me to resolve this Background does not a matter

Answers (1)

if your images are called picA1,picA2,...picAn in folder A, and picB1,... in folder B
for k=1:100
im1=imread(['folderA/' sprintf('picA%d.jpg',k)]);
im2=imread(['folderB/' sprintf('picB%d.jpg',k)]);
im=[im1 im2];
imwrite(im,['folderC/' sprintf('picC%d.jpg',k)])
end

1 Comment

If they're not all the same size, you can use imresize() to force them to have the same number of rows.

Sign in to comment.

Categories

Find more on Convert Image Type in Help Center and File Exchange

Asked:

on 28 Feb 2013

Community Treasure Hunt

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

Start Hunting!