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
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
anika hossain
2015년 8월 20일
David Young
2015년 8월 20일
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.
anika hossain
2015년 8월 20일
Walter Roberson
2015년 8월 20일
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.
카테고리
도움말 센터 및 File Exchange에서 Watermarking에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!