From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Machine Vision

cancel
Showing results for 
Search instead for 
Did you mean: 

Down sampling required to find barcode

Solved!
Go to solution

In the attached image I have four Code 128 and two Code 39. I have problem detecting them without down sampling the image first. Since I want to grade the bar codes I don't want to down sample since the code quality is reduced then. I noticed this from that sometimes the bar codes are found without down sampling an then the grade is higher for those. Down sampling a factor 2 sometimes work , down sampling a factor 4 always works. I crop the image around the bar code but this doesn't help.

I'm using IMAQ Read Barcode 2, and have tried to change the parameter Min Bar Width with no result.

 

Best regards

Karin Hellqvist
Certified LabVIEW Architect

DVel

 

 

 

0 Kudos
Message 1 of 10
(3,599 Views)

try to do some preprocessing  to reach appropriate image try to use thershoulding  to separate  bar from back ground  

0 Kudos
Message 2 of 10
(3,552 Views)

Thanks, Hatef for you answer. I have tired thresholding the image but that doesn't help. Also it I do that I will lost the information needed for the grading of the barcode I want to perform.

 

The issue is somehow related to the number of pixels between bars and across each bar.

0 Kudos
Message 3 of 10
(3,540 Views)

Can you make it a two step process?  Reduce the image size and locate the barcode, then scale the found ROI to grade the original barcode?

 

If it won't read the original barcode when it is trimmed, there must be something wrong in the search parameters.  I don't know the parameters well enough to help with that, though.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 4 of 10
(3,536 Views)

if thresholding  could not  separate your barcode well so barcode algorithm will not work well elso because it work on threshold base method
so I thing you have to change your lighting system or use some preprocessing algorithm 

0 Kudos
Message 5 of 10
(3,530 Views)

Bruce, I don't relly understand how you mean by two step process. I do reduce the image size by croping the image around the barcode. Which way do you mean resize the image? adn what do you mean by scale?

 

Yes, I think also there's something wrong with the search parameters but I can't find what. If it's at all possible to do with this image resolution.

 

Hatef, there is no problem separating the bars in the barcode by thresholding. I attached the image in my first post. The image quality is good enough for the algorithm to find the barcodes. And the algorithm does find the barcodes after downsampling the image. 

 

0 Kudos
Message 6 of 10
(3,507 Views)

so if I could understand well this time 
your problem is down sampling of image that some time cause to lost bar code? if it is your problem it could relate  to method of down sampling that need to calculate average of neighborhood pixel around each pixel  for down sample pixel in new image   these neighborhood if consist black and  white part will be attach bar together and destroy the bars space and stick them together 

0 Kudos
Message 7 of 10
(3,505 Views)

I meant downsampling to locate the barcode, then using that information to locate and analyze it in the original image.

 

Bruce

Bruce Ammons
Ammons Engineering
0 Kudos
Message 8 of 10
(3,504 Views)

Hatef, no that's not my problem. If i don't downsample it doesn't work. If i downsample it works.

 

Bruce, I tried similar to what you're saying. I know all the time where my barcodes are, and crop around them to reduce the image size. Unfortunately this doesn't help.

0 Kudos
Message 9 of 10
(3,488 Views)
Solution
Accepted by topic author Karin_Hellqvist

I got some help from NI Support who help me find the setting Minimum Edge Strength which I needed to lower to 20. This is due to my blurry image quality.

 

I think I maybe need to change my lightning to use from above instead of from below to get this improved. I know if I would like to grade according to the standards the lightning should be from above. Also my camera has manual focus and aperture, which makes it a bit hard to get better image quality.

0 Kudos
Message 10 of 10
(3,395 Views)