本文整理汇总了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);
}
}
}
示例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);
}
}
}