rounding problem after decimal point in image processing

that is the last portion of my first program-
cD1=idwt2(new,cHH,cVV,cDD,'haar');
cD1(cD1<.0000000001 & cD1>-tol) = 0;
disp('cD1');
disp(cD1);
final1=idwt2(cA,cH,cV,cD1,'haar');
final=cat(3,final1,final2,final3);
imwrite(uint8(final),'Image.png');
here final2 & final3 are same as final1,just for red,green & blue channel respectively. i am displaying the cD which gives a floating point number.
& that is the first portion of my second code-
rgb=imread('Image.png');
red1=rgb(:,:,1);
green1=rgb(:,:,2);
blue=rgb(:,:,3);
[cA,cH,cV,cD]=dwt2(red1,'haar');
cD(cD<.0000000001 & cD>-tol) = 0;
disp('new cD');
disp(cD);
and this time the cD is giving the rounding answer after decimal point as u can seen the provided screen shoot image below
upper portion is given after the first code & lower portion is given by the second code.

답변 (1개)

David Young
David Young 2015년 8월 20일

0 개 추천

If you convert to class uint8 you lose everything after the decimal point. Is that perhaps the problem? If so, don't cast to uint8, and use save and load to store and recover your data instead of imwrite and imread.

댓글 수: 4

its not working. can u please explain it with command or give any other solution?
What is not working? If there is an error message, please show it. If there is some other problem, please explain what fails. It may also be important to explain the purpose of saving your data and reading it back in.
there is no error message, it is losing value. my project is on image watermarking. the first portion code i gave above is for embedding & next one for extraction. i am mainly tring to hide my watermark bit in the hosts floating point. so floating point is very important for that. when i am using the output from first one as the input of extraction it is giving the rounding answer after point & i am losing the value as u can seen in the image provided.
None of the common image file formats support floating point, only integer. If your technique requires hiding in floating point then you are doomed to disappointment. You might be able to produce a floating point TIFF file if you use the TIFF class, but the moment anyone saves the image in any other format the floating point would be converted to integer.

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

질문:

2015년 8월 19일

댓글:

2015년 8월 20일

Community Treasure Hunt

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

Start Hunting!

Translated by