- acceptance to use CMake?
- drop SCons? (totally super seeded by CMake)
- drop XCode project files? (maybe some adjustments for iOS to CMakeLists.txt must be made)
- replaced ImageMagick with stb_image (2 lightweight files). The reasoning behind this is: ImageMagick is a real pain to build on Windows and OS X.
- acceptance to adding this to libzxing (not zxing.exe)? (note: this allows some visual debugging for bit matrices)
- rewritten zxing.exe
- complex PDF417 changes: Sure. Do you prefer a top-down summary or bottom-up annotated diffs? The backport to Java is a separate patch anyway.
- stb_image: I can replace it with jpgd+LodePNG and move it to zxing-image, so that it won't clutter libzxing (note: visual debugging gets sort of lost this way :/).
- rewritten zxing.exe: I'll make sure so that no use-case gets lost (bash-pipeline processing, playing around, blackbox testing)
For Java, bottom-up diff from HEAD is ideal. Obviously matching the style is best but that's easy for me to touch-up before commit. The harder thing would be integrating significant structural changes, and I don't imagine this needs structural changes.
Am Freitag, 8. Februar 2013 12:20:56 UTC+1 schrieb Sean Owen:
(...)
yesterday I found a litte, but effective improvement of "my" (hfn's) C++ port of the PDF417 detector. It happens that sometimes an image seems accurate, but it cannot be decoded because of perspective distorsion. However, I only hat to take into account that - as you know - each PDF417 codeword has 4 bars and 4 spaces. So, if the number of bars and spaces of one row equals 8 times the number of expected codewords, the new code takes 8 bars/spaces for each codeword. Are you still interested in this improvement although many changes have been done in "your" version of Detector? I can add it on monday and tell you the diff. Regards, hfn
/**
* Create a lines matrix from the points <xTopLeft,yTopLeft>,<xTopRight,yTopRight>,
* <xBottomLeft,yBottomLeft>,<xBottomRight,yBottomRight> with nLines lines.
**/
/**
* todo: append argument "int nColumns" in order to handle perspective transformation
* in horizontal direction; in vertical direction it's yet done
**/
Ref<BitMatrix> Delta2Binarizer::createLinesMatrix(
int xTopLeft,
int yTopLeft,
int xTopRight,
int yTopRight,
int xBottomLeft,
int yBottomLeft,
int xBottomRight,
int yBottomRight,
int nLines)
{
if(Matrix_)
return Matrix_;
LuminanceSource& source = *getLuminanceSource();
nWidth_ = Maximum(abs(xTopRight-xTopLeft),abs(xBottomRight-xBottomLeft))+1;
nHeight_ = nLines;
InitArrays(nWidth_);
Ref<BitMatrix> newMatrix (new BitMatrix(nWidth_ * UNIT, nHeight_));
ArrayRef<unsigned char> row_ref (nWidth_);
unsigned char* row = &row_ref[0];
int nDoubleHeight = nHeight_ * 2;
int rownum;
int xStart,yStart,xStop,yStop;
Ref<ResultPoint>rTopLeft(new ResultPoint(xTopLeft,yTopLeft)),
rTopRight(new ResultPoint(xTopRight,yTopRight)),
rBottomLeft(new ResultPoint(xBottomLeft,yBottomLeft)),
rBottomRight(new ResultPoint(xBottomRight,yBottomRight));
/* 2013-03-13 hfn: use perspective transformation, at first only with xdimension = 1(2 col.) */
Ref<PerspectiveTransform> trfm = createTransform(
rTopLeft,rTopRight,rBottomLeft,rBottomRight,
/*nColumns*/1,nLines);
std::vector<float> leftColumn(nLines << 1, (const float)0.0f);
std::vector<float> rightColumn(nLines << 1, (const float)0.0f);
for(int i=0;i<nLines;i++) {
int ii = i << 1;
leftColumn[ii] = 0;
leftColumn[ii + 1] = ((float)i + 0.5);
rightColumn[ii] = 1.0;
rightColumn[ii + 1] = ((float)i + 0.5);
}
trfm->transformPoints(leftColumn);
trfm->transformPoints(rightColumn);
for(rownum=0;rownum<nHeight_;rownum++) {
int rownum2 = rownum << 1;
xStart=(int)round(leftColumn[rownum2]);
yStart=(int)round(leftColumn[rownum2 + 1]);
xStop=(int)round(rightColumn[rownum2]);
yStop=(int)round(rightColumn[rownum2 + 1]);
#if (defined _WIN32 && defined DEBUG)
WCHAR sz[256];
swprintf(sz,_T("rownum = %d,start=%d,%d,stop=%d,%d\n"),rownum,xStart,yStart,xStop,yStop);
OutputDebugString(sz);
#endif
/* get the line from start to end point: */
if(source.getStraightLine(row,nWidth_,xStart,yStart,xStop,yStop) > 0)
HandleRow(rownum,row,newMatrix);
}
Matrix_ = newMatrix;
return newMatrix;
}
Ref<PerspectiveTransform> Delta2Binarizer::createTransform(
Ref<ResultPoint> topLeft,
Ref<ResultPoint> topRight,
Ref<ResultPoint> bottomLeft,
Ref<ResultPoint> bottomRight,
int dimensionX, int dimensionY)
{
Ref<PerspectiveTransform> transform(
PerspectiveTransform::quadrilateralToQuadrilateral(
0.0f, // p1ToX
0.0f, // p1ToY
dimensionX, // p2ToX
0.0f, // p2ToY
dimensionX, // p3ToX
dimensionY, // p3ToY
0.0f, // p4ToX
dimensionY, // p4ToY
topLeft->getX(), // p1FromX
topLeft->getY(), // p1FromY
topRight->getX(), // p2FromX
topRight->getY(), // p2FromY
bottomRight->getX(), // p3FromX
bottomRight->getY(), // p3FromY
bottomLeft->getX(), // p4FromX
bottomLeft->getY())); // p4FromY
return transform;
}
1. C++ make / build system changes. I'd defer to Steven about what to incorporate. I'm sure it's all a good idea; some bits may be at odds with building for stuff like the iPhone, I don't know. I can provide commit access if that's the easiest way to add it.
2. Simple PDF417 changes. That should be easy to back-port to Java and I can help there.3. Complex PDF417 changes. Let's talk about this last. I remember trying to incorporate a patch on this point and finding it was a bit too hard for some reason.
OK, so the Java patches are ready to review/commit? and should I start with the first one only?