Image acquisition in matlab

can we feed a hundred images sequentially at once in matlab with a single instruction?

답변 (5개)

Image Analyst
Image Analyst 2012년 3월 27일

0 개 추천

What do you mean by "sequentially" when you have a single instruction? I would think that a "single instruction" would mean that you process all the images "at one time" rather than "sequentially." For example
output = myFunction(image1, image2, image3, ........image100);
You're passing all 100 images to myFunction "at the same time" even though internally myFunction may be processing them sequentially.

댓글 수: 7

NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 27일
By sequentially,I meant that I wanted to add the image frames in order of those file names. My idea is to combine a 100 images to form one single image(using an operator such as "imlincomb" or "imadd"). How do I acquire all those images at once( i.e I cannot use "imread" a hundred times)?
Image Analyst
Image Analyst 2012년 3월 27일
Unless you mean montage(), you can add them up, but be sure to cast as single before you do that otherwise they'll clip at 255 if they're uint8. Of course summing in a loop and then dividing to get the mean is at least 5 lines, not a single line, unless you string all lines of code together onto a single line.
Or you might be able to change the exposure time of your camera so that it just integrates the light for longer, like a hundred times longer than your old exposure time. For example instead of 1/30 of a second, use 100/30 = 3.3 seconds.
Walter Roberson
Walter Roberson 2012년 3월 27일
Why can you not use imread() 100 times?
NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 29일
Just not the process tougher.
Image Analyst
Image Analyst 2012년 3월 29일
I don't understand what that means. Do you want to elaborate?
NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 4월 22일
I have about a hundred images that I would like to combine to form a single image. How do I write these images into Matlab all at once?
Image Analyst
Image Analyst 2012년 4월 22일
Try the montage() function or sum them and divide by 100. But I already said this above, and so did you, so we're going in circles here. You told Walter that it was too tough to do this
for k = 1:100
filename = % whatever it is.
thisImage = imread(filename);
if k == 1
sumImage = double(thisImage);
else
sumImage = sumImage+double(thisImage);
end
end
meanImage = uint8(sumImage/100);
How can we help you?

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

Geoff
Geoff 2012년 3월 27일

0 개 추천

If you're trying to emulate camera image acquisition using stored images, you could set up a timer to deliver a set of images at a set frame rate:
doc timer

댓글 수: 4

NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 27일
Hey,I wanted to combine about a 100 frames to form a single image. How can I write them into Matlab all at once?
Geoff
Geoff 2012년 3월 27일
What, do you mean stack them? So if your frames are 640x480, you'll create one image that is 640x48000?
NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 3월 29일
No, If I have part of a character in each of those images and i would like to have a final image with the final character on the image how do I do it?
Image Analyst
Image Analyst 2012년 3월 29일
Huh??? Well, just throw away all images except for the final image. Or was something not explained properly?

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

Jakob Sørensen
Jakob Sørensen 2012년 3월 27일

0 개 추천

Depends on how you want to combine them. If the file names are somewhat reasonable (i.e. identical like file001.jpg, file002.jpg, ...), it's rather easy to make. Then you just load one at a time into a new variable and then combine them in the end. Or you could load one, plot it, and clear the memory. Whatever suits you best. The code for loading them one at a time would be something like this:
addpath('pathname')
imageStruct = struct;
for c = 1:100
filename = sprintf('file%3.3d.jpg',c);
imageStruct.c = imread(filename);
end

댓글 수: 1

Walter Roberson
Walter Roberson 2012년 3월 27일
http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

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

NITHIN BHARADWAJ
NITHIN BHARADWAJ 2012년 4월 26일

0 개 추천

I need a simplified method for the following procedure:
a=imread('frame-1.tif')
b=imread('frame-2.tif')
c=imread('frame-3.tif')
d=imread('frame-4.tif')
e=imread('frame-5.tif')
f=imread('frame-6.tif')
g=imread('frame-7.tif')
h=imread('frame-8.tif')
i=imread('frame-9.tif')
j=imread('frame-10.tif')
k=imread('frame-11.tif')
l=imread('frame-12.tif')
m=imread('frame-13.tif')
n=imread('frame-14.tif')
o=imread('frame-15.tif')
p=imread('frame-16.tif')
q=imread('frame-17.tif')
r=imread('frame-18.tif')
s=imread('frame-19.tif')
t=imread('frame-20.tif')
u=imread('frame-21.tif')
v=imread('frame-22.tif')
w=imread('frame-23.tif')
x=imread('frame-24.tif')
y=imread('frame-25.tif')
z=imread('frame-26.tif')
z1=imread('frame-27.tif')
z2=imread('frame-28.tif')
z3=imread('frame-29.tif')
z4=imread('frame-30.tif')
z5=imread('frame-31.tif')
z6=imread('frame-32.tif')
z7=imread('frame-33.tif')
z8=imread('frame-34.tif')
z9=imread('frame-35.tif')
z10=imread('frame-36.tif')
z11=imread('frame-37.tif')
z12=imread('frame-38.tif')
z13=imread('frame-39.tif')
z14=imread('frame-40.tif')
z15=imread('frame-41.tif')
z16=imread('frame-42.tif')
z17=imread('frame-43.tif')
z18=imread('frame-44.tif')
z19=imread('frame-45.tif')
z20=imread('frame-46.tif')
z21=imread('frame-47.tif')
z22=imread('frame-48.tif')
z23=imread('frame-49.tif')
z24=imread('frame-50.tif')
z100=imlincomb(1,a,1,b,1,c,1,d,1,e,1,f,1,g,1,h,1,i,1,j,1,k,1,l,1,m,1,n,1,o,1,p,1,q,1,r,1,s,1,t,1,u,1,v,1,w,1,x,1,y,1,z,1,z1,1,z2,1,z3,1,z4,1,z5,1,z6,1,z7,1,z8,1,z9,1,z10,1,z11,1,z12,1,z13,1,z14,1,z15,1,z16,1,z17,1,z18,1,z19,1,z20,1,z21,1,z22,1,z23,1,z24,'uint8')
imshow(z100)
Image Analyst
Image Analyst 2012년 4월 26일

0 개 추천

For your Answer to your own question,.... see the FAQ for a variety of ways to process a sequence of files. http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F

댓글 수: 1

Walter Roberson
Walter Roberson 2012년 4월 26일
Yup. Toss them all into a cell array "z", then
t1 = num2mat(ones(numel(z),1));
t2 = [t1, z(:)];
z100 = imlincomb( t2{:}, 'uint8');

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

질문:

2012년 3월 27일

Community Treasure Hunt

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

Start Hunting!

Translated by