Image Processing on Matlab
2 views (last 30 days)
Show older comments
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.....
0 Comments
Answers (2)
Ashish Uthama
on 14 Jul 2011
Do you just want to display the frames in sequence or is there any other reason you want to use implay?
[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 Comments
Sean de Wolski
on 18 Jul 2011
what does
class(I)
return?
implay() prefers its data to be binary (class logical) or uint8.
See Also
Categories
Find more on Convert Image Type in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!