Problems writing a tiff file

When I write an array as tiff, change the values.
if true
% code
end
I=round(rand(10,10,3)*10);
file='c:\temp';
for i=1:3
imwrite(I(:,:,i),'file','WriteMode','append');
end if true
if true
% code
end
thank you very much

댓글 수: 1

Jan
Jan 2013년 3월 7일
Please explain with more details, which values are changed.

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

답변 (2개)

Jan
Jan 2013년 3월 7일
편집: Jan 2013년 3월 7일

1 개 추천

imwrite(I(:,:,i), 'file', 'WriteMode', 'append');
This writes to the file called 'file' in the current directory. I guess you want:
file='c:\temp\Picture.tiff';
imwrite(I(:,:,i), file, 'WriteMode', 'append');
without quotes around the variable file.

댓글 수: 2

My problem is that it does not record the extamente matrix.
I=round(rand(10,10,3)*10);
file='c:\temp\Picture.tiff';
for i=1:3
imwrite(I(:,:,i),file,'WriteMode','append');
end
thanks
Sebastian G
Sebastian G 2013년 3월 7일
My problem is that it does not record the same matrix. Sorry

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

Image Analyst
Image Analyst 2013년 3월 7일

0 개 추천

Try the Tiff class. http://www.mathworks.com/help/matlab/ref/tiffclass.html I believe it has more and better functionality regarding tiff files. I've not used the WriteMode append option in imwrite(). But maybe Tiff is worth a try. I don't know what an "extamente" matrix is, but do you see the file size in bytes increase after each write? If so, that indicates that some data is being appended.

댓글 수: 5

Sebastian G
Sebastian G 2013년 3월 7일
My problem is that it does not record the same matrix.
The matrix have values 10:10:250
Image Analyst
Image Analyst 2013년 3월 7일
Jan has already asked you to provide details. Why are you not letting us help you by providing details? Are you saying that any values in the set 10, 20, 30, ... 240, 250 get changed to 12.3, pi, e, 42, a bazillion, ... cos(-999), a google, rand(1), and 42^(pi*e)?
My problem is that the matrix is not recorded with the numbers generated. as well explained in the question.
I=round(rand(10,10,3)*10);
file='c:\temp\Picture.tiff';
for i=1:3
imwrite(I(:,:,i),file,'WriteMode','append');
end
The save numbers are 80, 120, 160, 255 not the same of matrix.
Image Analyst
Image Analyst 2013년 3월 7일
Can you also show the code you are using to read it back in and verify what was written out?
The problem was not divided by 255
I=round(rand(10,10,1)*10);
file='c:\temp\Picture.tiff';
I2=I./255;
imwrite(I2(:,:),file,'tiff');
I1(:,:)=imread(file,'tiff');
a=isequal(I,I1);
Thanks

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

카테고리

태그

질문:

2013년 3월 7일

Community Treasure Hunt

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

Start Hunting!

Translated by