In his original publication  Scharr lists (on page 120 ) the filter, named after him, as:
 Dipl. Phys. Hanno Scharr, Optimale Operatoren in der Digitalen Bildverarbeitung, INAUGURAL-DISSERTATION zur Erlangung der Doktorwürde der Naturwissenschaftlich-Mathematischen Gesamtfakultät der Ruprecht-Karls-Universität Heidelberg, 10. Mai 2000.
Fx is what ippiFilterScharrHorizMaskBorder actually does (apart from the 1/32 normalization factor). So far, so good.
Now comes the confusion:
1. It does make a difference, visually, if the first column of Fx (and the first row of Fy) is positive or negative. A histogram of the 32f result of the Scharr (and other derivative) filters shows why: the result values are mirrored around 0.0. That difference disappears, of course, if we take the square or absolute value of the result (as is often the case, but not always).
2. It does make a difference if the kernel values are stored (and displayed) in an array or 3x3 matrix. What the programming-matrix does, depends on the programming language being row major or not (where e.g. Fortran, Pascal and C are different). To avoid that confusion, I suggest to always list kernel values as array.
2. The IPP Developer Reference states that ippiFilterScharrHorizMaskBorder is filtered by a 3x3 matrix as follows (and I don't think that is correct)
3. The headers list the same matrix as "ScharrHoriz" (also incorrect I think)
4. The IPP Developer references lists Gx of ippiGradientVectorScharr as
The sign is wrong. Admittedly that doesn't matter when the result is squared or made positive. Still, this adds to the confusion.
I suggest that the docs are clarified, also for the other built-in filters.
Adriaan van Os
Thanks for the reply. I also suggest to clarify the documentation with regard to convolution versus correlation. Formally, with 1D convolution, as opposed to 1D correlation, the kernel values are flipped before they are applied.Therefore, with a 2D convolution, the kernel matrix is flipped horizontally and vertically, in other words rotated 180 degrees before is is applied.
The IPP Developer Reference is not helpful here. For example, in the section General Linear Filters, it merely reads "In Intel IPP 8.2 and lower versions, kernel coefficients are used in inverse order."
This suggests that the 2D convolution matrix is not rotated 180 degrees in IPP versions later than 8.2. However, to get the same effect as ippiFilterScharrHorizMaskBorder, I do need to pass
-3.0, -10.0, -3.0,
0.0, 0.0, 0.0,
3.0, 10.0, 3.0
to ippiFilterBorder. Also, to get the same effect as ippiFilterScharrVertMaskBorder, I do need to pass
-3.0, 0.0, 3.0,
-10.0, 0.0, 10.0,
-3.0, 0.0, 3.0
So, convolution matrix rotation (or not ...) seems to be part of the confusion.
Adriaan van Os