В каких случаях «histeq» из MATLAB сообщит о предупреждении «Преобразование входных данных NaN в 0»? - PullRequest
0 голосов
/ 16 марта 2019

Я выполнил 'histeq' над партией изображений и получил ряд повторных предупреждений в виде 'Преобразование входных данных NaN в 0'.Я понятия не имею, как это произошло.Информация MATLAB:

警告: Converting NaN inputs to 0. 
> In imhist (line 76)
  In histeq>computeCumulativeHistogram (line 181)
  In histeq (line 138)

Кто-нибудь знает об этом?Спасибо!

Сгенерированные строки кода MATLAB:

% gray-scaled image
img = fun_image_color(img,'GRAY');

% histogram equalization
img = histeq( img );

, где функция 'fun_image_color' определяется как:

%% image color
% This function converts the input image to a specific color format.
function output = fun_image_color(img,imgColor)
if (nargin~=2), fun_messages('incorrect input parameters','error'); end

% color space
switch (imgColor)
    % gray-scale image -GRAY-
    case 'GRAY'
        % convert RGB image to gray-scale image
        if (size(img,3)==3), img = rgb2gray(img);end
    % RGB image
    case 'RGB'
        % convert gray-scale image to RGB 
        if (size(img,3)==1),
            tmp = cat(3,img,img);
            img = cat(3,tmp,img);
        end
    % HSV image
    case 'HSV'
        % check
        if (size(img,3)==1),fun_messages('the input image is not RGB','error'); end
        % HSV image
        img = rgb2hsv(img);
    otherwise
        fun_messages('incorrect color mode','error');
end

% normalization
img = fun_image_normalize(img);

% output
output = img;
end

где функция 'fun_image_normalize 'определяется как:

%% Image normalization
% This function normalizes the input image between [0,1].
function output = fun_image_normalize(img)
if (nargin~=1), fun_messages('incorrect input parameters','error'); end

% normalize
img = double(img);
img = img - min(img(:));
img = img./max(img(:));

% output
output = img;
end
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...