Why does imshow() function in Matlab return a blank image?

32 ビュー (過去 30 日間)
Akshra
Akshra 2016 年 12 月 8 日
回答済み: Kushagr Gupta 2016 年 12 月 20 日
I am trying to perform the inverse stationary wavelet transform on an image, but I can't view the output of the image using the imshow() or image(), they both return a blank figure. I have also tried imshow(Y,[]) this also returns a blank image.
This is what I am trying to do
[A,H,D,V] = swt2(i,3,'sym4'); %input i is an grayscale/intensity image%
Y = iswt2(A,H,D,V, 'sym4') ;
imshow(Y) % the figure is white/blank %
How can I resolve this issue?
  1 件のコメント
Adam
Adam 2016 年 12 月 8 日
編集済み: Adam 2016 年 12 月 8 日
Have you used the debugger to actually look at Y and see if there is anything in it? The most obvious reason why imshow and image return a blank image is because you are giving them blank data to plot.
Also double-check data types.

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

回答 (1 件)

Kushagr Gupta
Kushagr Gupta 2016 年 12 月 20 日
Another common mistake that can yield to white or black images is a mismatch in datatypes while casting from one to another.
For example:
>> I1 = im2double(imread('coins.png')); % reads an image and converts to double in range 0-1
>> imshow(uint8(I1)) % yields a black image
This happened as the image within range [0 1] was cast into uint8 whose range is [0 255]
A better way to cast, if it is required at all would be:
>> imshow(uint8(I1*255));
But in general it is a good practice to deal with images converted to double datatype using ' im2double ' and doing further processing on these matrices.

カテゴリ

Help Center および File ExchangeImage Segmentation and Analysis についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by