フィルターのクリア

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 Center および File ExchangeImages についてさらに検索

タグ

タグが未入力です。

製品

Community Treasure Hunt

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

Start Hunting!

Translated by