Hi everyone:
I am a newbie in ZXing and C++. First timer using JNI in my android
development.
I am working on a project which use the phone to take pictures of
QRcode and then detect and decode the code.
Originally we coded the application in Java. Now we decide to use the C
++ version since this is much faster.
We made the ZXing C 1.4 Version working and can call everything from
Java through JNI.
But we want to use the ZXing C 1.5 Version now. The problem is that
Zxing C 1.5 is vastly different from 1.4.
Where can I find the document about the changes that has been made?
Or if there is no document about those changes. I have the following
code in C1.4, can anyone give me some sample codes which accomplish
the same thing?
The codes are :
int detFiducialPoint(IplImage *imgGray,
double *imgPts,
QRInfo *qrParam)
{
QRCodeReader myQRCodeReader;
//Convert image to ZXing format
Ref<GrayBytesMonochromeBitmapSource> qrimg(new
GrayBytesMonochromeBitmapSource ((const unsigned char *)imgGray-
>imageData,imgGray->width,imgGray->height, imgGray->widthStep));
//Decode QR codes
Ref<Result> result = myQRCodeReader.decode(qrimg);
//Get fiducial points
ArrayRef<Ref<ResultPoint> > points(result->getResultPoints());
if (points->size() != NUM_FIDUCIAL_PTS){
cout<<"Insufficient number of fiducial points
detected."<<endl;
return -1;
}
//Copy fiducial points (in the order of FP1,2,3 and AP in "Z"
order)
imgPts[0]= points[1]->getY();
imgPts[1]= points[1]->getX();
imgPts[2]= points[2]->getY();
imgPts[3]= points[2]->getX();
imgPts[4]= points[0]->getY();
imgPts[5]= points[0]->getX();
imgPts[6]= points[3]->getY();
imgPts[7]= points[3]->getX();
cout<<"fiducial points = [";
for (size_t i = 0; i < points->size(); i++) {
cout << imgPts[2*i] << "," << imgPts[2*i+1] << ";";
}
cout<<"]"<<endl;
cout<<"contents = "<<*(result->getText())<<endl;
Version version = result->getVersion();
qrParam->version = version.getVersionNumber();
qrParam->numModPerAxis = version.getDimensionForVersion();
///////////////////////////////////////
qrParam->lengthInMeter = 0.2; //eventually to be read from QR
code itself
///////////////////////////////////////
//cout<<"qrver="<<qrParam->version<<endl;
//cout<<"qrnumline="<<qrParam->numModPerAxis<<endl;
return 0;
}
A lot of classes have been changed and
"GrayBytesMonochromeBitmapSource " is not even there anymore.
I found some example code at :
http://code.google.com/p/zxing/source/browse/trunk/cpp/magick/src/example.cpp?spec=svn1144&r=1144
But I do not know for what reason, tt seems that I can not use
anything related to
"Magick++.h", I downloaded "MagickBitmapSource.h" and
""MagickBitmapSource.cpp", and include "MagickBitmapSource.h" in my
code in order to use
Ref<MagickBitmapSource> source(new MagickBitmapSource(image));
as in the example.
It seem this line of code is not compilable because of "Magick++.h".
Anyone has any idea how to solve this?
Any help will be appreciated!
Thanks!
Weihua Gao
Any help will be appreciated.