Skip to content

Using Kadane's Algorithm to find the brightest area in Astronomical images. Using concept of maximum contiguous subarray to find the area with highest sum and thus using opencv and finding the brightest area, applying on image and video.

License

Siddharth1698/Image-Processing-to-find-the-brightest-area-in-Astronomical-image-and-video-using-Kadane-s-Algorithm

Repository files navigation

Image Processing to find the brightest area in Astronomical image and video using Kadane's Algorithm

Using Kadane's Algorithm to find the brightest area in Astronomical images.

Article: https://siddharth-m98.medium.com/dynamic-programming-with-opencv-implementing-kadanes-algorithm-to-find-brightest-area-on-9fe6e9af38d4

The maximum subarray problem is used to identify the subarray of a two dimensional array, where the sum of elements is maximized. In terms of image processing, the solution has been used to find the brightest region within an image.

We have a basic approch to this problem which is brute force and it takes O(n^2) time to execute. So we move to dynamic programming known as Kadane's Algo which solves this problem in O(n) times. This is for a 1d array.

In image processing we modify Kadanes algo to a 2d array , please refer here: https://www.geeksforgeeks.org/maximum-sum-rectangle-in-a-2d-matrix-dp-27/

We then use openCV to read image and do some preprocessing and pass it to Kadanes algo to find the region which has highest sum which is our brightest spot. I have also implemented this to work for a Video.

Main Code: Kadanes Algorithm for Bright Light spotting with Video.ipynb

Basic Image:

Basic Image

After Kadane's Algorithm:

Kadane Image

About

Using Kadane's Algorithm to find the brightest area in Astronomical images. Using concept of maximum contiguous subarray to find the area with highest sum and thus using opencv and finding the brightest area, applying on image and video.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published