如何在图像中绘制 Hog 特征

How to plot Hog features in the image

我正在尝试从图像中提取某些特定点的特征。我第一次使用 HogFeatureextraction。当我绘制特征和有效点时,我得到的结果不是在某些点上。稍后我将使用这些功能进行训练。例如,我在直线上有点。不应该把我的特征放在我的某些点上就行了。我对它的概念有点困惑。我使用了 [features,validPoints] = extractHOGFeatures(I,points)。 x 和 y 是我在图像中的 10 个位置。在这种情况下,特征提取是如何工作的?

[features,validPoints] = extractHOGFeatures(I,[x,y]); figure; imshow(I); hold on; plot(features, 'ro'); plot(validPoints,'go');

谢谢

function's documentation 解释得很清楚。

validPoints 是 xy 坐标的 nX2 矩阵,因此您应该使用 plot(x,y) 而不是 plot(x) 来绘制它。

features是每个点的HoG特征的矩阵,简单地用plot(features, 'ro')绘制不会产生任何合理的输出。

但是,您可以简单地从 extractHOGFeatures 获取第三个输出 (visualization),然后使用 plot 绘制它:

I = im2double(imread('cameraman.tif'));
% desired points
n = 20;
x = randi(size(I,2), [n 1]);
y = randi(size(I,1), [n 1]);
% extract features + visualization object
[features,validPoints,visualization] = extractHOGFeatures(I,[x,y]);
% show image and features
figure;
imshow(I);
hold on;
plot(visualization,'Color','r');
% plot valid points
plot(validPoints(:,1),validPoints(:,2),'go');