manoj-bhaskaran / My-Scripts

0 stars 0 forks source link

Implement vectorized processing using NumPy or OpenCV #54

Closed manoj-bhaskaran closed 1 day ago

manoj-bhaskaran commented 1 day ago

Child of Issue #32

Issue: The script iterates through each pixel in the image to determine cropping boundaries, which is computationally expensive.

Solution:

Use NumPy arrays to represent image data. Convert the image to a NumPy array and use vectorized operations to check for black and white pixels across columns. Alternatively, use OpenCV, which offers faster image processing capabilities due to its C++ backend. Implementation Suggestion:

Convert image to a grayscale NumPy array. Identify columns with black or white pixels using logical operations across entire columns instead of row-by-row checks.