This project has moved. For the latest updates, please go here.

PDF417 Truncated..

Sep 6, 2012 at 8:31 PM
Edited Sep 6, 2012 at 8:31 PM

Hello,

    I was wondering if anyone had any advice trying to support truncated PDF417.. The big difference is the ending pattern is 1 solid black line with a thickness of 1 (ya awesome I know), that's it.. I have tried messing with the stop pattern but with no luck, I am all ears for suggestions :-).

 

Thanks

Josh

Coordinator
Sep 7, 2012 at 6:49 PM

A while ago I tried to add the support for truncated pdf417. I had a small success with a very naiv patch for the detector.
But the decoder didn't work with the detected data. So I stopped searching for a solution.
(if you apply the patch you have to remove the comment chars.)

 

Index: Source/lib/pdf417/detector/Detector.cs
===================================================================
--- Source/lib/pdf417/detector/Detector.cs    (revision 78790)
+++ Source/lib/pdf417/detector/Detector.cs    (working copy)
@@ -182,7 +182,8 @@
 
          // Top right
          if (found)
-         { // Found the Bottom Left vertex
+         {
+            // Found the Bottom Left vertex
             found = false;
             for (int i = 0; i < height; i += rowStep)
             {
@@ -195,10 +196,55 @@
                   break;
                }
             }
+            //if (!found)
+            //{
+            //   // try truncated PDF417
+            //   var posY = (int) result[4].Y;
+            //   var searchSpaceAfterLine = false;
+            //   for (var posX = (int)result[4].X + 1; posX < width; posX++)
+            //   {
+            //      var pixel = matrix[posX, posY];
+            //      if (pixel != searchSpaceAfterLine)
+            //      {
+            //         found = true;
+            //         for (int i = posY; i < result[5].Y; i++)
+            //         {
+            //            pixel = matrix[posX, i];
+            //            if (pixel == searchSpaceAfterLine)
+            //            {
+            //               found = false;
+            //               break;
+            //            }
+            //         }
+            //         if (found)
+            //         {
+            //            if (searchSpaceAfterLine)
+            //            {
+            //               result[2] = new ResultPoint(posX - 2, posY);
+            //               result[6] = new ResultPoint(posX, posY);
+            //               result[3] = new ResultPoint(posX - 2, result[5].Y);
+            //               result[7] = new ResultPoint(posX, result[5].Y);
+            //               break;
+            //            }
+            //            else
+            //            {
+            //               searchSpaceAfterLine = true;
+            //            }
+            //         }
+            //         else
+            //         {
+            //            searchSpaceAfterLine = false;
+            //         }
+            //      }
+            //   }
+            //   return found ? result : null;
+            //}
          }
+
          // Bottom right
          if (found)
          { // Found the Top right vertex
+            counters = new int[STOP_PATTERN.Length];
             found = false;
             for (int i = height - 1; i > 0; i -= rowStep)
             {