error-output image black in colour

I have a code below for performing CLD ,i have performed till dct coefficient,ids it correct,please guide,in imshow(J),i get only black colour,please help
my image is rgb
I=imread('dock.jpg');
I=rgb2gray(I)
I=imresize(I,[512 512])% I become lena512
fun = @dct2; %dct2 is assigned as function
J = blkproc(I,[64 64],fun); % blkproc function subblocks the image by 8-8 and usign dct2 function
figure
imshow(uint8(J)) % plot the su

回答 (1 件)

Image Analyst
Image Analyst 2012 年 1 月 19 日

0 投票

What is the type of J? Is it floating point, or complex? Try
imshow(J, []);
instead.

13 件のコメント

Pat
Pat 2012 年 1 月 20 日
walter the size is 512x512
the matrix has values
0.0002 0.0000 0.0000 0.0001 0.0001 -0.0000 -0.0000 0.0001
-0.0001 -0.0001 0.0000 0.0000 0.0000 -0.0000 -0.0000 -0.0000
0.0001 -0.0000 0.0001 -0.0000 0.0000 0.0000 0.0000 0.0000
-0.0017 -0.0004 0.0002 0.0004 0.0005 0.0012 0.0003 -0.0001
0.0006 0.0004 0.0001 0.0007 0.0003 -0.0011 -0.0008 -0.0003
-0.0003 -0.0000 0.0002 -0.0006 -0.0010 -0.0006 -0.0002 -0.0007
-0.0002 0.0003 -0.0005 -0.0002 0.0010 0.0004 0.0003 0.0004
Walter Roberson
Walter Roberson 2012 年 1 月 20 日
I'm relatively sure that Image Analyst's legal name is not Walter.
imshow(J, [])
should be able to handle negative and positive values mixed.
Walter Roberson
Walter Roberson 2012 年 1 月 20 日
By the way, if most of the values are near 0, but one of the values is much more (say near 255), then because the entire range of values must be covered, all of the values near 0 could come out black, and the one much larger value would come out white.
Check max(J(:)) and min(J(:))
Pat
Pat 2012 年 1 月 20 日
max(J(:))
1.1508e+004
min(J(:))
-2.8087e+003
Image Analyst
Image Analyst 2012 年 1 月 20 日
That's fine, just know that imshow is linear - it linearly scales your data between 0 and 255 for display. If you have a really skewed distribution or some real outlier values (like salt and pepper noise), you can either reassign them or run your image through imadjust().
Pat
Pat 2012 年 1 月 22 日
Will i get output as per the link below,since an working on CLD
http://en.wikipedia.org/wiki/Color_layout_descriptor
Image Analyst
Image Analyst 2012 年 1 月 22 日
No. imshow() simply displays the image - it's not a whole complicated image processing technique like that.
Pat
Pat 2012 年 1 月 23 日
walter can u tell how to display image as like that
Image Analyst
Image Analyst 2012 年 1 月 23 日
As like *what*??? We told you how to display images.
Walter Roberson
Walter Roberson 2012 年 1 月 23 日
I'm still relatively sure that Image Analyst's legal name is not Walter.
Pat
Pat 2012 年 1 月 23 日
Sorry walter,MR.Image Analyst,as i wikipedia i want those two images ,that i,age divided into 64 blocks,and color representation,if else please can u send the full coding for cld
Image Analyst
Image Analyst 2012 年 1 月 23 日
I've never used CLD so I don't have any code for it, so you're on your own. Walter's right, though it's a very fine and respectable name, my name isn't Walter.
Pat
Pat 2012 年 1 月 24 日
OK Image Analyst

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

質問済み:

Pat
2012 年 1 月 19 日

Community Treasure Hunt

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

Start Hunting!

Translated by