Borrar filtros
Borrar filtros

why cant i run this simple function?

1 visualización (últimos 30 días)
Alprcnkt
Alprcnkt el 16 de Abr. de 2016
Comentada: Ced el 17 de Abr. de 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 comentarios
Alprcnkt
Alprcnkt el 17 de Abr. de 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 el 17 de Abr. de 2016
How are you calling your function?

Iniciar sesión para comentar.

Respuestas (1)

Walter Roberson
Walter Roberson el 17 de Abr. de 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.

Categorías

Más información sobre Images en Help Center y File Exchange.

Etiquetas

Aún no se han introducido etiquetas.

Productos

Community Treasure Hunt

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

Start Hunting!

Translated by