我尝试使用Scilab中的plot3d
绘制灰色图像,这是我的代码:
clear;
clc;
direc='C:\Users\engine\Documents\EYE';
cd(direc)
stacksize('max');
fileName = '50.jpg';
rgb= ReadImage(fileName);
img = RGB2Gray(rgb);
Histogram = CreateHistogram(img);
figure(1); plot( 0:255,Histogram);
plot3d(1:length(img(:,1)),1:length(img(1,:)),img(:,:));
imshow(img);
当我运行此代码时,收到此错误消息:
!--error 246
Function not defined for given argument type(s),
check arguments or define function %i_plot3d for overloading.
我知道如何解决这个问题?
答案 0 :(得分:0)
我发现了错误。我应该将灰度图像转换为double值,然后情节可以正常工作:
clear;
clc;
direc='C:\Users\engine\Documents\EYE';
cd(direc)
stacksize('max');
fileName = '50.jpg';
rgb= ReadImage(fileName);
img = RGB2Gray(rgb);
img2 = im2double(img);
img2 =img2*250;
plot3d(1:1024,1:1280,img2(:,:));