필터 지우기
필터 지우기

Image processing problem

조회 수: 1 (최근 30일)
hanpuss
hanpuss 2012년 3월 1일
I am trying to decompose an image with wavedec2 and reconstruct it with waverec2 using the below simple codes.
The problem is that the resulting image imshow(y) is totally white, while imshow(x) shows a normal photo. Any help is much appreciated!
x = imread('flower.jpg');
x = rgb2gray(x);
[c,s] = wavedec2(x,2,'haar');
y = waverec2(c,s,'haar');
imshow(y);

답변 (2개)

UJJWAL
UJJWAL 2012년 3월 1일
Before imshow(y); enter this statement
y = uint8(y);
Now you will get the correct result.
This is because x is of type uint8 while y is double. So you will not see them in the same way unless you change from double to uint8 which is accomplished by the above command
  댓글 수: 1
hanpuss
hanpuss 2012년 3월 1일
Thank you so much UJJWAL, it really helps!
I have also realized that x = im2double(x); would also solve the problem, probably by the same reason that you explained.

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


Image Analyst
Image Analyst 2012년 3월 2일
If your numbers don't cover the range 0-255 fairly well, your image may not look good if you cast it to uint8. I suggest just using [] for display:
imshow(y, []);
  댓글 수: 1
hanpuss
hanpuss 2012년 3월 4일
Thank you, Image Analyst!!

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

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by