本文整理汇总了C#中Seq类的典型用法代码示例。如果您正苦于以下问题:C# Seq类的具体用法?C# Seq怎么用?C# Seq使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Seq类属于命名空间,在下文中一共展示了Seq类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Emit
public void Emit()
{
if (Trace.Flavor == TraceFlavor.Remainder)
{
foreach (var kv in Trace.AssemblyMap)
{
var compiler = new AssemblyCompiler(this, kv.Value);
compiler.Emit(null);
}
}
else
{
var rootEnv = Env.Global.Environment();
var body = new Seq<JST.Statement>();
body.Add(JST.Statement.Var(RootId, new JST.Identifier(Env.Root).ToE()));
foreach (var nm in rootEnv.AllLoadedAssembliesInLoadOrder().Where(Trace.AssemblyMap.ContainsKey))
{
var compiler = new AssemblyCompiler(this, Trace.AssemblyMap[nm]);
compiler.Emit(body);
}
var program = new JST.Program
(new JST.Statements
(new JST.ExpressionStatement
(new JST.StatementsPseudoExpression(new JST.Statements(body), null))));
var fileName = Path.Combine(Env.OutputDirectory, Trace.Name + ".js");
program.ToFile(fileName, Env.PrettyPrint);
Env.Log(new GeneratedJavaScriptFile("trace '" + Trace.Name + "'", fileName));
}
}
开发者ID:modulexcite,项目名称:IL2JS,代码行数:29,代码来源:TraceCompiler.cs
示例2: HOGDescriptor
/// <summary>
/// Create a new HOGDescriptor using the specific parameters
/// </summary>
public HOGDescriptor(
Size winSize,
Size blockSize,
Size blockStride,
Size cellSize,
int nbins,
int derivAperture,
double winSigma,
double L2HysThreshold,
bool gammaCorrection)
{
_ptr = CvHOGDescriptorCreate(
ref winSize,
ref blockSize,
ref blockStride,
ref cellSize,
nbins,
derivAperture,
winSigma,
0,
L2HysThreshold,
gammaCorrection);
_rectStorage = new MemStorage();
_rectSeq = new Seq<Rectangle>(_rectStorage);
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:29,代码来源:HOGDescriptor.cs
示例3: BuildTypeExpression
// Complete a first-kinded type structure. If type definition is higher kinded, this will
// complete an instance of the type at the type arguments. Otherwise, this will complete
// the type definition itself.
private void BuildTypeExpression(Seq<JST.Statement> body, JST.Expression lhs)
{
TypeCompEnv.BindUsage(body, CollectPhase1Usage(), TypePhase.Id);
// TODO: Replace with prototype
body.Add(JST.Statement.DotCall(RootId.ToE(), Constants.RootSetupTypeDefaults, TypeId.ToE()));
EmitBaseAndSupertypes(body, lhs);
EmitDefaultConstructor(body, lhs);
EmitMemberwiseClone(body, lhs);
EmitClone(body, lhs);
EmitDefaultValue(body, lhs);
EmitStaticMethods(body, lhs);
EmitConstructObjectAndInstanceMethods(body, lhs);
EmitVirtualAndInterfaceMethodRedirectors(body, lhs);
EmitSetupType(body, lhs);
EmitUnbox(body, lhs);
EmitBox(body, lhs);
EmitUnboxAny(body, lhs);
EmitConditionalDeref(body, lhs);
EmitIsValue(body, lhs);
EmitEquals(body, lhs);
EmitHash(body, lhs);
EmitInterop(body, lhs);
}
开发者ID:modulexcite,项目名称:IL2JS,代码行数:28,代码来源:TypeCompiler.cs
示例4: GpuHOGDescriptor
/// <summary>
/// Create a new HOGDescriptor using the specific parameters
/// </summary>
/// <param name="blockSize">Block size in cells. Only (2,2) is supported for now.</param>
/// <param name="cellSize">Cell size. Only (8, 8) is supported for now.</param>
/// <param name="blockStride">Block stride. Must be a multiple of cell size.</param>
/// <param name="gammaCorrection">Do gamma correction preprocessing or not.</param>
/// <param name="L2HysThreshold">L2-Hys normalization method shrinkage.</param>
/// <param name="nbins">Number of bins. Only 9 bins per cell is supported for now.</param>
/// <param name="nLevels">Maximum number of detection window increases.</param>
/// <param name="winSigma">Gaussian smoothing window parameter.</param>
/// <param name="winSize">Detection window size. Must be aligned to block size and block stride.</param>
public GpuHOGDescriptor(
Size winSize,
Size blockSize,
Size blockStride,
Size cellSize,
int nbins,
double winSigma,
double L2HysThreshold,
bool gammaCorrection,
int nLevels)
{
_ptr = gpuHOGDescriptorCreate(
ref winSize,
ref blockSize,
ref blockStride,
ref cellSize,
nbins,
winSigma,
L2HysThreshold,
gammaCorrection,
nLevels);
_rectStorage = new MemStorage();
_rectSeq = new Seq<Rectangle>(_rectStorage);
}
开发者ID:genecyber,项目名称:PredatorCV,代码行数:37,代码来源:GpuHOGDescriptor.cs
示例5: HOGDescriptor
/// <summary>
/// Create a new HOGDescriptor
/// </summary>
public HOGDescriptor()
{
_ptr = CvHOGDescriptorCreateDefault();
_rectStorage = new MemStorage();
_rectSeq = new Seq<Rectangle>(_rectStorage);
_vector = new VectorOfFloat();
}
开发者ID:Rustemt,项目名称:emgu_openCV,代码行数:10,代码来源:HOGDescriptor.cs
示例6: GetDefaultPeopleDetector
/// <summary>
/// Return the default people detector
/// </summary>
/// <returns>the default people detector</returns>
public static float[] GetDefaultPeopleDetector()
{
using (MemStorage stor = new MemStorage())
{
Seq<float> desc = new Seq<float>(stor);
CvHOGDescriptorPeopleDetectorCreate(desc);
return desc.ToArray();
}
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:13,代码来源:HOGDescriptor.cs
示例7: DetectKeyPoints
/// <summary>
/// Detect STAR key points from the image
/// </summary>
/// <param name="image">The image to extract key points from</param>
/// <returns>The STAR key points of the image</returns>
public MKeyPoint[] DetectKeyPoints(Image<Gray, Byte> image)
{
using (MemStorage stor = new MemStorage())
{
Seq<MKeyPoint> seq = new Seq<MKeyPoint>(stor);
CvStarDetectorDetectKeyPoints(ref this, image, seq.Ptr);
return seq.ToArray();
}
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:14,代码来源:StarDetector.cs
示例8: HoughLineTransform
/// <summary>
/// Hough Line Transform, as in OpenCV (EmguCv does not wrap this function as it should be)
/// </summary>
/// <param name="img">Binary image</param>
/// <param name="type">type of hough transform</param>
/// <param name="threshold">how many votes is needed to accept line</param>
/// <returns>Lines in theta/rho format</returns>
public static PointF[] HoughLineTransform(Image<Gray, byte> img, Emgu.CV.CvEnum.HOUGH_TYPE type, int threshold)
{
using (MemStorage stor = new MemStorage())
{
IntPtr linePtr = CvInvoke.cvHoughLines2(img, stor.Ptr, type, 5, Math.PI / 180 * 15, threshold, 0, 0);
Seq<PointF> seq = new Seq<PointF>(linePtr, stor);
return seq.ToArray(); ;
}
}
开发者ID:rAum,项目名称:auton_net,代码行数:16,代码来源:VisionToolkit.cs
示例9: GetModelPoints
/// <summary>
/// Get the model points stored in this detector
/// </summary>
/// <returns>The model points stored in this detector</returns>
public MKeyPoint[] GetModelPoints()
{
using (MemStorage stor = new MemStorage())
{
Seq<MKeyPoint> modelPoints = new Seq<MKeyPoint>(stor);
CvPlanarObjectDetectorGetModelPoints(_ptr, modelPoints);
return modelPoints.ToArray();
}
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:13,代码来源:PlanarObjectDetector.cs
示例10: Detect
/// <summary>
/// Detect planar object from the specific image
/// </summary>
/// <param name="image">The image where the planar object will be detected</param>
/// <param name="h">The homography matrix which will be updated</param>
/// <returns>The four corners of the detected region</returns>
public PointF[] Detect(Image<Gray, Byte> image, HomographyMatrix h)
{
using (MemStorage stor = new MemStorage())
{
Seq<PointF> corners = new Seq<PointF>(stor);
CvPlanarObjectDetectorDetect(_ptr, image, h, corners);
return corners.ToArray();
}
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:15,代码来源:PlanarObjectDetector.cs
示例11: DetectKeyPoints
/// <summary>
/// Detect the Fast keypoints from the image
/// </summary>
/// <param name="image">The image to extract keypoints from</param>
/// <returns>The array of fast keypoints</returns>
public MKeyPoint[] DetectKeyPoints(Image<Gray, byte> image)
{
using (MemStorage stor = new MemStorage())
{
Seq<MKeyPoint> keypoints = new Seq<MKeyPoint>(stor);
CvInvoke.CvFASTKeyPoints(image, keypoints, Threshold, NonmaxSupression);
return keypoints.ToArray();
}
}
开发者ID:Rustemt,项目名称:emgu_openCV,代码行数:14,代码来源:FastDetector.cs
示例12: DetectKeyPoints
/// <summary>
/// Detect the Lepetit keypoints from the image
/// </summary>
/// <param name="image">The image to extract Lepetit keypoints</param>
/// <param name="maxCount">The maximum number of keypoints to be extracted</param>
/// <param name="scaleCoords">Indicates if the coordinates should be scaled</param>
/// <returns>The array of Lepetit keypoints</returns>
public MKeyPoint[] DetectKeyPoints(Image<Gray, Byte> image, int maxCount, bool scaleCoords)
{
using (MemStorage stor = new MemStorage())
{
Seq<MKeyPoint> seq = new Seq<MKeyPoint>(stor);
CvLDetectorDetectKeyPoints(ref this, image, seq.Ptr, maxCount, scaleCoords);
return seq.ToArray();
}
}
开发者ID:samuto,项目名称:UnityOpenCV,代码行数:16,代码来源:LDetector.cs
示例13: DetectMultiScale
/// <summary>
/// Finds rectangular regions in the given image that are likely to contain objects the cascade has been trained for and returns those regions as a sequence of rectangles.
/// The function scans the image several times at different scales. Each time it considers overlapping regions in the image.
/// It may also apply some heuristics to reduce number of analyzed regions, such as Canny prunning.
/// After it has proceeded and collected the candidate rectangles (regions that passed the classifier cascade), it groups them and returns a sequence of average rectangles for each large enough group.
/// </summary>
/// <param name="image">The image where the objects are to be detected from</param>
/// <param name="scaleFactor">The factor by which the search window is scaled between the subsequent scans, for example, 1.1 means increasing window by 10%</param>
/// <param name="minNeighbors">Minimum number (minus 1) of neighbor rectangles that makes up an object. All the groups of a smaller number of rectangles than min_neighbors-1 are rejected. If min_neighbors is 0, the function does not any grouping at all and returns all the detected candidate rectangles, which may be useful if the user wants to apply a customized grouping procedure</param>
/// <param name="minSize">Minimum window size. Use Size.Empty for default, where it is set to the size of samples the classifier has been trained on (~20x20 for face detection)</param>
/// <param name="maxSize">Maxumum window size. Use Size.Empty for default, where the parameter will be ignored.</param>
/// <returns>The objects detected, one array per channel</returns>
public Rectangle[] DetectMultiScale(Image<Gray, Byte> image, double scaleFactor, int minNeighbors, Size minSize, Size maxSize)
{
using (MemStorage stor = new MemStorage())
{
Seq<Rectangle> rectangles = new Seq<Rectangle>(stor);
CvInvoke.CvCascadeClassifierDetectMultiScale(_ptr, image, rectangles, scaleFactor, minNeighbors, 0, minSize, maxSize);
return rectangles.ToArray();
}
}
开发者ID:fajoy,项目名称:RTSPExample,代码行数:22,代码来源:CascadeClassifier.cs
示例14: Detect
/// <summary>
/// Find rectangular regions in the given image that are likely to contain objects and corresponding confidence levels
/// </summary>
/// <param name="image">The image to detect objects in</param>
/// <param name="overlapThreshold">Threshold for the non-maximum suppression algorithm, Use default value of 0.5</param>
/// <returns>Array of detected objects</returns>
public MCvObjectDetection[] Detect(Image<Bgr, Byte> image, float overlapThreshold)
{
using (MemStorage stor = new MemStorage())
{
IntPtr seqPtr = CvInvoke.cvLatentSvmDetectObjects(image, Ptr, stor, overlapThreshold, -1);
if (seqPtr == IntPtr.Zero)
return new MCvObjectDetection[0];
Seq<MCvObjectDetection> seq = new Seq<MCvObjectDetection>(seqPtr, stor);
return seq.ToArray();
}
}
开发者ID:wendellinfinity,项目名称:ShoulderSurferAlert,代码行数:17,代码来源:LatentSvmDetector.cs
示例15: ConvexHull
/// <summary>
/// Finds convex hull of 2D point set using Sklansky's algorithm
/// </summary>
/// <param name="points">The points to find convex hull from</param>
/// <param name="storage">the storage used by the resulting sequence</param>
/// <param name="orientation">The orientation of the convex hull</param>
/// <returns>The convex hull of the points</returns>
public static Seq<PointF> ConvexHull(PointF[] points, MemStorage storage, CvEnum.ORIENTATION orientation)
{
IntPtr seq = Marshal.AllocHGlobal(StructSize.MCvSeq);
IntPtr block = Marshal.AllocHGlobal(StructSize.MCvSeqBlock);
GCHandle handle = GCHandle.Alloc(points, GCHandleType.Pinned);
CvInvoke.cvMakeSeqHeaderForArray(
CvInvoke.CV_MAKETYPE((int)CvEnum.MAT_DEPTH.CV_32F, 2),
StructSize.MCvSeq,
StructSize.PointF,
handle.AddrOfPinnedObject(),
points.Length,
seq,
block);
Seq<PointF> convexHull = new Seq<PointF>(CvInvoke.cvConvexHull2(seq, storage.Ptr, orientation, 1), storage);
handle.Free();
Marshal.FreeHGlobal(seq);
Marshal.FreeHGlobal(block);
return convexHull;
}
开发者ID:wendellinfinity,项目名称:ShoulderSurferAlert,代码行数:27,代码来源:PointCollection.cs
示例16: Detect
/// <summary>
/// Finds rectangular regions in the given image that are likely to contain objects the cascade has been trained for and returns those regions as a sequence of rectangles.
/// The function scans the image several times at different scales (see cvSetImagesForHaarClassifierCascade). Each time it considers overlapping regions in the image and applies the classifiers to the regions using cvRunHaarClassifierCascade.
/// It may also apply some heuristics to reduce number of analyzed regions, such as Canny prunning.
/// After it has proceeded and collected the candidate rectangles (regions that passed the classifier cascade), it groups them and returns a sequence of average rectangles for each large enough group.
/// The default parameters (scale_factor=1.1, min_neighbors=3, flags=0) are tuned for accurate yet slow object detection.
/// For a faster operation on real video images the settings are: scale_factor=1.2, min_neighbors=2, flags=CV_HAAR_DO_CANNY_PRUNING, min_size=<minimum possible face size>
/// (for example, ~1/4 to 1/16 of the image area in case of video conferencing).
/// </summary>
/// <param name="image">The image where the objects are to be detected from</param>
/// <param name="scaleFactor">The factor by which the search window is scaled between the subsequent scans, for example, 1.1 means increasing window by 10%</param>
/// <param name="minNeighbors">Minimum number (minus 1) of neighbor rectangles that makes up an object. All the groups of a smaller number of rectangles than min_neighbors-1 are rejected. If min_neighbors is 0, the function does not any grouping at all and returns all the detected candidate rectangles, which may be useful if the user wants to apply a customized grouping procedure</param>
/// <param name="flag">Mode of operation. Currently the only flag that may be specified is CV_HAAR_DO_CANNY_PRUNING. If it is set, the function uses Canny edge detector to reject some image regions that contain too few or too much edges and thus can not contain the searched object. The particular threshold values are tuned for face detection and in this case the pruning speeds up the processing.</param>
/// <param name="minSize">Minimum window size. By default, it is set to the size of samples the classifier has been trained on (~20x20 for face detection)</param>
/// <returns>The objects detected, one array per channel</returns>
public MCvAvgComp[] Detect(Image<Gray, Byte> image, double scaleFactor, int minNeighbors, CvEnum.HAAR_DETECTION_TYPE flag, Size minSize)
{
using (MemStorage stor = new MemStorage())
{
IntPtr objects = CvInvoke.cvHaarDetectObjects(
image.Ptr,
Ptr,
stor.Ptr,
scaleFactor,
minNeighbors,
flag,
minSize);
if (objects == IntPtr.Zero)
return new MCvAvgComp[0];
Seq<MCvAvgComp> rects = new Seq<MCvAvgComp>(objects, stor);
return rects.ToArray();
}
}
开发者ID:wendellinfinity,项目名称:ShoulderSurferAlert,代码行数:35,代码来源:HaarCascade.cs
示例17: insertPoints
/// <summary>
/// Inserts numP points into the polygon
/// </summary>
/// <param name="poly">Eequence of points representing the polygon border</param>
/// <param name="numP">Number of points to insert</param>
void insertPoints(ref Seq<Point> poly, ref PolyFromTris triPoly, int numP, int iw, int ih)
{
///////////////////////////////////////////// TODO: FIX !!!!!!
Seq<PointF> testsek = new Seq<PointF>(new MemStorage());
foreach (Point p in poly)
{
testsek.Insert(testsek.Total, new PointF((float)p.X, (float)p.Y));
}
Rectangle rect = testsek.BoundingRectangle;
////////////////////////////////////////
//
// Calculate BoundingBox to narrow random-inserting points area
// Rectangle rect = poly.BoundingRectangle;
int maxIter = numP*500;
while (numP > 0) // We want inside numP random points
{
if (maxIter-- <= 0) break;
// Generate point inside BBox
Point p = new Point(random.Next(rect.X, rect.X + rect.Width), random.Next(rect.Y, rect.Y+rect.Height));
if (p.X > iw || p.Y > ih || p.Y < 0 || p.X<0) continue;
if (poly.InContour(p) > 0) // If point is on the poly
{
triPoly.addInnerPoint(new PointF((float)p.X, (float)p.Y));
poly.Insert(poly.Total, p); // Insert it to our list
numP--;
}
}
}
开发者ID:aljosaosep,项目名称:holdrecognition,代码行数:44,代码来源:HoldTriangulation.cs
示例18: triangulatePoly
/// <summary>
/// Function inserts points into poly (numInsert points) and triangulates while set of points.
/// Result is lsit of triangles representing the poly.
/// </summary>
/// <param name="poly">Seq. of points representing the poly</param>
/// <param name="numInsert">Number of points to insert into poly</param>
/// <returns>Triangle's list</returns>
public /*Triangle2DF[]*/ PolyFromTris triangulatePoly(Seq<Point> poly, int numInsert, int iw, int ih)
{
//Triangle2DF[] trisList; // Triangles list
PolyFromTris trisPoly = new PolyFromTris();
if (poly.Total + numInsert <= 24)
{
insertPoints(ref poly, ref trisPoly, numInsert, iw, ih); // Insert random points into the poly
}
//Array.ConvertAll(convexHull.ToArray(), new Converter<Point, PointF>(PointToPointF));
using (PlanarSubdivision subdiv = new PlanarSubdivision(Array.ConvertAll(poly.ToArray(), new Converter<Point, PointF>(PointToPointF)))) //(poly.ToArray()))
{
Console.WriteLine(" ply size: " + poly.Total.ToString());
//trisList = subdiv.GetDelaunayTriangles(); // Do triangulation
trisPoly.setTris(subdiv.GetDelaunayTriangles());
}
return trisPoly;
}
开发者ID:aljosaosep,项目名称:holdrecognition,代码行数:30,代码来源:HoldTriangulation.cs
示例19: CallContext
public CallContext(CompilationEnvironment outerCompEnv, CompilationEnvironment inlinedCompEnv, IImSeq<Expression> arguments)
{
var paramMap = new Map<JST.Identifier, int>();
for (var i = 0; i < inlinedCompEnv.Method.Arity; i++)
paramMap.Add(inlinedCompEnv.ValueParameterIds[i], i);
Parameters = paramMap;
var argumentEffects = new Seq<JST.Effects>(inlinedCompEnv.Method.Arity);
SeenParameters = new Seq<bool?>(inlinedCompEnv.Method.Arity);
AllArgumentEffects = JST.Effects.Bottom;
var allReadOnly = true;
foreach (var e in arguments)
{
var fxCtxt = new JST.EffectsContext(null);
e.AccumEffects(fxCtxt, null, null);
argumentEffects.Add(fxCtxt.AccumEffects);
AllArgumentEffects = AllArgumentEffects.Lub(fxCtxt.AccumEffects);
if (!fxCtxt.AccumEffects.IsReadOnly)
allReadOnly = false;
SeenParameters.Add(e.IsValue(outerCompEnv) ? default(bool?) : false);
}
ArgumentEffects = argumentEffects;
AllReadOnly = allReadOnly;
IsOk = true;
}
开发者ID:modulexcite,项目名称:IL2JS,代码行数:24,代码来源:CallContext.cs
示例20: Visit
public override void Visit(Seq pred)
{
foreach (var p in pred.List)
Visit(p);
}
开发者ID:qwertie,项目名称:ecsharp,代码行数:5,代码来源:GenerateCodeVisitor.cs
注:本文中的Seq类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论