필터 지우기
필터 지우기

Merging multiple jpg files into a single image

조회 수: 15 (최근 30일)
Anson Hancock
Anson Hancock 2015년 2월 8일
댓글: Anson Hancock 2015년 2월 10일
Hi everyone, I have 97 uint8 jpgs (black and white) that I want to merge into a single jpg. However I need the final combined image to only be composed of cells from the series which are white.
I have tried using the imfuse command but it only works for 2 images and just over lays the images which is not what I need to do.
Any help would be greatly appreciated.
  댓글 수: 4
Image Analyst
Image Analyst 2015년 2월 8일
편집: Image Analyst 2015년 2월 9일
Well that's not right - why would you do that? Did you see my answer?
By the way, never use JPEG images when you need to do image analysis. Your pixels won't be just 0 and 255 - there will be in between values with jpg format. Use PNG format instead.
Anson Hancock
Anson Hancock 2015년 2월 10일
Thanks for the answer and the suggestion on output format. We normally don't use a visual format in our workflow but needed to in this particular instance. I will make a note of the .png suggestion for the future.

댓글을 달려면 로그인하십시오.

채택된 답변

Image Analyst
Image Analyst 2015년 2월 8일
Just OR the binary images:
folder = 'c:\myimages'; % Whatever..
for k = 1 : numberOfImages
filename = sprintf('image_%d.png', k); % Whatever.
fullFileName = fullfile(folder, filename);
if exist(fullFileName, 'file')
thisImage = imread(fullFileName);
binaryImage = thisImage > 128; % Or whatever.
if k == 1
output = binaryImage;
else
output = output | binaryImage;
end
end
end
% If you want 0 and 255 instead of 0 and 1, set to 255 the "1" pixels
output(output== 1) = 255;
  댓글 수: 1
Image Analyst
Image Analyst 2015년 2월 8일
To get the sum of pixels in the output, just sum the output (before it gets multiplied by 255) to get the area
pixelSum = sum(output(:));

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

카테고리

Help CenterFile Exchange에서 Image Processing Toolbox에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by