예제 #1
0
        public static CvMat CvGetSubRect(ref CvMat arr, ref CvMat submat, CvRect rect)
        {
            IntPtr p = cvGetSubRect(ref arr, ref submat, rect);
            CvMat  i = (CvMat)Marshal.PtrToStructure(p, typeof(CvMat));

            i.ptr = p;
            return(i);
        }
예제 #2
0
        private static void RoiParam(IplImage img, out int start, out int rows, out int elementCount, out int byteWidth, out int widthStep)
        {
            start     = img.imageData.ToInt32();
            widthStep = img.widthStep;

            if (img.roi != IntPtr.Zero)
            {
                CvRect rec = NativeMethods.CvGetImageROI(ref img);
                elementCount = rec.width * img.nChannels;
                byteWidth    = (img.depth >> 3) * elementCount;

                start += rec.y * widthStep + (img.depth >> 3) * rec.x;
                rows   = rec.height;
            }
            else
            {
                byteWidth    = widthStep;
                elementCount = img.width * img.nChannels;
                rows         = img.height;
            }
        }
예제 #3
0
 private static extern IntPtr cvGetSubRect(ref CvMat arr, ref CvMat submat, CvRect rect);