I’m banging my head against the wall with the OnvifObject transformation. How can I translate and scale my bounding box to fit the image size? Or convert a Rectangle to X, Y, Width and Height.
Transformation transformation = new Transformation()
{
Translate = new Vector()
{
X = -1,
Y = -1
},
Scale = new Vector()
{
X = 2f / imgWidth,
Y = 2f / imgHeight
}
};
BoundingBox = new Rectangle()
{
Left = rect.X,
Right = rect.X + rect.Width,
Bottom = imgHeight - rect.Y,
Top = imgHeight - rect.Y - rect.Height
};
For some reason the Y axis in the translate vector is not behaving as the X axis. I need to subtract the Y as opposed to the X where I can just add.