From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
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.

 

-Rahul

Hit KUDOS for Thanks

0 Kudos
Message 11 of 15
(650 Views)

@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:

card-counting_profil.png

 

 

Message 12 of 15
(638 Views)

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
(632 Views)

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.

 

-Rahul

Hit KUDOS for Thanks

0 Kudos
Message 14 of 15
(583 Views)

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
(571 Views)