필터 지우기
필터 지우기

i make a gui of find max value, mean value and min value but i forgate the load of a image so how to correct this?

조회 수: 2 (최근 30일)
% --- Executes on button press in Mean.
function Mean_Callback(hObject, eventdata, handles)
x=imread('Cameraman.tif');
imshow(x);
a=mean(x);
% --- Executes on button press in Max.
function Max_Callback(hObject, eventdata, handles)
x=imread('Cameraman.tif');
imshow(x);
maxvalue=max(x(:));
% --- Executes on button press in Min.
function Min_Callback(hObject, eventdata, handles)
x=imread('Cameraman.tif');
imshow(x);
minvalue=min(x(:));
  댓글 수: 1
Michael Haderlein
Michael Haderlein 2014년 9월 18일
What do you mean with "i forgate the load of a image"? I guess you mean you forgot to load an image? But you do load the image in all your callbacks. So please specify what is the problem you are facing.

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

답변 (1개)

Image Analyst
Image Analyst 2014년 9월 25일
Your "a" will give a row vector. You should do:
grayImage = imread('Cameraman.tif');
imshow(grayImage , []);
meanGrayLevel = mean(grayImage(:));
Also, you don't do anything with the mean value once you compute it. You simply compute it and then it's lost when the callback function exits because all variables are local in scope unless you do something to make them global or accessible to other functions.
And Michael, I have no idea what your question on loading images is about.
  댓글 수: 3
Michael Haderlein
Michael Haderlein 2014년 9월 26일
Ah, ok. I honestly checked "forgate" in some online dictionary as I was afraid this word does exist and I asked some really stupid question based on my insufficient English skills ;-)

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

태그

아직 태그를 입력하지 않았습니다.

Community Treasure Hunt

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

Start Hunting!

Translated by