필터 지우기
필터 지우기

why cant i run this simple function?

조회 수: 1 (최근 30일)
Alprcnkt
Alprcnkt 2016년 4월 16일
댓글: Ced 2016년 4월 17일
hello people, i have to create a simple function but it doesnt work
function [blackLevel, asShotNeutral] = evc_read_file_info(filename)
img = imfinfo(filename); %reads infos in the filename
blackLevel =img.BlackLevel; % gives back BlackLevel from the file
asShotNeutral = img.AsShotNeutral; %gives back AsShotNeutral from the file
end
function [result] = evc_transform_colors(input, blackLevel)
maxSampleValue = img.MaxSampleValue; % gives maxSampleValue from the file which is up
result = (double(input)-blackLevel)/ (maxSampleValue - blackLevel); %makes 'input' double , moves and scales the contrast in intervall [0,1] instead of [BlackLevel,65535]
end
can anyone tell me whats wrong with it? what am i doing wrong???
  댓글 수: 6
Alprcnkt
Alprcnkt 2016년 4월 17일
guys i m really out of everything pls help me the whole is in the first message already but why cant i call and use this?
function [result, asShotNeutral, fnc_read_file_info,fnc_tranform_colors] = evc_black_level(input, filename) %main Function
fnc_read_file_info = @(filename) evc_read_file_info (filename);
fnc_tranform_colors = @(input, blackLevel) evc_transform_colors(input, blackLevel);
[blackLevel, asShotNeutral] = evc_read_file_info(filename);
result = evc_transform_colors(input, blackLevel);
end
function [blackLevel, asShotNeutral] = evc_read_file_info(filename)
info = imfinfo(filename); % gives error (not enough input arguments)
blackLevel =info.BlackLevel;
asShotNeutral = info.AsShotNeutral;
end
function [result] = evc_transform_colors(input, blackLevel)
input = 'IMG_5.tiff';
blacklevel = input.BlackLevel;
maxSampleValue = input.MaxSampleValue;
result = (double(input)-blackLevel)/ (maxSampleValue - blackLevel);
end
Ced
Ced 2016년 4월 17일
How are you calling your function?

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

답변 (1개)

Walter Roberson
Walter Roberson 2016년 4월 17일
Either you are not passing a string to evc_read_file_info, or else the string does not refer to an image file. One way it can go wrong is if you pass only the name and extension of a file that is not in the current directory, having forgotten to add the directory information to it.

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

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

제품

Community Treasure Hunt

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

Start Hunting!

Translated by