フィルターのクリア

how to save a double m*n*3 matrix as one of image formats with no losing informataion?

2 ビュー (過去 30 日間)
Jack Moriss
Jack Moriss 2016 年 9 月 10 日
コメント済み: Jack Moriss 2016 年 9 月 10 日
Hi. I have a double m*n*3 matrix and I want to save it as one of the standard image formats. I converted it to uint16, and saved it as png:
imwrite(im2uint16(im)),'rgb.png','BitDepth',16,'map','RGB','Mode','lossless');
but when I read it again
i =imread('rgb.png');
% convert it to double again
i=im2double(i)*255;
some pixels had changed one number bigger or smaller. How can I prevent it?

回答 (1 件)

Image Analyst
Image Analyst 2016 年 9 月 10 日
Don't use im2uint16. Just use uint16. Your floating point data had better be integers in the uint16 range though. Otherwise the number will get changes as it's rounded to the nearest integer. If you want to retain the full floating point accuracy, then use save() to save it to a .mat file, instead of using imwrite().
  1 件のコメント
Jack Moriss
Jack Moriss 2016 年 9 月 10 日
but it is a steganography project and i need to save it in image format when i change the pixels and apply idwt on one of image channels it becomes double and after rejoin rgb component the image is in double format i realy dont know what to do for keeping pixels unchanging

サインインしてコメントする。

Community Treasure Hunt

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

Start Hunting!

Translated by