Пример #1
0
        // quadtree.c (92, 1)
        // pixQuadtreeMean(pixs, nlevels, pix_ma, pfpixa) as int
        // pixQuadtreeMean(PIX *, l_int32, PIX *, FPIXA **) as l_ok
        ///  <summary>
        /// (1) The returned fpixa has %nlevels of fpix, each containing
        /// the mean values at its level.  Level 0 has a
        /// single value level 1 has 4 values level 2 has 16 etc.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixQuadtreeMean/*"/>
        ///  <param name="pixs">[in] - 8 bpp, no colormap</param>
        ///  <param name="nlevels">[in] - in quadtree max allowed depends on image size</param>
        ///  <param name="pix_ma">[in] - input mean accumulator can be null</param>
        ///  <param name="pfpixa">[out] - mean values in quadtree</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int pixQuadtreeMean(
            Pix pixs,
            int nlevels,
            Pix pix_ma,
            out FPixa pfpixa)
        {
            if (pixs == null)
            {
                throw new ArgumentNullException("pixs cannot be Nothing");
            }

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

            IntPtr pfpixaPtr = IntPtr.Zero;
            int    _Result   = Natives.pixQuadtreeMean(pixs.Pointer, nlevels, pix_ma.Pointer, out pfpixaPtr);

            if (pfpixaPtr == IntPtr.Zero)
            {
                pfpixa = null;
            }
            else
            {
                pfpixa = new FPixa(pfpixaPtr);
            };

            return(_Result);
        }
Пример #2
0
        // quadtree.c (530, 1)
        // quadtreeGetParent(fpixa, level, x, y, pval) as int
        // quadtreeGetParent(FPIXA *, l_int32, l_int32, l_int32, l_float32 *) as l_ok
        ///  <summary>
        /// (1) Check return value for error.  On error, val is returned as 0.0.<para/>
        ///
        /// (2) The parent is located at:
        /// level - 1
        /// (x/2, y/2)
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/quadtreeGetParent/*"/>
        ///  <param name="fpixa">[in] - mean, variance or root variance</param>
        ///  <param name="level">[in] - x, y of current pixel</param>
        ///  <param name="pval">[out] - parent pixel value, or 0.0 on error</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int quadtreeGetParent(
            FPixa fpixa,
            int level,
            int x,
            int y,
            out Single pval)
        {
            if (fpixa == null)
            {
                throw new ArgumentNullException("fpixa cannot be Nothing");
            }

            int _Result = Natives.quadtreeGetParent(fpixa.Pointer, level, x, y, out pval);

            return(_Result);
        }
Пример #3
0
        // quadtree.c (169, 1)
        // pixQuadtreeVariance(pixs, nlevels, pix_ma, dpix_msa, pfpixa_v, pfpixa_rv) as int
        // pixQuadtreeVariance(PIX *, l_int32, PIX *, DPIX *, FPIXA **, FPIXA **) as l_ok
        ///  <summary>
        /// (1) The returned fpixav and fpixarv have %nlevels of fpix,
        /// each containing at the respective levels the variance
        /// and root variance values.
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/pixQuadtreeVariance/*"/>
        ///  <param name="pixs">[in] - 8 bpp, no colormap</param>
        ///  <param name="nlevels">[in] - in quadtree</param>
        ///  <param name="pix_ma">[in] - input mean accumulator can be null</param>
        ///  <param name="dpix_msa">[in] - input mean square accumulator can be null</param>
        ///  <param name="pfpixa_v">[out][optional] - variance values in quadtree</param>
        ///  <param name="pfpixa_rv">[out][optional] - root variance values in quadtree</param>
        ///   <returns>0 if OK, 1 on error</returns>
        public static int pixQuadtreeVariance(
            Pix pixs,
            int nlevels,
            Pix pix_ma,
            DPix dpix_msa,
            out FPixa pfpixa_v,
            out FPixa pfpixa_rv)
        {
            if (pixs == null)
            {
                throw new ArgumentNullException("pixs cannot be Nothing");
            }

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

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

            IntPtr pfpixa_vPtr  = IntPtr.Zero;
            IntPtr pfpixa_rvPtr = IntPtr.Zero;
            int    _Result      = Natives.pixQuadtreeVariance(pixs.Pointer, nlevels, pix_ma.Pointer, dpix_msa.Pointer, out pfpixa_vPtr, out pfpixa_rvPtr);

            if (pfpixa_vPtr == IntPtr.Zero)
            {
                pfpixa_v = null;
            }
            else
            {
                pfpixa_v = new FPixa(pfpixa_vPtr);
            };
            if (pfpixa_rvPtr == IntPtr.Zero)
            {
                pfpixa_rv = null;
            }
            else
            {
                pfpixa_rv = new FPixa(pfpixa_rvPtr);
            };

            return(_Result);
        }
Пример #4
0
        // quadtree.c (654, 1)
        // fpixaDisplayQuadtree(fpixa, factor, fontsize) as Pix
        // fpixaDisplayQuadtree(FPIXA *, l_int32, l_int32) as PIX *
        ///  <summary>
        /// (1) The mean and root variance fall naturally in the 8 bpp range,
        /// but the variance is typically outside the range.  This
        /// function displays 8 bpp pix clipped to 255, so the image
        /// pixels will mostly be 255 (white).
        ///  </summary>
        ///  <remarks>
        ///  </remarks>
        ///  <include file="..\CHM_Help\IncludeComments.xml" path="Comments/fpixaDisplayQuadtree/*"/>
        ///  <param name="fpixa">[in] - mean, variance or root variance</param>
        ///  <param name="factor">[in] - replication factor at lowest level</param>
        ///  <param name="fontsize">[in] - 4, ... 20</param>
        ///   <returns>pixd 8 bpp, mosaic of quadtree images, or NULL on error</returns>
        public static Pix fpixaDisplayQuadtree(
            FPixa fpixa,
            int factor,
            int fontsize)
        {
            if (fpixa == null)
            {
                throw new ArgumentNullException("fpixa cannot be Nothing");
            }

            IntPtr _Result = Natives.fpixaDisplayQuadtree(fpixa.Pointer, factor, fontsize);

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

            return(new Pix(_Result));
        }