Effacer les filtres
Effacer les filtres

why cant i run this simple function?

1 vue (au cours des 30 derniers jours)
Alprcnkt
Alprcnkt le 16 Avr 2016
Commenté : Ced le 17 Avr 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 commentaires
Alprcnkt
Alprcnkt le 17 Avr 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 le 17 Avr 2016
How are you calling your function?

Connectez-vous pour commenter.

Réponses (1)

Walter Roberson
Walter Roberson le 17 Avr 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.

Catégories

En savoir plus sur Images dans Help Center et File Exchange

Tags

Aucun tag saisi pour le moment.

Produits

Community Treasure Hunt

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

Start Hunting!

Translated by