How can we get the index of points that are inside a polygon?

4 次查看(过去 30 天)
I have an image and I rotate it with imtransform function.The Output of this function is an image that has black sections in the four corners of the image. I want to extract frame and descriptor of that except black parts in the corner of the image by vl_dsift.for do this I use the below code:
th = 50;
s = 0.8;
A = imread('cameraman.tif');
[H,W]= size(A);
T = [s*cosd(th), -s*sind(th), 0 ; s*sind(th), s*cosd(th) ,0; 0, 0 ,1];
B =imtransform(A,maketform('projective',T'),'xdata',[-W/2 W/2],'ydata',[-H/2
H/2],'udata',[-W/2 W/2],'vdata',[-H/2 H/2]);
P = [-W/2 ,W/2 W/2 ,-W/2; -H/2 ,-H/2 ,H/2, H/2; 1, 1, 1 ,1];
Pt = T*P;
Pt = Pt./repmat(Pt(3,:),3,1);
Pt = Pt(1:2,:);
opts = {'size', 8, 'step', 5, 'fast'};
[fb, db] = vl_dsift(single(B), opts{:});
in = inpolygon(fb(1,:),fb(2,:),Pt(1,:),Pt(2,:));
can you help me to find frame and descriptor that they are in polygon?

回答(1 个)

KSSV
KSSV 2019-2-19
REad about inpolygon

类别

Help CenterFile Exchange 中查找有关 Elementary Polygons 的更多信息

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by