You can achieve this using the OpenCV library in Python. Here's some sample code to get you started:
main.py842 chars28 lines
This code loads an image, converts it to grayscale, and extracts all white objects using a simple thresholding operation. It then computes the bounding box of each white object and checks if it's bigger than 500x500 pixels. If so, it draws a green rectangle around the object's bounding box. Finally, it displays the result.
Note that the code assumes that white objects are already the brightest and that the image is relatively clean. If this is not the case, you may need to apply some pre-processing operations (such as noise reduction, adaptive thresholding, or morphological operations) to improve the accuracy of the white object extraction.
gistlibby LogSnag