为什么我得到这个教程的错误时,适应我的图像?我如何修复这个错误:
3次浏览(过去30天)
显示旧的注释
clc;
清除命令窗口。
清晰;
删除所有变量。
关闭
所有
;
关闭所有图形窗口,imtool创建的图形窗口除外。
关闭所有;关闭imtool创建的所有图形窗口。
工作空间;
确保显示工作区面板。
Lab_fabric = rgb2lab(
“image.tif”
);
A = lab_fabric(:,:,2);
B = lab_fabric(:,:,3);
color_markers =零([nColors, 2]);
为
count = 1:nColors
Color_markers (count,1) = mean2(a(sample_regions(:,:,count)));
Color_markers (count,2) = mean2(b(sample_regions(:,:,count)));
结束
color_labels = 0:nColors-1;
A = double(A);
B = double(B);
距离= 0 ([size(a), nColors]);
为
count = 1:nColors
距离(:,:,数)= ((a - color_markers(计数,1))。^ 2 +
...
(b - color_markers(count,2))。^ 2)。^ 0.5;
结束
[~,label] = min(距离,[],3);
Label = color_labels(Label);
清晰的
距离
;
Rgb_label = repmat(label,[1 1 3]);
segmented_images = 0 ([size(fabric), nColors],
“uint8”
);
为
count = 1:nColors
颜色=面料;
Color (rgb_label ~= color_labels(count)) = 0
Segmented_images (:,:,:,count) = color;
结束
蒙太奇({segmented_images (:,:,: 2), segmented_images (:,:,: 3)
...
segmented_images (::: 4), segmented_images (:,:,: 5)
...
segmented_images (::,:, 6), segmented_images (:,:,: 1)});
标题(
红色,绿色,紫色,品红和黄色物体的蒙太奇,和背景
)
错误:
使用rgb2lab出错
期望输入数字1 RGB是以下类型之一:
单,双,uint8, uint16
rgb2lab错误(第56行)
validateattributes (rgb,…
测试中的错误(第7行)
Lab_fabric = rgb2lab('image.tif');