i'm not able to make the barcode reader get the code from the image.
This is my code
Dim
license As Aspose.BarCode.License = New Aspose.BarCode.License()
license.SetLicense(
"Aspose.BarCode.lic")
Dim reader As New BarCodeReader("C:\Users\nem\Pictures\Barcode\IMG_3297B.JPG")
'reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.ComplexBackground
Dim stCode As String = String.Empty
Do While reader.Read()
stCode = reader.GetCodeText()
Loop
Dim s As String = stCode
v
Hi
Thank you for contacting support. We managed to replicate the problem of recognition failure. We have logged this issue under ticket id BARCODENET-34109 in our issue tracking system. Your post has also been linked to this issue. We’ll keep you informed regarding any available updates. We’re sorry for the inconvenience caused.
Actually the component was not able to recognize any barcode from images taken from my phone.
Hi
Thank you for the inquiry. It’s prior to say anything before the initial investigation of the reported ticket id BARCODENET-34109. In general, there are many factors contribute in scan failure, like the presence of noise in the image, skewed barcode labels, punch holes/white spots etc. Severity of one such factor or a combination of two or more makes it difficult for the barcode recognition algorithm to scan a barcode properly.
We recommend our clients to encode barcode images as follows:
- Resolution: ideal resolution is 300 dpi to 600 dpi
- Orientation: The best barcode orientation is horizontal and the worst orientation is diagonal 45 or 225 degree.
- Color: the best is black and white or near this.
- Pictures having only barcodes: It’s better if we have only barcodes on the picture, because other items can mess gray scaling process.
- General: if barcode is more clear, recognition will be better.
We hope, these recommendations will help you. Please feel free to reply us in case of any confusion or questions.
I tried to change the resolution as 300.
Also i added a function to make the image Grayscale … nothing helped.
Please let me know as soon as possible.
Regards
Nem
Public Function Getcode()
Dim license As Aspose.BarCode.License = New Aspose.BarCode.License()
license.SetLicense(“Aspose.BarCode.lic”)
Dim btmp As Bitmap = Bitmap.FromFile(“C:\Users\nem\Pictures\Barcode\IMG_3297B.jpg”)
Dim newBtmp As New Bitmap(btmp)
newBtmp.SetResolution(300, 300)
newBtmp = GrayScale(newBtmp)
If File.Exists(“C:\Users\nem\Pictures\Barcode\IMG_3297B_300.jpg”) Then File.Delete(“C:\Users\nem\Pictures\Barcode\IMG_3297B_300.jpg”)
newBtmp.Save(“C:\Users\nem\Pictures\Barcode\IMG_3297B_300.jpg”, ImageFormat.Jpeg)
Dim reader As New BarCodeReader(“C:\Users\nem\Pictures\Barcode\IMG_3297B_300.jpg”)
'reader.ImageBinarizationHints = RecognitionHints.ImageBinarization.ComplexBackground
Dim stCode As String = String.Empty
Do While reader.Read()
stCode = reader.GetCodeText()
Loop
End Function
Public Function GrayScale(Bmp As Bitmap) As Bitmap
Dim rgb As Integer
Dim c As Color
For y As Integer = 0 To Bmp.Height - 1
For x As Integer = 0 To Bmp.Width - 1
c = Bmp.GetPixel(x, y)
rgb = CInt((CInt(c.R) + CInt(c.G) + CInt(c.B)) / 3)
Bmp.SetPixel(x, y, Color.FromArgb(rgb, rgb, rgb))
Next
Next
Return Bmp
End Function
Hi
Thank you for the details. We have intimated to the responsible developer to take a look at your issue shortly. We’ll let you know once an update is available in this regard. Please be patient and spare us a little time.
Hi Nem,
Thank you for being patient. We have a good news for you that the issue id BARCODENET-34109 has now been resolved. If there is no issue in the QA phase, then this fix will be included in the next version of Aspose.BarCode for .NET 6.9.0. We’ll inform you via this forum thread as soon as the new release is published.
The issues you have found earlier (filed as BARCODENET-34109) have been fixed in Aspose.BarCode for .NET 6.9.0.
This message was posted using Notification2Forum from Downloads module by Aspose Notifier.