本文整理汇总了C#中OpenCvSharp.IplImage.ReleaseData方法的典型用法代码示例。如果您正苦于以下问题:C# IplImage.ReleaseData方法的具体用法?C# IplImage.ReleaseData怎么用?C# IplImage.ReleaseData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类OpenCvSharp.IplImage
的用法示例。
在下文中一共展示了IplImage.ReleaseData方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: tmpDrawBoxes
private void tmpDrawBoxes(ref IplImage gimg)
{
IplImage img8uc3 = new IplImage(gimg.Size, BitDepth.U8, 3);
Cv.CvtColor(gimg, img8uc3, ColorConversion.GrayToBgr);
int count = TargetList.Count;
for (int i = 0; i < count; i++)
{
sMarkerInfo s = new sMarkerInfo();
s = (sMarkerInfo)TargetList[i];
Cv.DrawLine(img8uc3, new CvPoint((int)s.corner[0].X, (int)s.corner[0].Y), new CvPoint((int)s.corner[1].X, (int)s.corner[1].Y), Cv.RGB(255, 0, 0), 10);
Cv.DrawLine(img8uc3, new CvPoint((int)s.corner[1].X, (int)s.corner[1].Y), new CvPoint((int)s.corner[2].X, (int)s.corner[2].Y), Cv.RGB(255, 0, 0), 10);
Cv.DrawLine(img8uc3, new CvPoint((int)s.corner[2].X, (int)s.corner[2].Y), new CvPoint((int)s.corner[3].X, (int)s.corner[3].Y), Cv.RGB(255, 0, 0), 10);
Cv.DrawLine(img8uc3, new CvPoint((int)s.corner[0].X, (int)s.corner[0].Y), new CvPoint((int)s.corner[3].X, (int)s.corner[3].Y), Cv.RGB(255, 0, 0), 10);
}
IplImage timg = new IplImage(new CvSize(800, 600), BitDepth.U8, 3);
Cv.Resize(img8uc3, timg);
Cv.ShowImage("contours", timg);
img8uc3.ReleaseData();
timg.ReleaseData();
/*
if (contours != null)
{
Cv.DrawContours(img8uc3, contours, Cv.RGB(250, 0, 0), Cv.RGB(0, 0, 250), 1, 2, LineType.Link8);
}
IplImage timg = new IplImage(new CvSize(800, 600), BitDepth.U8, 3);
Cv.Resize(img8uc3, timg);
Cv.ShowImage("contours", timg);
img8uc3.ReleaseData();
timg.ReleaseData();
* */
}
示例2: tmpDrawContour
private void tmpDrawContour(ref IplImage gimg, ref CvSeq<CvPoint> contours)
{
IplImage img8uc3 = new IplImage(gimg.Size, BitDepth.U8, 3);
Cv.CvtColor(gimg, img8uc3, ColorConversion.GrayToBgr);
if (contours != null)
{
Cv.DrawContours(img8uc3, contours, Cv.RGB(250, 0, 0), Cv.RGB(0, 0, 250), 1, 2, LineType.Link8);
}
IplImage timg = new IplImage(new CvSize(800, 600), BitDepth.U8, 3);
Cv.Resize(img8uc3, timg);
Cv.ShowImage("contours", timg);
img8uc3.ReleaseData();
timg.ReleaseData();
}
示例3: MarkerRecog
public void MarkerRecog()
{
IplImage img_gray = new IplImage(imgSrc.Size, BitDepth.U8, 1);
IplImage img_bin = new IplImage(img_gray.Size, BitDepth.U8, 1);
Cv.CvtColor(imgSrc, img_gray, ColorConversion.BgrToGray);
//추가부분 히스토그램 평활화
Cv.EqualizeHist(img_gray, img_gray);
//컬러영상을 흑백영상으로
Cv.Copy(img_gray, img_bin);
//트래시홀드
Cv.AdaptiveThreshold(img_bin, img_bin, 255, AdaptiveThresholdType.MeanC, ThresholdType.BinaryInv, 11, 2);
//Cv.AdaptiveThreshold(img_bin, img_bin, 255, AdaptiveThresholdType.MeanC, ThresholdType.BinaryInv, 71, 45);
//Cv.AdaptiveThreshold(img_bin, img_bin, 255, AdaptiveThresholdType.MeanC, ThresholdType.BinaryInv, 301, 45);
//개발 참고부분 - 이진영상 보기
/*
IplImage timg = new IplImage(new CvSize(800, 600), BitDepth.U8, 1);
Cv.Resize(img_bin, timg);
Cv.ShowImage("binimg", timg);
timg.ReleaseData();
*/
CvMemStorage storage = new CvMemStorage(0);
CvMemStorage storage2 = new CvMemStorage(0);
storage.Clear();
CvSeq<CvPoint> contours;
CvSeq<CvPoint> approxcontours;
int ncontours = Cv.FindContours(img_bin, storage, out contours, CvContour.SizeOf, ContourRetrieval.Tree, ContourChain.ApproxSimple);
TargetList.Clear();
try
{
if (ncontours > 0)
{
//검출된 contours 단순화하기
approxcontours = Cv.ApproxPoly(contours, CvContour.SizeOf, storage2, ApproxPolyMethod.DP, 1.0, true);
//개발자 참고용
//tmpDrawContour(ref img_gray, ref approxcontours);
if (approxcontours != null)
{
FindMarkerInContour(ref approxcontours, ref storage2);
//tmpDrawBoxes(ref img_gray);
GetMarkerCode(ref img_gray);
contours.ClearSeq();
approxcontours.ClearSeq();
}
}
}
catch (Exception ee)
{
string msg = ee.Message;
}
Cv.ReleaseMemStorage(storage);
Cv.ReleaseMemStorage(storage2);
//storage.Dispose();
img_gray.ReleaseData();
img_bin.ReleaseData();
}