I’m writing a program that will scan an image file for dark spots. It needs to gather some information about the size and amount of the spots. The images are always black and white and of a piece of metal. Does anyone recommend an api or existing tool for something like this? I’d prefer java or .net but feel free to suggest anything.
Share
If the black spots are all having the same RGB value for black, this will only require opening the image and counting the black pixels and dividing by the total number of pixels in the image. for reading an image and detecting black pixels, you can find info here:
java-buffered-image-detecting-black-pixels
please note that another way to open the image (in the previous link) would be:
If your spots are composed of different RGB that look black/dark , then you might find an answer in the following post: (it deals with green spots but you can easily use the methods mentioned and look for black spots)
how-to-calculate-the-amount-of-green-spots-in-an-image