clc; clear all; img_in = imread('ILSVRC2017_test_00000237.jpg'); m = size(img_in,1); n = size(img_in,2); img_lab = rgb2lab(img_in); img_L_mean = mean(mean(img_lab(:,:,1))); img_a_mean = mean(mean(img_lab(:,:,2))); img_b_mean = mean(mean(img_lab(:,:,3))); %高斯滤波 img_R = img_in(:,:,1); img_G = img_in(:,:,2); img_B = img_in(:,:,3); w = fspecial('gaussian',[7 7]); img_R_blur = imfilter(img_R,w); img_G_blur = imfilter(img_G,w); img_B_blur = imfilter(img_B,w); img_blur = cat(3,img_R_blur,img_G_blur,img_B_blur); figure('Name','滤波'); imshow(img_blur); img_lab_blur = rgb2lab(img_blur); %计算显著图 Sd = zeros(m,n); for i = 1:m for j = 1:n Sd(i,j) = sqrt((img_L_mean - img_lab_blur(i,j,1))^2 + (img_a_mean - img_lab_blur(i,j,2))^2 + (img_b_mean - img_lab_blur(i,j,3))^2); end end %归一化 Sd_normalized = figure_normalize(Sd); imwrite(Sd_normalized,'FT_saliency.jpg'); figure; imshow(Sd_normalized); %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% function Out_image = figure_normalize(In_image) o_max_image = max(max(In_image)); o_min_image = min(min(In_image)); Out_image = double(In_image - o_min_image)/double(o_max_image - o_min_image); end运行该代码报错未定义函数或变量 'figure_normalize'。
时间: 2023-06-14 19:04:22 浏览: 94
arima_test.zip_ARIMA代码_arima.test_arima预测_stationary test_平稳性检验
5星 · 资源好评率100%
这个错误是因为你使用了一个名为`figure_normalize`的函数,但是你的代码中并没有定义这个函数。你需要自己编写这个函数并将其添加到代码中。
下面是一个可能的`figure_normalize`函数的示例,你可以将其添加到你的代码中:
```
function Out_image = figure_normalize(In_image)
o_max_image = max(max(In_image));
o_min_image = min(min(In_image));
Out_image = double(In_image - o_min_image)/double(o_max_image - o_min_image);
end
```
注意:如果你使用的是 MATLAB 的版本较新,可能会有现成的函数可以实现这个功能,例如`imadjust`函数。你可以查看 MATLAB 的文档进行了解。
阅读全文