Welcome Guest! To enable all features, please Login or Register.

Notification

Icon
Error

Options
View
Last Go to last post Unread Go to first unread post
#1 Posted : Wednesday, October 29, 2008 12:51:29 AM(UTC)

Bastien  
Bastien

Groups: Registered
Posts: 4


Hello,

I'm am currently testing your Mobile Imaging SDK to try reading various 2D Barcodes on Windows Mobile devices using the .NET API (QR and DataMatrix types).

While the provided sample (and one I created myself) just works fine on clear code-generated barcodes pictures, I do not manage to do so with lower quality ones (took from a built-in windows mobile camera for instance). I read some hints on how to try to enhance the barcode detection process by playing with intensity, contrast and level colors but with no luck (can't find the topic back, but it was about playing with AutoColorLevelCommand and DynamicBinaryCommand). Even by updating of a low quality picture with a paint program and producing an image which I think should be clear enough to be read does not seem to produce a readable barcode.

Still, by crawling your web sites, docs and forums, I think that your SDK should be able to handle a wide range of pictures, should they be crystal clear or not. So I think I missed something when testing it because I was expecting your SDK to handle the whole "image correction process" by itself. Here is the relevant code I suspect from not being properly written in my project. Consider that this is embedded in a Form, with a m_CurFileName private member correctly pointing to a QR picture file and searchFlags set to BarcodeSearchTypeFlags.QrCode. Am I missing something or doing anything wrong?

      BarcodeColor bColor = new BarcodeColor();
      bColor.BarColor = Color.Black;
      bColor.SpaceColor = Color.White;

      RasterCodecs codecs = new RasterCodecs();
      try {
                IRasterImage rImg = codecs.Load(m_CurFileName, 0, CodecsLoadByteOrder.Rgb, 1);

                int dim = 3;
                int contrast = 127;
                DynamicBinaryCommand dbc = new DynamicBinaryCommand(dim, contrast);
                dbc.Run(rImg);

                BarcodeEngine engine = new BarcodeEngine();
                BarcodeData[] bData = engine.Read(
                    rImg,
                    new Rectangle(0, 0, rImg.Width, rImg.Height),
                    searchFlags,
                    BarcodeUnit.ScanlinesPerPixels,
                    BarcodeReadFlags.None | BarcodeReadFlags.BlockSearch,
                    0,
                    null,
                    null,
                    bColor
                );

                // just read the first one for now
                if (bData != null && bData.Length > 0) {
                    if (bData[0].Data != null) {
                        m_Res.Text = Encoding.Default.GetString(bData[0].Data, 0, bData[0].Data.Length);
                    }
                }
      }
      catch (Exception ex) {
           ShowException(ex); // custom exception handling, basically a MessageBox.ShowMessage
      }

I may attach the whole project with picture samples if you require them. My tests fail both on the Device Emulator and various Windows Mobile devices (from Windows Mobile 5.0 to 6.1, using .NET CF 2.0 or 3.5) for low or not so sharp pictures but work on code generated ones (with clean perfect pretty lines and square dots).

Any help or guidance would be welcome :)

-- Bastien
(PS : French native speaker, sorry for any mistakes I could have made)
 

Try the latest version of LEADTOOLS for free for 60 days by downloading the evaluation: https://www.leadtools.com/downloads

Wanna join the discussion? Login to your LEADTOOLS Support accountor Register a new forum account.

#2 Posted : Wednesday, October 29, 2008 12:56:11 AM(UTC)

Bastien  
Bastien

Groups: Registered
Posts: 4


Whoops, forgot to mention, but I am using the latest available download for the Mobile Imaging evaluation SDK, which by its download URL seems to be the V14 one.
 
#3 Posted : Wednesday, October 29, 2008 6:16:56 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Bastien,

If you send me some sample images, I can try to suggest image processing functions. You can either post the sample images here or send them to support@leadtools.com. If you would like to send an email to support, please mention this forum post in your email.
If you want to send files, please put them all in a ZIP or RAR file first.
 
Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
#4 Posted : Wednesday, October 29, 2008 6:56:50 AM(UTC)

Bastien  
Bastien

Groups: Registered
Posts: 4


I attached to this message a ZIP file containing four samples on which I have been working lately. I tested them againt the above piece of code:
- qr0_working.jpg (code generated, correctly handled)
- qr1_clear.jpg (code generated, not recognized)
- qr2_photo.jpg (built-in camera photo, not recognized)
- qr3_altered_photo.jpg (built-in camera photo altered with a paint program, not recognized)

Following my original post I kept testing and playing with different barcodes (with different size and content) and I "sometimes" managed to get the reader to work correctly and output the text content of the barcode. However, that successful test was maybe something like 1 out of 100 tested pictures. So I suppose that may have something to do with the way the image is read or handled before being passed to the decoder but can't figure out on which parameters to operate.

Thanks for your interest.
File Attachment(s):
bastien_qr_samples.zip (36kb) downloaded 25 time(s).
 
#5 Posted : Thursday, October 30, 2008 5:47:25 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Bastien,

I managed to improve the quality of the image "qr1_clear.jpg" by using the following steps:
- IntensityDetectCommand with LowThreshold=128 and HighThreshold=255
- Increase the image DPI to 300
- Save the image to TIFF CCITTG4 1-bit.

I am attaching the result image.

About the other images, the images are not straight, so I couldn't improve the quality of these images. You may try to improve the quality by using the following steps:
- GrayscaleCommand 8-bit.
- MaximumCommand with Dimension=2
- MinimumCommand with Dimension=2
- IntensityDetectCommand with LowThreshold=138 and HighThreshold=255
- Increase the image DPI to 300
- Save the image to TIFF CCITTG4 1-bit.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
File Attachment(s):
TEST_clear.zip (1kb) downloaded 26 time(s).
 
#6 Posted : Thursday, October 30, 2008 6:42:31 AM(UTC)

Bastien  
Bastien

Groups: Registered
Posts: 4


Maen,

Sorry to ask but, did you try your processing steps using the Mobile Imaging SDK or the regular (Desktop) SDK?

If so, I would really like to see a sample code because I think the mobile SDK lacks some classes you mention (IntensityDetectCommand, MaximumCommand and MinimumCommand for instance). As I'm new to your product (to evaluate it) I may be wrong and may have missed these classes though. By the way, I have a beginner question: how do you increase the image DPI of an IRasterImage with the Mobile SDK? :)

About the images I attached to my previous post, they were just samples of what could be scanned. Our mobile application should be able to read barcodes from raw pictures taken from built-in camera on Windows Mobile devices. From what I understand from your message (but correct me if I'm wrong) it seems that you looked at the images and then told yourself "OK, I see, let's apply this, this and this filter to enhance that picture" which is not I'm looking for since I'd like the recognition system to be able to handle by itself all that "image-guess" processing stuff without having to somehow hard code RasterCommand values.

As a side note, I tried reading the image you provided with the piece of code I posted in my first message, and I'm still getting a "NotFound" Barcode exception.
 
#7 Posted : Sunday, November 2, 2008 5:08:56 AM(UTC)
Maen Hasan

Groups: Registered, Tech Support
Posts: 1,326

Was thanked: 1 time(s) in 1 post(s)

Bastien,

Yes, some of these functions do not exist in the LEADTOOLS .NET Compact Framework, but they exist in the DLL API interface in our Mobile Imaging toolkit. Their names are:
L_IntensityDetectBitmap
L_MaxFilterBitmap
L_MinFilterBitmap
L_GrayScaleBitmap

To change the resolution, load the image into LEADTOOLS, then change the following 2 members of the BITMAPHANDLE structure (if you're using the DLL API):
XResolution
YResolution
Then save the image back to disk.

In .NET, use the Load method, then change the RasterImage.XResolution  and RasterImage.YResolution properties, then save it back using the Save method.

Thanks,
Maen Badwan
LEADTOOLS Technical Support
 
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

Powered by YAF.NET | YAF.NET © 2003-2024, Yet Another Forum.NET
This page was generated in 0.136 seconds.