Image acquisition in matlab
古いコメントを表示
can we feed a hundred images sequentially at once in matlab with a single instruction?
回答 (5 件)
Image Analyst
2012 年 3 月 27 日
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
2012 年 3 月 27 日
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
2012 年 3 月 27 日
Why can you not use imread() 100 times?
NITHIN BHARADWAJ
2012 年 3 月 29 日
Image Analyst
2012 年 3 月 29 日
I don't understand what that means. Do you want to elaborate?
NITHIN BHARADWAJ
2012 年 4 月 22 日
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
2012 年 3 月 27 日
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
2012 年 3 月 27 日
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
2012 年 3 月 29 日
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
2012 年 3 月 27 日
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
2012 年 3 月 27 日
http://matlab.wikia.com/wiki/FAQ#How_can_I_process_a_sequence_of_files.3F
NITHIN BHARADWAJ
2012 年 4 月 26 日
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
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');
カテゴリ
ヘルプ センター および File Exchange で Image Arithmetic についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!