我有一张图像,我想围绕一个点裁剪感兴趣的圆形区域。我在 MATLAB 中做了以下操作:
vessel=imread('vessel.jpg');
imshow( vessel)
t = 0:pi/20:2*pi;
xc=230; % point around which I want to extract/crop image
yc=79;
r=20; %Radium of circular region of interest
xcc = r*cos(t)+xc;
ycc = r*sin(t)+yc;
roimaskcc = poly2mask(double(xcc),double(ycc), size(vessel,1),size(vessel,2));
pr_gccc = find(roimaskcc);
roimean_cc= mean(vessel(pr_gccc));
figure, imshow(roimaskcc)
roimaskcc 是正确的,但是当我执行以下操作时,它会给出 nX1 矩阵,而不是掩码下的感兴趣区域:
vessel_undermask=vessel(roimaskcc==1);
任何人都可以请。帮助提取兴趣点(xc,yc)周围的圆形兴趣区域。谢谢