Failed to detect barcode on embedded device running Android 6.1 using ZBar
I am trying to detect barcode from an image on my embedded platform using the 'zbarimg' source code. I get no errors while builing the zbar library or zbarimg.c files. However when I try to decode the barcode via 'zbarimg' binary on my embedded device I get the following error:
scanned 0 barcode symbols from 1 images in 0.21 seconds
WARNING: barcode data was not detected in some image(s)
things to check:
- is the barcode type supported? currently supported symbologies are:
EAN/UPC (EAN-13, EAN-8, EAN-2, EAN-5, UPC-A, UPC-E,
ISBN-10, ISBN-13), Code 128, Code 93, Code 39, Codabar,
DataBar, DataBar Expanded, and Interleaved 2 of 5
- is the barcode large enough in the image?
- is the barcode mostly in focus?
- is there sufficient contrast/illumination?
The same image is getting decoded perfectly in my computer.
Through some investigation, I noticed that the function call "zbar_image_first_symbol" returns null.
How do I resolve this issue ?
add a comment |
I am trying to detect barcode from an image on my embedded platform using the 'zbarimg' source code. I get no errors while builing the zbar library or zbarimg.c files. However when I try to decode the barcode via 'zbarimg' binary on my embedded device I get the following error:
scanned 0 barcode symbols from 1 images in 0.21 seconds
WARNING: barcode data was not detected in some image(s)
things to check:
- is the barcode type supported? currently supported symbologies are:
EAN/UPC (EAN-13, EAN-8, EAN-2, EAN-5, UPC-A, UPC-E,
ISBN-10, ISBN-13), Code 128, Code 93, Code 39, Codabar,
DataBar, DataBar Expanded, and Interleaved 2 of 5
- is the barcode large enough in the image?
- is the barcode mostly in focus?
- is there sufficient contrast/illumination?
The same image is getting decoded perfectly in my computer.
Through some investigation, I noticed that the function call "zbar_image_first_symbol" returns null.
How do I resolve this issue ?
add a comment |
I am trying to detect barcode from an image on my embedded platform using the 'zbarimg' source code. I get no errors while builing the zbar library or zbarimg.c files. However when I try to decode the barcode via 'zbarimg' binary on my embedded device I get the following error:
scanned 0 barcode symbols from 1 images in 0.21 seconds
WARNING: barcode data was not detected in some image(s)
things to check:
- is the barcode type supported? currently supported symbologies are:
EAN/UPC (EAN-13, EAN-8, EAN-2, EAN-5, UPC-A, UPC-E,
ISBN-10, ISBN-13), Code 128, Code 93, Code 39, Codabar,
DataBar, DataBar Expanded, and Interleaved 2 of 5
- is the barcode large enough in the image?
- is the barcode mostly in focus?
- is there sufficient contrast/illumination?
The same image is getting decoded perfectly in my computer.
Through some investigation, I noticed that the function call "zbar_image_first_symbol" returns null.
How do I resolve this issue ?
I am trying to detect barcode from an image on my embedded platform using the 'zbarimg' source code. I get no errors while builing the zbar library or zbarimg.c files. However when I try to decode the barcode via 'zbarimg' binary on my embedded device I get the following error:
scanned 0 barcode symbols from 1 images in 0.21 seconds
WARNING: barcode data was not detected in some image(s)
things to check:
- is the barcode type supported? currently supported symbologies are:
EAN/UPC (EAN-13, EAN-8, EAN-2, EAN-5, UPC-A, UPC-E,
ISBN-10, ISBN-13), Code 128, Code 93, Code 39, Codabar,
DataBar, DataBar Expanded, and Interleaved 2 of 5
- is the barcode large enough in the image?
- is the barcode mostly in focus?
- is there sufficient contrast/illumination?
The same image is getting decoded perfectly in my computer.
Through some investigation, I noticed that the function call "zbar_image_first_symbol" returns null.
How do I resolve this issue ?
edited Nov 13 '18 at 10:10
Khilav
asked Nov 13 '18 at 7:22
KhilavKhilav
115
115
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
Zbar using nv21 image format coming from camera preview. If you are using another format for image data you must convert it into nv21. You can do it with easyRS library or with manual byte to byte conversion.
Nv21Image nv21Image = Nv21Image.bitmapToNV21(renderScript, result);
After that you can setup zbar library with "Y800" pixel format
Image barcode = new Image(nv21Image.width, nv21Image.height, "Y800");
barcode.setData(nv21Image.nv21ByteArray);
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
|
show 12 more comments
I have resolved the error. Turns out that the config.h file I was using had macros for barcodes commented out i.e. ENABLE_EAN, ENABLE_CODE128, ENABLE_CODE39 were commented out. Because of this the function "zbar_scan_y" (present in 'img_scanner.c' was not able to detect the type of symbols and syms->nsysm would return NULL.
PS: Below is the list of links that will help you port zbar on Android OS.
1.) Source for Android :
https://github.com/ZBar/ZBar
2.) Steps to compile with Android may be taken from :
http://www.blackdogfoundry.com/blog/zbar-bar-code-qr-code-reader-android/
Note while compiling using the above steps you may encounter errors of undefined reference. Some source files need to be included in Android.mk file. Further, the patch provided in the above steps will have barcode macros commented out in config.h file.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275811%2ffailed-to-detect-barcode-on-embedded-device-running-android-6-1-using-zbar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
Zbar using nv21 image format coming from camera preview. If you are using another format for image data you must convert it into nv21. You can do it with easyRS library or with manual byte to byte conversion.
Nv21Image nv21Image = Nv21Image.bitmapToNV21(renderScript, result);
After that you can setup zbar library with "Y800" pixel format
Image barcode = new Image(nv21Image.width, nv21Image.height, "Y800");
barcode.setData(nv21Image.nv21ByteArray);
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
|
show 12 more comments
Zbar using nv21 image format coming from camera preview. If you are using another format for image data you must convert it into nv21. You can do it with easyRS library or with manual byte to byte conversion.
Nv21Image nv21Image = Nv21Image.bitmapToNV21(renderScript, result);
After that you can setup zbar library with "Y800" pixel format
Image barcode = new Image(nv21Image.width, nv21Image.height, "Y800");
barcode.setData(nv21Image.nv21ByteArray);
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
|
show 12 more comments
Zbar using nv21 image format coming from camera preview. If you are using another format for image data you must convert it into nv21. You can do it with easyRS library or with manual byte to byte conversion.
Nv21Image nv21Image = Nv21Image.bitmapToNV21(renderScript, result);
After that you can setup zbar library with "Y800" pixel format
Image barcode = new Image(nv21Image.width, nv21Image.height, "Y800");
barcode.setData(nv21Image.nv21ByteArray);
Zbar using nv21 image format coming from camera preview. If you are using another format for image data you must convert it into nv21. You can do it with easyRS library or with manual byte to byte conversion.
Nv21Image nv21Image = Nv21Image.bitmapToNV21(renderScript, result);
After that you can setup zbar library with "Y800" pixel format
Image barcode = new Image(nv21Image.width, nv21Image.height, "Y800");
barcode.setData(nv21Image.nv21ByteArray);
answered Nov 13 '18 at 10:52
OnixOnix
4228
4228
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
|
show 12 more comments
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
I am not using camera stream/camera image. I am directly providing a JPEG image to 'zbarimg' binary. Further 'zbarimg' seems to be working fine with my PC with the same JPEG image.
– Khilav
Nov 13 '18 at 11:27
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
You are build it as command line tool?
– Onix
Nov 13 '18 at 11:29
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
Yes I built zbarimg in my embedded board as a command line tool.
– Khilav
Nov 13 '18 at 11:31
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
zbarimg using ImageMagic as image processor. Is you build ImageMagick for you board? Do you know which version install ? Is Png file with barcode not working too ?
– Onix
Nov 13 '18 at 11:40
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
Yes, zbarimg is using imagemagick. I have built ImageMagick for my board successfully. Yes, when I give png file to 'zbarimg' binary I get an error saying "ERROR: NoDecodeDelegateForThisImageFormat `JP2' @ error/constitute.c/ReadImage/508". This I suspect is an ImageMagick error. The version of ImageMagick is 7.0.2-5.
– Khilav
Nov 13 '18 at 11:47
|
show 12 more comments
I have resolved the error. Turns out that the config.h file I was using had macros for barcodes commented out i.e. ENABLE_EAN, ENABLE_CODE128, ENABLE_CODE39 were commented out. Because of this the function "zbar_scan_y" (present in 'img_scanner.c' was not able to detect the type of symbols and syms->nsysm would return NULL.
PS: Below is the list of links that will help you port zbar on Android OS.
1.) Source for Android :
https://github.com/ZBar/ZBar
2.) Steps to compile with Android may be taken from :
http://www.blackdogfoundry.com/blog/zbar-bar-code-qr-code-reader-android/
Note while compiling using the above steps you may encounter errors of undefined reference. Some source files need to be included in Android.mk file. Further, the patch provided in the above steps will have barcode macros commented out in config.h file.
add a comment |
I have resolved the error. Turns out that the config.h file I was using had macros for barcodes commented out i.e. ENABLE_EAN, ENABLE_CODE128, ENABLE_CODE39 were commented out. Because of this the function "zbar_scan_y" (present in 'img_scanner.c' was not able to detect the type of symbols and syms->nsysm would return NULL.
PS: Below is the list of links that will help you port zbar on Android OS.
1.) Source for Android :
https://github.com/ZBar/ZBar
2.) Steps to compile with Android may be taken from :
http://www.blackdogfoundry.com/blog/zbar-bar-code-qr-code-reader-android/
Note while compiling using the above steps you may encounter errors of undefined reference. Some source files need to be included in Android.mk file. Further, the patch provided in the above steps will have barcode macros commented out in config.h file.
add a comment |
I have resolved the error. Turns out that the config.h file I was using had macros for barcodes commented out i.e. ENABLE_EAN, ENABLE_CODE128, ENABLE_CODE39 were commented out. Because of this the function "zbar_scan_y" (present in 'img_scanner.c' was not able to detect the type of symbols and syms->nsysm would return NULL.
PS: Below is the list of links that will help you port zbar on Android OS.
1.) Source for Android :
https://github.com/ZBar/ZBar
2.) Steps to compile with Android may be taken from :
http://www.blackdogfoundry.com/blog/zbar-bar-code-qr-code-reader-android/
Note while compiling using the above steps you may encounter errors of undefined reference. Some source files need to be included in Android.mk file. Further, the patch provided in the above steps will have barcode macros commented out in config.h file.
I have resolved the error. Turns out that the config.h file I was using had macros for barcodes commented out i.e. ENABLE_EAN, ENABLE_CODE128, ENABLE_CODE39 were commented out. Because of this the function "zbar_scan_y" (present in 'img_scanner.c' was not able to detect the type of symbols and syms->nsysm would return NULL.
PS: Below is the list of links that will help you port zbar on Android OS.
1.) Source for Android :
https://github.com/ZBar/ZBar
2.) Steps to compile with Android may be taken from :
http://www.blackdogfoundry.com/blog/zbar-bar-code-qr-code-reader-android/
Note while compiling using the above steps you may encounter errors of undefined reference. Some source files need to be included in Android.mk file. Further, the patch provided in the above steps will have barcode macros commented out in config.h file.
answered Nov 16 '18 at 9:09
KhilavKhilav
115
115
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53275811%2ffailed-to-detect-barcode-on-embedded-device-running-android-6-1-using-zbar%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown