- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The example shown in the documentation for ippiFilterColumn is wrong for many reasons:
1.- the border is not being considered. As shown in the example, memory outside the allocated space will be read. This means also that the first and last rows of the destination image will not contain meaningful information.
2.- According to the result you are showing, yAnchor must be 1 and not 2.
3.- The example is terrible bad, because you are using 8u as data type but the kernel filter has a negative value.
4.- The result should be 0 everywhere, since you are using "Sobel" kernel and the data does not contain any "gradient" in vertical direction.
Something more appropriate will be:
______________________________________________
Ipp16s src[4*3] = {
1, 0, 0, 4,
0, 0, 3, 4,
0, 2, 3, 1
};
Ipp16s dst[4*3] =
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};
IppiSize srcRoi;
srcRoi.width = 4;
srcRoi.height = 1;
Ipp32s kern[] = { 1, 2, -3 };
int kernelSize = 3;
int yAnchor = 1;
int divisor = 1;
ippiFilterColumn_16s_C1R ( src+4, 4*sizeof(Ipp16s), dst+4, 4*sizeof(Ipp16s), srcRoi, kern, kernelSize,
yAnchor, divisor);
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 4; ++j)
{
printf("dst[%i][%i] = %i ",
i, j, dst[i*4+j]);
}
}
______________________________________________
Result:
dst[0][0] = 0
dst[0][1] = 0
dst[0][2] = 0
dst[0][3] = 0
dst[1][0] = -3
dst[1][1] = 2
dst[1][2] = 9
dst[1][3] = -3
dst[2][0] = 0
dst[2][1] = 0
dst[2][2] = 0
dst[2][3] = 0
Regards,
Hernn Badino
1.- the border is not being considered. As shown in the example, memory outside the allocated space will be read. This means also that the first and last rows of the destination image will not contain meaningful information.
2.- According to the result you are showing, yAnchor must be 1 and not 2.
3.- The example is terrible bad, because you are using 8u as data type but the kernel filter has a negative value.
4.- The result should be 0 everywhere, since you are using "Sobel" kernel and the data does not contain any "gradient" in vertical direction.
Something more appropriate will be:
______________________________________________
Ipp16s src[4*3] = {
1, 0, 0, 4,
0, 0, 3, 4,
0, 2, 3, 1
};
Ipp16s dst[4*3] =
{
0, 0, 0, 0,
0, 0, 0, 0,
0, 0, 0, 0
};
IppiSize srcRoi;
srcRoi.width = 4;
srcRoi.height = 1;
Ipp32s kern[] = { 1, 2, -3 };
int kernelSize = 3;
int yAnchor = 1;
int divisor = 1;
ippiFilterColumn_16s_C1R ( src+4, 4*sizeof(Ipp16s), dst+4, 4*sizeof(Ipp16s), srcRoi, kern, kernelSize,
yAnchor, divisor);
for (int i = 0; i < 3; ++i)
{
for (int j = 0; j < 4; ++j)
{
printf("dst[%i][%i] = %i ",
i, j, dst[i*4+j]);
}
}
______________________________________________
Result:
dst[0][0] = 0
dst[0][1] = 0
dst[0][2] = 0
dst[0][3] = 0
dst[1][0] = -3
dst[1][1] = 2
dst[1][2] = 9
dst[1][3] = -3
dst[2][0] = 0
dst[2][1] = 0
dst[2][2] = 0
dst[2][3] = 0
Regards,
Hernn Badino
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
thanks for pointing to this. We will correct sample.
Regards,
Vladimir
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page