identify valid and invalid image

i execute a code and get two types of output.... one is valid and the other is invalid.... the valid output image has content content in it.... whereas the invalid image is totally black....
based on this information what can i do to display a message that the image is valid or invalid.... some condition check so that i can display the message correctly.... please can someone reply.....

 채택된 답변

Walter Roberson
Walter Roberson 2013년 1월 5일

1 개 추천

if ~any(TheOutputImage(:))
msgdlg('Outside of a dog, a book is man''s best friend. Inside of a dog, it is too dark to read.');
else
......
end

댓글 수: 4

Elysi Cochin
Elysi Cochin 2013년 1월 5일
편집: Elysi Cochin 2013년 1월 5일
sir i got it but if it is invalid image i do not want to display it.... but that is also getting displayed for me when i do like this.... please tell me where i should make the change for not getting the invalid image displayed...
if ~any(YourImage(:))
msgbox('Invalid Image');
else
figure(1),
subplot(10,6,i);
imshow(YourImage);
axis image off
end
The first thing you need to do is stop using "image" as a variable name: doing so makes it difficult to use the function image()
Second, if your code is not giving you the message box, then the output is not "totally black" as you claimed. Find out what
max(YourImage(:))
mean(YourImage(:))
std(YourImage(:))
are for the invalid images.
Elysi Cochin
Elysi Cochin 2013년 1월 5일
편집: Elysi Cochin 2013년 1월 5일
sir i got it... thank u sir... i wrote the display outside the for also... thank u sir...
Walter Roberson
Walter Roberson 2013년 1월 5일
Put a breakpoint in at the "if ~any" and run your code again with something that creates an invalid image. Single-step through the code. I think you will find that the black image is not displayed by this section of code. If you continue single-stepping you will find the place that is displaying it.

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

추가 답변 (0개)

카테고리

도움말 센터File Exchange에서 Images에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by