heng1991 Posted July 16, 2013 Report Share Posted July 16, 2013 Hi, since in the forum we do have the QR code generator. I would like to ask does anyone know how to make a barcode decoder for both code 39 and QR code by using Labview? Decode the code by using the image captured by the webcam. Does anyone know where can I get any .dll library or zxing library that can be use to decode the both type of code? http://www.onbarcode.com/products/net_barcode_reader/barcodes/code39.html This link do provide the .dll library, but only free for 30 days. https://code.google.com/p/zxing/ This link do provide some of the libraries, but I do face some problems when trying to implement it by using LabView. And here are some other references: http://www.idealsoftware.com/opensource/scan-1d-2d-barcodes-webcam-zxing-opencv-visual-c.html http://www.summitsystemsinc.com/programming/qr-code-with-labview/ http://stackoverflow.com/questions/9013703/how-to-find-the-location-of-red-region-in-an-image-using-matlab/9014569#9014569 Yes, LabView do provide the both the 1D and 2D decoder in the Vision Development Module, but that one is a licensed software, that means we need to pay. I hope we can work together to solve for this problem. Quote Link to comment
QueueYueue Posted July 16, 2013 Report Share Posted July 16, 2013 It looks like there is a .NET version of the ZXing. I think that would by my first approach. I would take a look at one of the C# examples and recreate it in labview. 1 Quote Link to comment
Phillip Brooks Posted July 16, 2013 Report Share Posted July 16, 2013 I downloaded the .NET zxing lib and was able to use the 2.0 version to create a VI that reads various bar code image files downloaded frmo a google search with very little effort. 1 Quote Link to comment
QueueYueue Posted July 16, 2013 Report Share Posted July 16, 2013 Nice! I expected it would be something simple like that. Didn't have time to investigate myself. Only thing I'll add is that you need to close your references to all of your .Net objects (i count 3, Barcode reader, bitmap and results) I love when a .NET object does exactly what you need it to. Quote Link to comment
hooovahh Posted July 18, 2013 Report Share Posted July 18, 2013 I think the price of the zxing lib is much better... You wouldn't say that if you worked at Onbarcode.com 1 Quote Link to comment
heng1991 Posted July 19, 2013 Author Report Share Posted July 19, 2013 Phillip, if you don'd mind, can you send me your VI of that one using the zxing library?Do you think that adding the VIs that undergo the binarization and image filter to the image before decoding will be better? Quote Link to comment
Yair Posted July 21, 2013 Report Share Posted July 21, 2013 I think the price of the zxing lib is much better... Yeah, for some reason these guys seem to spamming both LAVA and the NI forums recently with these supposedly authentic and off the street one-time posters who point to different sites which look similar, but all offer barcode utilities for pay. Quote Link to comment
heng1991 Posted July 22, 2013 Author Report Share Posted July 22, 2013 Philip.... I had built in the labview... since my image is already in the bitmap format... so what first come into my mind is that whether i can directly send the .bmp image to decode instead of passing through the bitmap .net constructor (actually i can't find it in my zxing.dll... i am using .net3.5 version...) But it will result in the broken wire.... when i try to connect like this way.... And can i do with this way? As my webcam can capture the image in the .bmp format, so i think if i can connect like this, it may be better.... And i do have another question, does the zxing library provide the barcode detection and localization function? http://s292.photobucket.com/user/heng1991/media/broken-wire.png.html?filters[user]=72164204&filters[recent]=1&sort=1&o=1 (i cant use the image extension... please click in the link below to see the image of the problem... please) And this is one of the example of the barcode that i used to decode... I am looking through a few of the articles regarding how to localize the barcode.... but i still blur with some the concept for it..... http://s292.photobucket.com/user/heng1991/media/Image2013_07_19_091904848.png.html?filters[user]=72164204&filters[recent]=1&sort=1&o=0 Here are some of the articles: http://www.ncbi.nlm.nih.gov/pmc/articles/PMC2898214/ http://www.ski.org/Rehab/Coughlan_lab/BLaDE/BLaDE_TechReport.pdf http://www.ski.org/Rehab/Coughlan_lab/General/Publications/WACV09-barcode.pdf http://www.slideshare.net/VladimirKulyukin/an-eyesfree-visionbased-upc-and-msi-barcode-localization-and-decoding-algorithm-for-mobile-phones Quote Link to comment
Phillip Brooks Posted July 22, 2013 Report Share Posted July 22, 2013 The Bitmap constructor is part of .net, not the zxing lib; look for System.Drawing.Bitmap If your webcam exports an image, you would have to convert that to a bitmap or look through the zxing API for a method that accepts an image. I played around with rotating my 1D barcodes and found that if you cannot draw a horizontal or vertical line that passes through all of the elements of the barcode, you will fail to decode. 2D QR codes worked without a problem. The decode method returns a Result object; use the properties to retrieve the result points and metadata. You might need to iterate over the metadata object to get the key/value pairs. I've attached the VI with the all of the .NET closes as pointed out in the thread. I still work in LV 8.6 and that is limited to .NET 2.0 so that's what I've posted here. Place it in the same folder as the zxing .net 2.0 DLL and it should 'just work'. zxing.net Read Barcode.vi 1 Quote Link to comment
heng1991 Posted July 23, 2013 Author Report Share Posted July 23, 2013 yeah.... thanks a lots, Philip~~ i had tried on the VI by using the webcam to capture the images.... but i found out there's something weird.... There is a barcode that i keep cant decode... even i increased the contrast, increased the sharpness, reduced the saturation of the picture... i still cant decode it.... i have use the other licensed software to decode it too.... but seem like most of them take quite a long time to decode... .and most of times the value that those softwares give to me is the wrong value.... only 1 decoder software done it with less error occur.... the zbar barcode decoder..... the value of the barcode should be 18572E5 (code 39).... Do you know how to solve this problem? Should I add binarization, skeletonization and any others function? I thought by grayscaling the image is enough to decode it.... And here are the pictures that i am taken..... Quote Link to comment
ShaunR Posted July 23, 2013 Report Share Posted July 23, 2013 Flip (mirror) the image. Quote Link to comment
Phillip Brooks Posted July 23, 2013 Report Share Posted July 23, 2013 (edited) There appears to be very little label after the barcode (left side in your image). There are quiet zone specifications for all barcodes; maybe this one does not meet spec. I opened the first image first using MS Office picture manager where I increased the contrast. I then opened it in ms-paint and deleted the dark region at the left (surface label was placed on). This effectively created a larger quiet zone and then zxing decoded the barcode... I didn't have to flip the image once I increased the quiet zone. Edited July 23, 2013 by Phillip Brooks 1 Quote Link to comment
heng1991 Posted July 24, 2013 Author Report Share Posted July 24, 2013 (edited) Phillip~ really thanks again to you~ really is the problem of the quiet region~ Now i am thinking the solution for it.... Can I increase the quiet region by adding white space on both side of the barcode? Since i need to 10 X the dimension of the narrowest element in the bar code~ And i am wondering, what's the main differences between the Zxing and Zbar, since both library can used to decode the barcode? Is it the method use to decode the barcodes is different for both of them? Because I found out that when i am using the barcode reader software (using the Zbar library), it can decode the barcode that i posted... and on the picture there, the Zbar barcode reader do label the starting and the ending position in the barcode... But Zbar barcode reader currently do not provide any library in .net assembly.... Edited July 24, 2013 by heng1991 Quote Link to comment
Phillip Brooks Posted July 24, 2013 Report Share Posted July 24, 2013 It looks like you are learning quickly about barcodes. I'm no expert, just a lot of (bad) experiences with 2D scanners and printers. I downloaded the .NET zxing because I was curious, and happen to like .NET solutions to LV problems. This one worked with very little effort, and I may even look at replacing some of my 2d scanners with webcams on my next test setup. It looks like the zbar lib uses a bunch of other libs to run under Windows, not sure that I would want to have all those dependancies/version problems in the future. As far as the image with insufficient quiet zone, I see that as a failure of the provider of the code to follow standards. If I was "hacking" or needed to compensate for a case that I new I would have to continue supporting (supplier/vendor wouldn't fix the barcode) then I might dig in more and look for parameters for tweaking the quiet area, but I don't need to Quote Link to comment
heng1991 Posted July 26, 2013 Author Report Share Posted July 26, 2013 By the way, Phillip~ do you have any ideas how to convert a RGB 32 bit image to a 8 bit image??? Quote Link to comment
lmontoya Posted January 20, 2014 Report Share Posted January 20, 2014 Hello Phillip. I'm trying to use your code with a Matrix Code. 1.- I'm taking the picture from a USB WEB cam with very good quality, but I'm getting the Image as "Image Data Type", how can I covert that to System.Drawing.Bitmap? 2.- I tried saving the image to a file (jpg or bmp), but still no data out.. http://forums.ni.com/ni/attachments/ni/170/803110/1/2D%20Code.jpg I added a jpg of my picture Thank you guys... Quote Link to comment
hooovahh Posted January 20, 2014 Report Share Posted January 20, 2014 Post some code. I can't be sure the data type you are working with, or what you are trying based on your description but I think I know a way to go from the LabVIEW image data type to a system stream image in .NET. Quote Link to comment
lmontoya Posted January 20, 2014 Report Share Posted January 20, 2014 here you go.. Please rename zxing.txt to zxing.dll you going to need file "AForge.NET Framework-2.2.5.exe" from http://www.aforgenet.com/aforge/framework/ 1.- Change zxing extension to .dll 2.- Install AForge.NET Framework-2.2.5.exe 3.- open ReadSerialAForge-Sample.vi event.vi ReadSerialAForge-Sample.vi zxing.txt zxing.net Read Barcode.vi Quote Link to comment
Benoit Posted June 11, 2016 Report Share Posted June 11, 2016 I know it's quite old, but I'm trying to get image from the web cam from your VI readAForge-sample.vi. When I open it, it's a broken VI. Is it possible to have any help on this? Thanks Quote Link to comment
budtz Posted January 20, 2017 Report Share Posted January 20, 2017 On 7/16/2013 at 6:58 PM, Phillip Brooks said: I downloaded the .NET zxing lib and was able to use the 2.0 version to create a VI that reads various bar code image files downloaded frmo a google search with very little effort. I'm using this code but it seems to keep the BMP file open until the VI closes. Anyone know how to close the file so I can delete it? Quote Link to comment
hooovahh Posted January 20, 2017 Report Share Posted January 20, 2017 You aren't cleaning up your references at all. On top of holding onto the file you likely would have memory leaks. Close all the references you open when you are done with them. There are some functions that also have a dispose method so you may want to see if those are appropriate for releasing reference too. Quote Link to comment
budtz Posted January 20, 2017 Report Share Posted January 20, 2017 Hi Hoovahh, Thanks!! - I am actually closing the 3 references in my code (I just quoted the image from here) - here's my code below. How do I locate the dispose method? This might be what I need. Is that a .NET method like the Bitmap Quote Link to comment
hooovahh Posted January 20, 2017 Report Share Posted January 20, 2017 Just look through the list of methods for a given reference using an invoke node. I've used the Bitmap .Net before a few times and I don't remember having to do anything else to release a file from being held by an application. Quote Link to comment
budtz Posted January 23, 2017 Report Share Posted January 23, 2017 Hooovahh, thanks for the tip! Using the dispose node fixed the problem. Bitmap does not release the files without it (unless the Vi stops). Thanks!! Quote Link to comment
chuahua Posted March 8, 2017 Report Share Posted March 8, 2017 Does anyone know if we can read multiple barcodes in an image? Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.