- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is a bit of an XY problem. As a a start ippiGetAffineQuad seems to give a strange answer. In the following code an identity matrix (see coeffs2) is applied to a rect2:
void TestGetAffineQuad()
{
constexpr IppiRect rect2 = {0,0,3,3};
double quad[4][2] = {};
constexpr double coeffs2[2][3]={{1,0,0},{0,1,0}};
IppStatus st = ippiGetAffineQuad(rect2, quad, coeffs2);
}The quad answer is {(0, 0), (2,0), (2,2), (0,2)} but I expected to be with coordinates 3 (i.e. {(0,0), (3,0), (3,3), (0,3)}) since width and height is 3. If the rect has dimension 5 it comes back with 4 in the quad. We use IPP 2022.3.0 which is part of the latest oneAPI 2025.3 download.
Can anyone help?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
The behavior you’re seeing is due to how IppiRect defines width and height. In IPP, IppiRect uses exclusive coordinates: the rectangle spans from (x, y) up to but not including (x+width, y+height). So a rect {0,0,3,3} actually covers pixels (0,0) through (2,2), giving you a 3×3 region but with maximum coordinates at 2. That’s why ippiGetAffineQuad returns (0,0), (2,0), (2,2), (0,2) instead of (3,3).
If you want the quad to reach (3,3), you’d need to define the rect as {0,0,4,4}. In short: IPP rectangles are half-open intervals, so the “width” and “height” are counts, not max coordinates.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello
The behavior you’re seeing is due to how IppiRect defines width and height. In IPP, IppiRect uses exclusive coordinates: the rectangle spans from (x, y) up to but not including (x+width, y+height). So a rect {0,0,3,3} actually covers pixels (0,0) through (2,2), giving you a 3×3 region but with maximum coordinates at 2. That’s why ippiGetAffineQuad returns (0,0), (2,0), (2,2), (0,2) instead of (3,3).
If you want the quad to reach (3,3), you’d need to define the rect as {0,0,4,4}. In short: IPP rectangles are half-open intervals, so the “width” and “height” are counts, not max coordinates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thx, I never thought of that myself. The quad and coeffs are in double coordinates so that put me on the wrong track assuming the same behavior for a rectangle.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
...not sure if it is solved btw since it seems that ippiGetAffineTransform does include the border. Consider the following example:
void f()
{
static constexpr IppiRect rect2 = { 1, 1, 5, 5 };
static constexpr double dstQuad2[4][2] =
{{1.0, 1.0},
{5.0, 1.0},
{5.0, 5.0},
{1.0, 5.0}};
double coeffs[2][3] = {};
IppStatus st = ippiGetAffineTransform(rect2, dstQuad2, coeffs);
}This gives the identity matrix which suggest that here the borders are inclusive.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
N.v.m.; can't edit / delete my own post. In my last example it's also exclusive border; 1 + width = 1 + 4 = 5 coordinate.
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page