[英]Integrating over a circle in a 2D array
I'm trying to integrate over the area of a circular aperture superimposed on an array of pixels (see image below). 我正在尝试对叠加在像素阵列上的圆形孔径区域进行积分(请参见下图)。 However, I need to determine the fraction of flux (area) inside the circular aperture, and leave out anything outside the circular aperture in each square pixel on the boundary of the circle.
但是,我需要确定圆形孔内的通量(面积)的分数,并在圆的边界上的每个正方形像素中的圆形孔外保留任何东西。
How would I go about coding this in numpy/python such that I am getting an accurate measure of the flux inside the circle? 我该如何用numpy / python进行编码,以使我能够准确测量圆内部的通量?
Calculate the proportion of each pixel that is within the circle using calculus. 使用微积分计算圆内每个像素的比例。 (Integrate the equation of your circle between the left-right boundaries of the each.)
(对每个圆弧的左右边界之间的圆方程进行积分。)
scipy.misc.imload
, and divide the pixel values by 255 so you have a mask in 0.0...1.0
scipy.misc.imload
将图像加载到代码中,然后将像素值除以255,以便在0.0...1.0
设置蒙版
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.