當前位置: 首頁>>代碼示例>>C#>>正文


C# IplImage.GetSize方法代碼示例

本文整理匯總了C#中OpenCvSharp.IplImage.GetSize方法的典型用法代碼示例。如果您正苦於以下問題:C# IplImage.GetSize方法的具體用法?C# IplImage.GetSize怎麽用?C# IplImage.GetSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在OpenCvSharp.IplImage的用法示例。


在下文中一共展示了IplImage.GetSize方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: CornerDetect

        public CornerDetect()
        {
            // cvGoodFeaturesToTrack, cvFindCornerSubPix
            // 畫像中のコーナー(特徴點)検出

            int cornerCount = 150;

            using (IplImage dstImg1 = new IplImage(Const.ImageLenna, LoadMode.AnyColor | LoadMode.AnyDepth))
            using (IplImage dstImg2 = dstImg1.Clone())
            using (IplImage srcImgGray = new IplImage(Const.ImageLenna, LoadMode.GrayScale))
            using (IplImage eigImg = new IplImage(srcImgGray.GetSize(), BitDepth.F32, 1))
            using (IplImage tempImg = new IplImage(srcImgGray.GetSize(), BitDepth.F32, 1))
            {
                CvPoint2D32f[] corners;
                // (1)cvCornerMinEigenValを利用したコーナー検出
                Cv.GoodFeaturesToTrack(srcImgGray, eigImg, tempImg, out corners, ref cornerCount, 0.1, 15);
                Cv.FindCornerSubPix(srcImgGray, corners, cornerCount, new CvSize(3, 3), new CvSize(-1, -1), new CvTermCriteria(20, 0.03));
                // (2)コーナーの描畫
                for (int i = 0; i < cornerCount; i++)
                    Cv.Circle(dstImg1, corners[i], 3, new CvColor(255, 0, 0), 2);
                // (3)cvCornerHarrisを利用したコーナー検出
                cornerCount = 150;
                Cv.GoodFeaturesToTrack(srcImgGray, eigImg, tempImg, out corners, ref cornerCount, 0.1, 15, null, 3, true, 0.01);
                Cv.FindCornerSubPix(srcImgGray, corners, cornerCount, new CvSize(3, 3), new CvSize(-1, -1), new CvTermCriteria(20, 0.03));
                // (4)コーナーの描畫
                for (int i = 0; i < cornerCount; i++)
                    Cv.Circle(dstImg2, corners[i], 3, new CvColor(0, 0, 255), 2);
                // (5)畫像の表示 
                using (new CvWindow("EigenVal", WindowMode.AutoSize, dstImg1)) 
                using (new CvWindow("Harris", WindowMode.AutoSize, dstImg2))
                {
                    Cv.WaitKey(0);
                }
            }
        }
開發者ID:qxp1011,項目名稱:opencvsharp,代碼行數:35,代碼來源:CornerDetect.cs

示例2: CornerDetect

        public CornerDetect()
        {
            int cornerCount = 150;

            using (IplImage dstImg1 = new IplImage(FilePath.Image.Lenna, LoadMode.AnyColor | LoadMode.AnyDepth))
            using (IplImage dstImg2 = dstImg1.Clone())
            using (IplImage srcImgGray = new IplImage(FilePath.Image.Lenna, LoadMode.GrayScale))
            using (IplImage eigImg = new IplImage(srcImgGray.GetSize(), BitDepth.F32, 1))
            using (IplImage tempImg = new IplImage(srcImgGray.GetSize(), BitDepth.F32, 1))
            {
                CvPoint2D32f[] corners;
                Cv.GoodFeaturesToTrack(srcImgGray, eigImg, tempImg, out corners, ref cornerCount, 0.1, 15);
                Cv.FindCornerSubPix(srcImgGray, corners, cornerCount, new CvSize(3, 3), new CvSize(-1, -1), new CvTermCriteria(20, 0.03));

                for (int i = 0; i < cornerCount; i++)
                    Cv.Circle(dstImg1, corners[i], 3, new CvColor(255, 0, 0), 2);

                cornerCount = 150;
                Cv.GoodFeaturesToTrack(srcImgGray, eigImg, tempImg, out corners, ref cornerCount, 0.1, 15, null, 3, true, 0.01);
                Cv.FindCornerSubPix(srcImgGray, corners, cornerCount, new CvSize(3, 3), new CvSize(-1, -1), new CvTermCriteria(20, 0.03));

                for (int i = 0; i < cornerCount; i++)
                    Cv.Circle(dstImg2, corners[i], 3, new CvColor(0, 0, 255), 2);

                using (new CvWindow("EigenVal", WindowMode.AutoSize, dstImg1)) 
                using (new CvWindow("Harris", WindowMode.AutoSize, dstImg2))
                {
                    Cv.WaitKey(0);
                }
            }
        }
開發者ID:0sv,項目名稱:opencvsharp,代碼行數:31,代碼來源:CornerDetect.cs


注:本文中的OpenCvSharp.IplImage.GetSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。