【发布时间】:2018-09-23 11:23:40
【问题描述】:
基于这个想法(图) 我试图将所有这三个输出(边缘)绘制在一个图像中,用不同的颜色来表示每个输出(而不是像 subplot 或 imshowpair 之类的东西)。现在我的输出只是三个不同的图像。
clear all
close all
clc
%% ground truth
img = imread('22o.jpg');
img_gray = rgb2gray(img);
img_ground_truth = imread('22g.jpg');
img_ground_truth = im2bw(img_ground_truth);
cc = img_ground_truth;
%cc = img_ground_truth(11:54, 112:171);
%% Detected part
img_edge = edge(img_gray, 'canny');
dd = img_edge;
%dd = img_edge(11:54, 112:171);
%% True pixel, false pixel, true negative
[m n] = size(cc);
true_pixel = zeros(m,n);
false_pixel = zeros(m,n);
false_negative = zeros(m,n);
for i = 1:m
for j = 1:n
if (dd(i,j) == cc(i,j))
true_pixel(i,j) = dd(i,j);
elseif (dd(i,j)~= cc(i,j))
false_pixel(i,j) = dd(i,j);
end
end
end
for i = 1:m
for j = 1:n
if (cc(i,j)==1 && dd(i,j)==0)
false_negative(i,j) = cc(i,j);
end
end
end
% subplot(2,3,1); imshow(cc); title('Gt');
% subplot(2,3,2); imshow(dd); title('Dc');
figure(1),imshow(true_pixel, 'ColorMap',[1 1 1;0 1 0]);
title('True Pixel (TP)');
hold on
figure(2),imshow(false_pixel, 'ColorMap',[1 1 1;1 0 0]);
title('False Pixel (FP)');
hold on
figure(3),imshow(false_negative, 'ColorMap',[1 1 1;0 0 1]);
title('False Negative (FN)');
hold off
【问题讨论】:
-
“不像 subplot”——但
subplot正是你想在这里使用的。你试过吗? -
不,我希望将这三个边缘都加到一张图像上,这样我们就可以在一张图像中看到所有这三个彩色边缘。虽然会有一些重叠,但没关系。
-
在图中显示了 3 个子图。如果你想重新创建它,你需要
subplot。 -
如果你有“假阴性”,那么其他标签很有可能是“真阳性”和“假阳性”,而不是“真像素”
-
你是问如何将3张图片合并为一张,比如
merged_image = cat(3, false_pixel, true_pixel, false_negative)?
标签: matlab edge-detection imshow