In the frame difference method,on converting an image to frame,i have got an error in the following statement:
M(i-1)=im2frame(unit8(fg),gray);
fg is gray image.
the error is :
Indexed movie data values must be legal color map indices:
1.0<=value<=length(colormap) for double-precision movie data,and
0<=value<=length(colormap)-1 for unit8 movie data.
plzz tell me how can i fix this error?

 채택된 답변

Walter Roberson
Walter Roberson 2012년 6월 2일

0 개 추천

The default size of the colormap for gray() is smaller than 256 elements. You need to use
M(i-1)=im2frame(uint8(fg),gray(256));

댓글 수: 3

Hari Patel
Hari Patel 2012년 7월 27일
I have an images (492x510) unit16 and I want to convert images into movies frame using im2frame using the following code:
temp1 = imread('image1.tiff'); % unit16
temp2 = double(temp1);
f(1) = im2frame(temp2,gray(4096));
But I got error:
??? Error using ==> im2frame
double-precision indexed CData values must be legal colormap indices: 1.0 <= value <= length(colormap)
Image Analyst
Image Analyst 2012년 7월 28일
Why are you casting it to double? Don't do that. There's probably a zero in there and it says it must have values between 1 and 4096. Why did you want to cast to double anyway, when it was not necessary?
Hari Patel
Hari Patel 2012년 7월 30일
편집: Hari Patel 2012년 7월 30일
I am casting it to DOUBLE because im2frame can only make movie frame from image matrices of type double or unit8 and i checked, its not zero.

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

추가 답변 (0개)

카테고리

도움말 센터 및 File 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