Ejemplo n.º 1
0
        // jbclass.c (1030, 1)
        // jbClassifyCorrelation(classer, boxa, pixas) as int
        // jbClassifyCorrelation(JBCLASSER *, BOXA *, PIXA *) as l_ok
        ///  <summary>
        /// jbClassifyCorrelation()
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbClassifyCorrelation/*"/>
        ///  <param name="boxa">[in] - new components for classification</param>
        ///  <param name="pixas">[in] - new components for classification</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int jbClassifyCorrelation(
            JbClasser classer,
            Boxa boxa,
            Pixa pixas)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            if (boxa == null)
            {
                throw new ArgumentNullException("boxa cannot be Nothing");
            }

            if (pixas == null)
            {
                throw new ArgumentNullException("pixas cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            int _Result = Natives.jbClassifyCorrelation(classer.Pointer, boxa.Pointer, pixas.Pointer);

            return(_Result);
        }
Ejemplo n.º 2
0
        // jbclass.c (2228, 1)
        // jbGetULCorners(classer, pixs, boxa) as int
        // jbGetULCorners(JBCLASSER *, PIX *, BOXA *) as l_ok
        ///  <summary>
        /// (1) This computes the ptaul field, which has the global UL corners,
        /// adjusted for each specific component, so that each component
        /// can be replaced by the template for its class and have the
        /// centroid in the template in the same position as the
        /// centroid of the original connected component.  It is important
        /// that this be done properly to avoid a wavy baseline in the
        /// result.<para/>
        ///
        /// (2) The array fields ptac and ptact give the centroids of
        /// those components relative to the UL corner of each component.
        /// Here, we compute the difference in each component, round to
        /// nearest integer, and correct the boxtox and boxtoy by
        /// the appropriate integral difference.<para/>
        ///
        /// (3) The templates and stored instances are all bordered.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbGetULCorners/*"/>
        ///  <param name="pixs">[in] - full res image</param>
        ///  <param name="boxa">[in] - of c.c. bounding rectangles for this page</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int jbGetULCorners(
            JbClasser classer,
            Pix pixs,
            Boxa boxa)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            if (pixs == null)
            {
                throw new ArgumentNullException("pixs cannot be Nothing");
            }

            if (boxa == null)
            {
                throw new ArgumentNullException("boxa cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            int _Result = Natives.jbGetULCorners(classer.Pointer, pixs.Pointer, boxa.Pointer);

            return(_Result);
        }
Ejemplo n.º 3
0
        // jbclass.c (531, 1)
        // jbAddPageComponents(classer, pixs, boxas, pixas) as int
        // jbAddPageComponents(JBCLASSER *, PIX *, BOXA *, PIXA *) as l_ok
        ///  <summary>
        /// (1) If there are no components on the page, we don't require input
        /// of empty boxas or pixas, although that's the typical situation.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbAddPageComponents/*"/>
        ///  <param name="pixs">[in] - input page</param>
        ///  <param name="boxas">[in] - b.b. of components for this page</param>
        ///  <param name="pixas">[in] - components for this page</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int jbAddPageComponents(
            JbClasser classer,
            Pix pixs,
            Boxa boxas,
            Pixa pixas)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            if (pixs == null)
            {
                throw new ArgumentNullException("pixs cannot be Nothing");
            }

            if (boxas == null)
            {
                throw new ArgumentNullException("boxas cannot be Nothing");
            }

            if (pixas == null)
            {
                throw new ArgumentNullException("pixas cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            int _Result = Natives.jbAddPageComponents(classer.Pointer, pixs.Pointer, boxas.Pointer, pixas.Pointer);

            return(_Result);
        }
Ejemplo n.º 4
0
        // jbclass.c (1832, 1)
        // jbClasserDestroy(pclasser) as Object
        // jbClasserDestroy(JBCLASSER **) as void
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbClasserDestroy/*"/>
        public static void jbClasserDestroy(
            JbClasser pclasser)
        {
            if (pclasser == null)
            {
                throw new ArgumentNullException("pclasser cannot be Nothing");
            }

            IntPtr pclasserPtr = IntPtr.Zero;       if (pclasser != null)

            {
                pclasserPtr = pclasser.Pointer;
            }

            Natives.jbClasserDestroy(pclasserPtr);
        }
Ejemplo n.º 5
0
        // jbclass.c (2320, 1)
        // jbGetLLCorners(classer) as int
        // jbGetLLCorners(JBCLASSER *) as l_ok
        ///  <summary>
        /// (1) This computes the ptall field, which has the global LL corners,
        /// adjusted for each specific component, so that each component
        /// can be replaced by the template for its class and have the
        /// centroid in the template in the same position as the
        /// centroid of the original connected component. It is important
        /// that this be done properly to avoid a wavy baseline in the result.<para/>
        ///
        /// (2) It is computed here from the corresponding UL corners, where
        /// the input templates and stored instances are all bordered.
        /// This should be done after all pages have been processed.<para/>
        ///
        /// (3) For proper substitution, the templates whose LL corners are
        /// placed in these locations must be UN-bordered.
        /// This is available for a realistic jbig2 encoder, which would<para/>
        ///
        /// (1) encode each template without a border, and (2) encode
        /// the position using the LL corner (rather than the UL
        /// corner) because the difference between y-values
        /// of successive instances is typically close to zero.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbGetLLCorners/*"/>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int jbGetLLCorners(
            JbClasser classer)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            int _Result = Natives.jbGetLLCorners(classer.Pointer);

            return(_Result);
        }
Ejemplo n.º 6
0
        // jbclass.c (1882, 1)
        // jbDataSave(classer) as JbData
        // jbDataSave(JBCLASSER *) as JBDATA *
        ///  <summary>
        /// (1) This routine stores the jbig2-type data required for
        /// generating a lossy jbig2 version of the image.
        /// It can be losslessly written to (and read from) two files.<para/>
        ///
        /// (2) It generates and stores the mosaic of templates.<para/>
        ///
        /// (3) It clones the Numa and Pta arrays, so these must all
        /// be destroyed by the caller.<para/>
        ///
        /// (4) Input 0 to use the default values for latticew and/or latticeh,
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbDataSave/*"/>
        ///   <returns>jbdata, or NULL on error</returns>
        public static JbData jbDataSave(
            JbClasser classer)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            IntPtr _Result = Natives.jbDataSave(classer.Pointer);

            if (_Result == IntPtr.Zero)
            {
                return(null);
            }

            return(new JbData(_Result));
        }
Ejemplo n.º 7
0
        // jbclass.c (444, 1)
        // jbAddPages(classer, safiles) as int
        // jbAddPages(JBCLASSER *, SARRAY *) as l_ok
        ///  <summary>
        /// (1) jbclasser makes a copy of the array of file names.<para/>
        ///
        /// (2) The caller is still responsible for destroying the input array.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/jbAddPages/*"/>
        ///  <param name="safiles">[in] - of page image file names</param>
        ///   <returns>0 if OK 1 on error</returns>
        public static int jbAddPages(
            JbClasser classer,
            Sarray safiles)
        {
            if (classer == null)
            {
                throw new ArgumentNullException("classer cannot be Nothing");
            }

            if (safiles == null)
            {
                throw new ArgumentNullException("safiles cannot be Nothing");
            }

            IntPtr classerPtr = IntPtr.Zero; if (classer != null)
            {
                classerPtr = classer.Pointer;
            }
            int _Result = Natives.jbAddPages(classer.Pointer, safiles.Pointer);

            return(_Result);
        }