Image Processing on Matlab

1 次查看(过去 30 天)
Charlie
Charlie 2011-7-14
Hi, I'm working in an engineering lab right now and I've been given a relatively simple task which I just can't get to work. My lab uses imageJ to browse through their recorded video frame by frame for some measurements. However, they've recently been running into problems where imageJ can only handle a certain number of frames and the lab's video goes well over the limit often. So my task is somehow use matlab and be able to display the data(which is in TIFF format) in real time. I saw the image sequencing manual on matlab, where the code went
%load filename
%implay(filename)
well first of all, that load command doesn't work for me for some reason. I set the directory to the folder that contains the TIFF image.
%load filename
tells me that Matlab is unable to read the file and if I try
%load 'filename.tif'
Matlab throws me this error
??? Error using ==> load Number of columns on line 1 of ASCII file C:\Documents and Settings\Administrator\Desktop\lab-track\test.tif must be the same as previous lines.
If anyone can straighten this out, I'd greatly appreciate it. Thank You
[Edit Moving comment to Question - AU]
well i tried the following code:
%fname = 'my_file_with_lots_of_images.tif';
%info = imfinfo(fname);
%num_images = numel(info);
%for k = 1:num_images
%A = imread(fname, k, 'Info', info);
%implay(A)
%end
but this only displayed the first frame on the movie player. Gahh this is so frustrating.....

回答(2 个)

Sean de Wolski
Sean de Wolski 2011-7-14
Perhaps try: imread()
doc imread
and maybe
doc tiff

Ashish Uthama
Ashish Uthama 2011-7-14
Do you just want to display the frames in sequence or is there any other reason you want to use implay?
If its just displaying, look at replacing implay with image in your code.
If you need to use implay, look at the implay(I) syntax.
[Edit: Add example - AU]
If your frames are grayscale, and each frame has the same dimensions (x by Y), then use this to create the I variable:
I=[];
for k = 1:num_images
I(:,:,k) = imread(fname, k, 'Info', info);
end
implay(I);
Depending on the number of frames (num_image). The variable I could end up being large, making the code slow. If you just wanted to perform computations, it might be faster to read in and process one/two frames at a time to keep the memory utilization low.
  8 个评论
Charlie
Charlie 2011-7-18
fname = 'charlietest.tif';
info = imfinfo(fname);
I=[];
for k = 1:25
I(:,:,k) = imread(fname, k, 'Info', info);
end
implay(I)
Sean de Wolski
Sean de Wolski 2011-7-18
what does
class(I)
return?
implay() prefers its data to be binary (class logical) or uint8.

请先登录,再进行评论。

类别

Help CenterFile Exchange 中查找有关 Convert Image Type 的更多信息

产品

Community Treasure Hunt

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

Start Hunting!

Translated by