我在Matlab中成功完成了这项工作:
function[std_dev_roi, rows, cols] = roi_circle(x,y,r,image)
for h = 0:r
delta_y = sqrt((r^2) - (h^2));
delta_y = round(delta_y);
rows(h+1) = h;
cols(h+1) = delta_y;
end
rows = [rows, fliplr(rows), -rows, -fliplr(rows)];
cols = [cols, -fliplr(cols), -cols, fliplr(cols)];
cols = cols + y;
rows = rows + x;
binary_mask = roipoly(image, rows, cols);
std_dev_roi = std(image(binary_mask));
end
但我希望函数在Python中执行此操作,但不知道如何考虑没有roipoly。
任何elp非常感谢