1 | initial version |
If the transistors are all the same shape (all with the legs
in the bottom part of the image/detection), you can binarize the image (with Otsu threshold) and count the number of passing from 0 to 1 (or 255) in the row 2*img.rows/3
(or something like this) and divide it by 2 for getting the number of legs
.
If the background is not always white, then you shall try to find some improvements...