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 Center および File ExchangeConvert Image Type についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by