I have a self-defined struct of a point (as opposed to System.Drawing.Point
):
struct PointD
{
public double X,Y;
}
I want to get a Seq
of points, and from there extract the minimum area rectangle:
using (MemStorage stor = new MemStorage())
{
Seq<PointD> seq = new Seq<PointD>(CvInvoke.CV_MAKETYPE(6, 2), stor);
seq.Push(new PointD(0.5, 0));
seq.Push(new PointD(1.0, 0));
seq.Push(new PointD(0, 1.0));
seq.Push(new PointD(1.0, 1.0));
var output = seq.GetMinAreaRect();
}
However, this code throws an exception at GetMinAreaRect()
, saying that the input sequence must be 2d points. My question is there a way to get my data format through correctly? I was thinking that I just lack a bit of something, as this code can work for a System.Drawing.Point
.
I assume following would work:
Additional example : http://www.emgu.com/wiki/index.php/Minimum_Area_Rectangle_in_CSharp