简体   繁体   English

如何在图像中绘制猪的特征

[英]How to plot Hog features in the image

I am trying to feature extraction from an image for some certain points. 我正在尝试从某些特征中提取图像。 First time I am using HogFeatureextraction. 第一次使用HogFeatureextraction。 When I plot the features and valid points, I am getting result not on the certain points. 当我绘制特征和有效点时,我得到的结果不在某些点上。 I will use these features for training later on. 稍后,我将使用这些功能进行培训。 For example, I have points on the straight line. 例如,我在直线上有点。 Should not my features on where my certain points on the line. 我的功能不应该放在我的某些点上。 I am a little bit confused about concept of it. 我对它的概念有些困惑。 I used [features,validPoints] = extractHOGFeatures(I,points). 我用了[features,validPoints] = extractHOGFeatures(I,points)。 x and y are my 10 positions in the image. x和y是我在图片中的10个位置。 In this case how is feature extraction working? 在这种情况下,特征提取如何工作?

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

Thank you 谢谢

The function's documentation explains it all clearly. 函数的文档清楚地解释了所有这些。

validPoints is a nX2 matrix of xy coordinates so you should use plot(x,y) instead of plot(x) to plot it. validPoints是xy坐标的nX2矩阵,因此您应该使用plot(x,y)而不是plot(x)进行绘制。

features is a matrix of the HoG features of each point, and simply plot it using plot(features, 'ro') will not produce any reasonable output. features是每个点的HoG特征的矩阵,仅使用plot(features, 'ro')对其进行plot(features, 'ro')就不会产生任何合理的输出。

However, you can simply obtain the third output ( visualization ) from extractHOGFeatures and then use plot to plot it: 但是,您可以简单地从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');

在此处输入图片说明

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM