Azzera filtri
Azzera filtri

why cant i run this simple function?

1 visualizzazione (ultimi 30 giorni)
Alprcnkt
Alprcnkt il 16 Apr 2016
Commentato: Ced il 17 Apr 2016
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 Commenti
Alprcnkt
Alprcnkt il 17 Apr 2016
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 il 17 Apr 2016
How are you calling your function?

Accedi per commentare.

Risposte (1)

Walter Roberson
Walter Roberson il 17 Apr 2016
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.

Categorie

Scopri di più su Images in Help Center e File Exchange

Tag

Non è stata ancora inserito alcun tag.

Prodotti

Community Treasure Hunt

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

Start Hunting!

Translated by