python - OpenCV / Image Processing techniques to find the centers of bright spots in an image -
i'm doing project based on methodology described in paper: camera calibration single night sky image
as beginner in computer vision, not quite understand how can implement method used in paper find centre of bright spots (luminaries) within image, particular on paragraph in section 4.1:
the surrounding patch of size 15 × 15 pixels (figure 1(a)), upsampled given factor (figure 1(c)) , corresponding gradient map calculated (figure 1(d)). starting brightest region, gray value threshold decreased, until energy function maximized. energy function defined sum of border gradients , normalized border length (figure 1(e)). leads segmented star image shown in figure 1(f). segmentation ensures weighted centre of gravity algorithm [11] gives robust estimation.
from understanding, think can laplacian / sobel gradient function on upsampled image, after i'm not sure how can perform energy function part , produce segmented image. also want understand how implement weighted centre of gravity algorithm find centre of bright spot using opencv or other python library.
much appreciated if of can provide lights on this.
thanks , regards.
the main thing take away energy function
used in context any function used maximization problem. here, energy function sum of gradients/derivatives/differences (i.e. "detected borders likelihood" in case).
since seem have non-algorithmic background, suggest read on breadth-first search (remember image specific type of graph, every edge pixel, connected adjacent ones), recursion, , floodfill.
- up/downscale image
- run horizontal , vertical sobel filters. combine resultant images
grad_img
= max_per_pixel(sobel_horiz,sobel_vert). - for each 15x15 pixel patch, find brightest spot.
seed
of star. - start 1x1
region
consists ofseed
. keep adding adjacent pixelsregion
(recommend breadth-first traversal). calculate energy sum of pixel values ingrad_img
pixel coordinates borders ofregion
. if energy higher energy of previous iteration, new pixel addedregion
. if not, pixel rejected. - finding center of gravity of closed contour or collection of pixels not hard task. either math definition (the sum of x , y coordinates of in-region pixels, divided area), or using image moments (cv::moments example).
my solution bit different solution. run floodfill algorithm fills pixels of brightness [threshold;255], calculating energy func, decreasing threshold, rinse , repeat, stopping when maximize energy function. note algorithm inefficient making 255 floodfills every pre-detected star compared 1 floodfill in proposal, , performance issue in practice.
Comments
Post a Comment