Showing results for 
Search instead for 
Did you mean: 

Counting a stack of card.

Hello Suraj


The solution is pretty easy now. Use edge detection(maybe after binary conversion) to detect two lines-(left and right extreme lines). Find the distance between two lines, that is your length in pixels. Then convert the pixels to mm based on the calibration factor. calibration factor is the mm to pixel ratio.



Hit KUDOS for Thanks

0 Kudos
Message 11 of 15

@Rahulbala wrote:


The solution is pretty easy now.

This task may appear to be easy, but could be tricky in detail.

in card2-26.png ... does the 26 tell us that there are 26 cards in this photograph?

The term edge detection may be misleading in this context.

I'd rather say you want to find local extrema in a profil line, somthing like this:




Message 12 of 15

I'd also go straight to a profile line.


That reduces the problem to non-vision. You now have multiple 1D arrays that can be processed. Then process the results of each profile, and you'll even have some sort of quality check. If most profiles give n, you're good. If some give n-4 others n+4, you have a spread and that's not good.


If the cards are always the same thickness, you can of course get the nr of pixels between background-stack-background, and multiply it with a calibrated pixel\width ration... I think just like  Rahulbala proposed.

Message 13 of 15

Taking a line profile may be a solution in most cases. If there is a dirt/black texture in the cards, and the pixel values might drop giving us a different count. If you are sure that there will never be such cases, then you can go with the line profile solution.

Edge detection might be misleading but I meant that you can use  "Find Straight Line Edge" VI.



Hit KUDOS for Thanks

0 Kudos
Message 14 of 15

Of course conditioning the lightning will do wonders.


Note that in the first image, the left and right side of the stack is completely different. That will make the problem a lot harder. A consistent lightning, probably a (or multiple) diffuse or indirect source will work. Note that any AC source will not work, the 50 or 60 Hz current will result in 100 \ 120 Hz lightning, and the 25\30 Hz camera images will not reproduce well.

0 Kudos
Message 15 of 15