“数据维度必须一致”错误
im = im2double(imread('rice.png'));
[X Y]= meshgrid(1:size(im,1),1:size(im,2));
surf(zeros(size(im)),X,Y,im,'EdgeColor','none');
当我运行这个脚本时,它工作得很好,但是当我尝试将图像更改为 RGB 图像时,它给了我这 2 个错误,
??? Error using ==> surf at 78 Data dimensions must agree.
Error in ==> CoOrdinating at 6 surf(zeros(size(im)),X,Y,im,'EdgeColor','none');
我尝试将图像转换为灰度,但它对我不起作用,并给了我相同的错误
任何帮助?
im = im2double(imread('rice.png'));
[X Y]= meshgrid(1:size(im,1),1:size(im,2));
surf(zeros(size(im)),X,Y,im,'EdgeColor','none');
when i run this script it worked me fine but when i tried to change the image to RGB image it gives me this 2 errors
??? Error using ==> surf at 78 Data dimensions must agree.
Error in ==> CoOrdinating at 6 surf(zeros(size(im)),X,Y,im,'EdgeColor','none');
i tried to convert the image to grayscale but it didn't work with me and gave me the same errors
any help ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我有一种有趣的感觉,你忘记将灰度图像传递给其余的函数,因为我在第一次尝试运行此代码时也这样做了:P
这对我有用(使用 RGB 图像和灰度图像)
I have a funny feeling you forgot to pass the grayscale image to the rest of the functions, because I also did it in my first attempt to run this code :P
This worked for me (with an rgb image and a grayscale image)