How to decode byte array using C++ source code

881 views
Skip to first unread message

hico

unread,
Aug 1, 2013, 4:14:10 AM8/1/13
to zx...@googlegroups.com
Hi there,

I'm having some troubles using the C++ sources from the Zxing project. I downloaded the whole project from https://code.google.com/p/zxing/downloads/list and just took the cpp files (core and cli), then integrated them into my project.

I just would like to have a method like that:

decode(byte[] dataToDecode, int widthFrame, int heightFrame)

but I really don't know how to do it (I'm really new to c++ and Zxing project). Data to decode will, in a near future, come from the Android QRCode client.

I've done some researches on the web and found http://wiki.ssrrsummerschool.org/doku.php?id=robocup2012:qrcode-cppexample which was exactly what I needed. I've managed this code to compile due to the implementation of the ArrayRef template instead of unsigned char *.

Unfortunately, my program is now crashing in the class Array.h:

  operator bool () const {
    return array_ != 0;
  }
 
but I can't see what is the exception attached. Maybe I did something wrong.
Is there an easy way to decode a byte array (RGB) and return a result string ? A sample or documentation or something like that ?

Please find attached the 3 source files I'm using (including main program) in case you wanna check.
They are quite easy to understand and there isn't a lot of code.

Help would be really appreciated,

Thanks for your time,

BufferBitmapSource.cpp
BufferBitmapSource.h
test.cpp
Message has been deleted

hico

unread,
Aug 1, 2013, 5:53:43 AM8/1/13
to zx...@googlegroups.com
The problem has been solved.
It was a pointer issue, so modified the bufferBitmapSource implementation in method BufferBitmapSource::getRow:

...
for (int x = 0; x < width; x ++)
{
row[x] = (*buffer) [y*width + x];
}

Works great now.

Sergiu Oprean

unread,
Apr 25, 2016, 3:13:10 AM4/25/16
to zxing
Hi,
I am trying to use zxing.cpp together with a webcam rgb int output (raw bitmap data).

I am having a similar problem with the one mentioned here, no matter what I do, using BufferBitmapSource (with the test buffer array, or the webcam input) I get the same result: possibleCenters_.size()== 0 in FinderPatternFinder.cpp

Any suggestion would be highly appreciated.

regards,
Sergiu
vector_error.jpg
Reply all
Reply to author
Forward
0 new messages