I am trying to work around another bug and finding some incomplete documentation as well as pretty major discrepancies between the documentation and the actual product (Barcode Recognition 5.5.0). I am using the API documentation here:
Class BarCodeReader | Aspose.BarCode for .NET API Reference
CustomizedThreshold sounds like it might be useful, and it exists as a property on my object so I look at http://www.aspose.com/docs/display/barcodenet/CustomizedThreshold+Property
and see that “This property works only the ThresholdHints.Customized Hints was set.”. Well ok, so I look for where to set ThresholdHints and don’t see any other properties that make sense, so I do a search (www.aspose.com/docs/dosearchsite.action?queryString=ThresholdHints) returning no results. I try another search (http://www.aspose.com/docs/dosearchsite.action?queryString=ThresholdHints.Customized
) for ThresholdHints.Customized and it only returns a reference to needing to enable it (from the ustomizedThreshold property pages). I do some more digging and find this thread (SetHints - ScanStrengthHints.Strong option obsolete) that seems to imply that scanstrengthhints are obsolete, I’m going to assume that CustomizedThreshold was part of that process and is also obsolete because I don’t see any other way to turn it on. Moving on…
I decide to look at the documentation for a property I’ve been using to get more information on it “ImageBinarizationHints”, but it’s not documented in the API reference. A quick search for “ImageBinarizationHints” seems to be broken, returning no results yet I know it’s referenced here (Recognition Quality and Speed|Documentation). The only problem is that last page lists the options but doesn’t describe what each option does or why you would want to use it? Some are obvious but I have no idea what HLS is, should I use it? Should I stick with Grayscale?? Off to Wiki I go, turns out it’s related so color and I don’t care about that so I stick with Grayscale.
Next I decide to look into the “OrientationHints” property… except it’s also not listed in the API reference. I know that it is referenced in the programmer’s guide (www.aspose.com/docs/display/barcodenet/Barcode+Orientation) except I can’t pull that page up right now because the site is running slow. That’s ok because I know I’ve read that page and I think it just provides a basic sample of setting the hint to Rotate90, but doesn’t tell me how to effectively use this property. What happens if I change this property after I’ve started reading? Looking at intellisense in Visual Studio I see this is an enum, why not bitflags where multiples could be provided, or at least why not provide a “Veritical” and “Horizontal”. Do I need to create an object to scan at Rotate90 then recreate it to scan at Rotate270? Is this property just a “hint” and it scans in that direction first and
then in other directions or is it more of a rule where it will only scan
for barcodes in that direction? I’m pretty sure it’s just a hint because if you don’t set it it is default to “NoRotate” which I would guess is 0 degrees, but it still finds (inaccurately valued) barcodes that are rotated 90 degrees. The page about orientation finally loaded and it says “In this case, the barcode reader tries to detect the barcode in all possible directions.”, in what case is it talking about? The case where the hint isn’t set at all, is that different than if I explicitly set “NoRotate” even though that seems to be the default?
I feel like I’m beating my head against a brick wall trying to get anywhere here, can you please answer some of the questions about the rotate hints and custom thresholds, and update the documentation for this product?
Hi
TheMitasGroup:CustomizedThreshold sounds like it might be useful, and it exists as a property on my object so I look athttp://www.aspose.com/docs/display/barcodenet/CustomizedThreshold+Property
and see that “This property works only the ThresholdHints.Customized Hints was set.”. Well ok, so I look for where to set ThresholdHints and don’t see any other properties that make sense, so I do a search (www.aspose.com/docs/dosearchsite.action?queryString=ThresholdHints) returning no results. I try another search (http://www.aspose.com/docs/dosearchsite.action?queryString=ThresholdHints.Customized
) for ThresholdHints.Customized and it only returns a reference to needing to enable it (from the ustomizedThreshold propery pages). I do some more digging and find this thread (SetHints - ScanStrengthHints.Strong option obsolete) that seems to imply that scanstrengthhints are obsolete, I’m going to assume that CustomizedThreshold was part of that process and is also obsolete because I don’t see any other way to turn it on. Moving on…
TheMitasGroup:I decide to look at the documentation for a property I’ve been using to get more information on it “ImageBinarizationHints”, but it’s not documented in the API reference. A quick search for “ImageBinarizationHints” seems to be broken, returning no results yet I know it’s referenced here (Recognition Quality and Speed|Documentation). The only problem is that last page lists the options but doesn’t describe what each option does or why you would want to use it? Some are obvious but I have no idea what HLS is, should I use it? Should I stick with Grayscale?? Off to Wiki I go, turns out it’s related so color and I don’t care about that so I stick with Grayscale.
TheMitasGroup:Next I decide to look into the “OrientationHints” property… except it’s also not listed in the API reference. I know that it is referenced in the programmer’s guide (www.aspose.com/docs/display/barcodenet/Barcode+Orientation) except I can’t pull that page up right now because the site is running slow. That’s ok because I know I’ve read that page and I think it just provides a basic sample of setting the hint to Rotate90, but doesn’t tell me how to effectively use this property. What happens if I change this property after I’ve started reading? Looking at intellisense in Visual Studio I see this is an enum, why not bitflags where multiples could be provided, or at least why not provide a “Veritical” and “Horizontal”. Do I need to create an object to scan at Rotate90 then recreate it to scan at Rotate270? Is this property just a “hint” and it scans in that direction first and then in other directions or is it more of a rule where it will only scan for barcodes in that direction? I’m pretty sure it’s just a hint because if you don’t set it it is default to “NoRotate” which I would guess is 0 degrees, but it still finds (inaccurately valued) barcodes that are rotated 90 degrees. The page about orientation finally loaded and it says “In this case, the barcode reader tries to detect the barcode in all possible directions.”, in what case is it talking about? The case where the hint isn’t set at all, is that different than if I explicitly set “NoRotate” even though that seems to be the default?
It would be great to see the documentation updated with this information, as well as the expected performance hit/enhancement/comparison between the binarization hint options.
The image is the same one as the other thread (which most members won’t be able to see due to the fact that I wanted the attachments to be private, not sure how that works by default):
Code128 not reading properly
Attachment curPage.bmp
I am trying to figure out how to be as confident as possible that the barcode read and it seems the only way to do that is to read the image several times with different rotate hints.
Hi Doug,
Thanks for the information. I have updated the appropriate documentation pages with the above information and sure we will include some other helping articles like the comparison and enhancement in the near future.
TheMitasGroup:
The image is the same one as the other thread (which most members won’t be able to see due to the fact that I wanted the attachments to be private, not sure how that works by default):
Attachment curPage.bmp
I already have logged this problem under ticket id BARCODENET-33569 in our issue tracking system. Our development team is working to analyze the problem. We will let you know as soon as we have made some significant progress. You don’t need to read the bar code image several times with different rotate hints because you can set other possible rotations in a single line:
reader.OrientationHints = RecognitionHints.Orientation.Rotate90 | RecognitionHints.Orientation.Rotate270;
Please let me know in case of further assistance or questions.
Above it sounded like you were saying it doesn’t make sense for the OrientationHints to be a BitFlags based enum due to the processing mechanism, and yet your last line of code suggests that it is?
So, I tried:
oBarCodeReader.OrientationHints = RecognitionHints.Orientation.Rotate90 | RecognitionHints.Orientation.Rotate270
… and it doesn’t work, a quick “Go To Definition” on the Orientation" enum shows it is not configured for flags (but the ImageBinarization is):
public class RecognitionHints
{
[Flags]
public enum ImageBinarization
{
None = 1,
HLS = 2,
Grayscale = 4,
MedianSmoothing = 8,
}
public enum Orientation
{
NoRotate = 1,
Rotate90 = 2,
Rotate180 = 4,
Rotate270 = 8,
}
}
Hi Doug,
TheMitasGroup:I decide to look at the documentation for a property I've been using to get more information on it "ImageBinarizationHints", but it's not documented in the API reference. A quick search for "ImageBinarizationHints" seems to be broken, returning no results yet I know it's referenced here (https://docs.aspose.com/barcode/net/improve-barcode-recognition/).Next I decide to look into the "OrientationHints" property... except it's also not listed in the API reference. I know that it is referenced in the programmer's guide (www.aspose.com/docs/display/barcodenet/Barcode+Orientation)
and “BarCodeReader.OrientationHints”
Fair enough, though I don’t think it’s very user friendly… and that is even considering that your user base is typically fairly advanced.
It may be worth filing it somewhere under feature request rather than bug report.
It may be of use to you that we use a library aforge.net and do a lot of the image cleanup (filters, deskew, contrast, bit depth etc) before we send in to Aspose for recognition
Paul,
Thanks for the information. Unfortunately this bug occurs
on images that have always been digital files so we do not have any
noise or contrast issues (start with pdf, open it and place barcode,
close and save, open file again convert entire page to image and read
for the barcode). For now I just have the page scanned like 9 different
times with different settings, it’s very time consuming but it is
critical for the results to be accurate and unfortunately that’s the
only way I could be sure.
This thread was more about the struggles that the Aspose users may be going through if they are trying to use the official documentation (I’ve had similar results with the Aspose.PDF.Facade namespace, and there’s another thread for that). If you’re interested in reading about the bugs and limitations that prompted the workload which in turn prompted this post you can view it here:
Code128 not reading properly
There were two bugs opened, and fixed, and now I’m just waiting for them to be released. The release is “expected” this week, though I’ve seen the same wording on posts in which the release didn’t come for several weeks after it’s “expected” date so… fingers crossed.
-Doug
Doh, I marked that post private because I didn’t know how the forum attachment system worked at the time… and now I can’t un-mark it, sorry.
Basically there is a problem when scanning a full page for barcodes (BARCODENET-33569). This is also a bug related to the constructor for BarcodeRecogniser that takes a rectangle where it takes about half a second, vs 25ms to slice the image yourself and then pass in only the sliced image (BARCODENET-33572). Both of these have been fixed and are due in the next version 5.6.0.
TheMitasGroup:There were two bugs opened, and fixed, and now I'm just waiting for them to be released. The release is "expected" this week, though I've seen the same wording on posts in which the release didn't come for several weeks after it's "expected" date so... fingers crossed.-Doug
I’m fine with other users being able to see and comment on this thread, I
was actually saying that I wish I could mark the other post as
not-private.
Thank you for the update but I must say it is very disappointing that the most critical bug has now been delayed in it’s release schedule. Putting off an update that fixes a completely crippled product (for what I am using it for, full page scan barcode searches) for a week or two is one thing, but months… that’s pretty rough.
That is correct, when I try to edit the post the Keep this post private is disabled so I can’t uncheck it.
That button is not available to me.