I need to crop a circle in MATLAB.
I need to perform iris segmentation, and I´ve identified the center point and the radius of the iris, and I need to cut it off from the image.
I have a vector ci that ci(1) is X-coordinate ci(2) is Y-coordinate and ci(3) is the radius of the circle.
我有一个矩阵(图像)和有关圈内有趣部分的信息(给出中心corrdinates和半径).我想为所有圆圈切割矩阵的各个部分,以便为每个圆圈做更多的计算.或者至少我想要一个包含所有圆圈的位掩码.
我使用Octave(但也可以使用MATLAB,但由于许可证的使用会很困难)并且具有以下脚本以及stackoverflow的一些提示.我有20个圆圈的信息,使用Octave在我的Core i5上大约需要0.7秒:
% image
dim_x = 1000;
dim_y = 1000;
A=rand(dim_x,dim_y);
% center positions and ...
c = [222 111; 878 112; 81 718; 89 112; 222 111; 878 112; 81 718; 89 112; 222 111; 878 112; 81 718; 89 112; 222 111; 878 112; 81 718; 89 112; 222 111; 878 112; 81 718; 89 112];
%... radii of the circles
r = [10 33 55 2 22 10 33 55 2 22 10 33 55 2 …Run Code Online (Sandbox Code Playgroud)