Sunday, May 10, 2020

Different Lighting for Lego image

Tried the flash on my camera instead of room lighting.  Here are the results.  Input is a 1200x1200 pixel image.

Input:


Output (centroids marked with white dots):

Here's that big blue rectangle on the right, 'extracted' from the image and put into it's own, along with it's RGB histograms:


As you can see from the histogram, all of the blue values are larger than red and green, and therefore the color is 'blue'.  Also notice that the number of pixels is an indication of size.

So with one histogram, I can know approximate color and size.  How well does this translate to picking a particular object or color is TBD.

... and now I'm finding the 'corners' of each found object.  With this I can compute various parameters like the length of each side, the area, and the orientation / rotation wrt to vertical or horizontal.  Small green dots mark the 'corners' and purple dots are the centroids.

Best yet!  47 total objects.  It got everything but the white pieces.  Pretty decent color averages, too.

and the input again for comparison:

Each object is marked with four small green dots, showing its corners.  47 total objects found, indexed, and stored ready to be used as input to the next stage.  There are actually a total of 48 pieces.  I missed two, but I also have one false positive (near the glary part lower center).  The software found 47 objects, missed two white pieces (49) and fp-ed one to give a count of 48.  Correct!!!

No comments:

Post a Comment