Why my input image is displayed as blank image by using the following code?

조회 수: 1 (최근 30일)
sam  CP
sam CP 2017년 4월 4일
편집: sam CP 2017년 4월 4일
I got a blank image as both input and output images when i process the matlab codes in the attached file. And there is no error shown in the command window. What is the reason for this and How can i solve this?

답변 (1개)

Spencer Chen
Spencer Chen 2017년 4월 4일
The problem is that your converted your image to a double then applied rgb2gray. When the input is double, rgb2gray is expecting image values between 0 and 1, but your original image has values between 0 to 255 (uint8).
This conversion (to double) step is not necessary to execute rgb2gray.
  댓글 수: 1
sam  CP
sam CP 2017년 4월 4일
When i remove the convert to double(IM=double(IM);) . I got following error
Error using .*
Integers can only be combined with integers of the same class, or scalar doubles.
Error in Untitled2 (line 44)
ccc1=sum(sum(u1.*u1.*IM))/sum(sum(u1.*u1));

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

Community Treasure Hunt

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

Start Hunting!

Translated by