本文整理汇总了C#中UnmanagedImage.Collect8bppPixelValues方法的典型用法代码示例。如果您正苦于以下问题:C# UnmanagedImage.Collect8bppPixelValues方法的具体用法?C# UnmanagedImage.Collect8bppPixelValues怎么用?C# UnmanagedImage.Collect8bppPixelValues使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnmanagedImage
的用法示例。
在下文中一共展示了UnmanagedImage.Collect8bppPixelValues方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Process
//.........这里部分代码省略.........
{
List<IntPoint> edgePoints = blobCounter.GetBlobsEdgePoints(blobs[i]);
List<IntPoint> corners = PointsCloud.FindQuadrilateralCorners(edgePoints);
System.Drawing.Point[] crn = new System.Drawing.Point[4];
for (int jj = 0; jj < corners.Count; jj++)
{
crn[jj] = new System.Drawing.Point(corners[jj].X, corners[jj].Y);
}
SimpleShapeChecker shapeChecker = new SimpleShapeChecker();
if (shapeChecker.IsQuadrilateral(edgePoints))
{
List<IntPoint> leftEdgePoints, rightEdgePoints;
blobCounter.GetBlobsLeftAndRightEdges(blobs[i], out leftEdgePoints, out rightEdgePoints);
List<IntPoint> leftEdgePoints1 = new List<IntPoint>();
List<IntPoint> leftEdgePoints2 = new List<IntPoint>();
List<IntPoint> rightEdgePoints1 = new List<IntPoint>();
List<IntPoint> rightEdgePoints2 = new List<IntPoint>();
int tx1, tx2, ty;
int widthM1 = uimage.Width - 1;
for (int k = 0; k < leftEdgePoints.Count; k++)
{
tx1 = leftEdgePoints[k].X - stepSize;
tx2 = leftEdgePoints[k].X + stepSize;
ty = leftEdgePoints[k].Y;
leftEdgePoints1.Add(new IntPoint((tx1 < 0) ? 0 : tx1, ty));
leftEdgePoints2.Add(new IntPoint((tx2 > widthM1) ? widthM1 : tx2, ty));
tx1 = rightEdgePoints[k].X - stepSize;
tx2 = rightEdgePoints[k].X + stepSize;
ty = rightEdgePoints[k].Y;
rightEdgePoints1.Add(new IntPoint((tx1 < 0) ? 0 : tx1, ty));
rightEdgePoints2.Add(new IntPoint((tx2 > widthM1) ? widthM1 : tx2, ty));
}
byte[] leftValues1 = uimage.Collect8bppPixelValues(leftEdgePoints1);
byte[] leftValues2 = uimage.Collect8bppPixelValues(leftEdgePoints2);
byte[] rightValues1 = uimage.Collect8bppPixelValues(rightEdgePoints1);
byte[] rightValues2 = uimage.Collect8bppPixelValues(rightEdgePoints2);
float diff = 0;
int pixelCount = 0;
for (int k = 0; k < leftEdgePoints.Count; k++)
{
if (rightEdgePoints[k].X - leftEdgePoints[k].X > stepSize * 2)
{
diff += (leftValues1[k] - leftValues2[k]);
diff += (rightValues2[k] - rightValues1[k]);
pixelCount += 2;
}
}
float diferenca = diff / pixelCount;
if (diferenca > 120)
{
if (blobs[i].Area > 225)
{
g.DrawPolygon(greenPen, crn);
laterais[numero_codigo] = new Blob(blobs[i]);
numero_codigo++;
if (numero_codigo > 1)
{
if (laterais[0].CenterOfGravity.X > laterais[1].CenterOfGravity.X)
{
ordenado[0] = laterais[1];
ordenado[1] = laterais[0];
}
else
{