在MATLAB中围绕一个点裁剪感兴趣的圆形区域 [英] Cropping Circular region of interest around a point in MATLAB
本文介绍了在MATLAB中围绕一个点裁剪感兴趣的圆形区域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一张图片,我想在一个点周围裁剪感兴趣的圆形区域.我在MATLAB中做了以下操作:
I have an image and I want to crop the circular region of interest around a point. I did following in 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矩阵,而不是蒙版下的感兴趣区域:
roimaskcc is correct but when I do the following it gives in nX1 matrix but not the region of interest under mask:
vessel_undermask=vessel(roimaskcc==1);
任何人都可以.帮助提取感兴趣点(xc,yc)周围的圆形感兴趣区域. 谢谢
Can anybody pls. help to extract the circular region of interest around point of interest (xc, yc). Thanks
推荐答案
是的.我做了这样的事情:
Yes I got it. I did something like that:
vesseltry=vessel;
vesseltry(~roimaskcc)=0;
现在,vesseltry是我的新图像,具有感兴趣的圆形区域...
vesseltry is now my new image with circular region of interest...
这篇关于在MATLAB中围绕一个点裁剪感兴趣的圆形区域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文