I've computed the HOGDescriptor on a color image and found different results in Python and C++, the opencv version, HOG parameters and image being the same on both.
There is a startling difference between the HOG descriptors computed in C++ and Python on the default BGR image
There is again, a startling difference between the HOG descriptors computed in C++ and Python on the default BGR2RBG image. However, C++ seems to follow the recommended (by Dalal, Triggs) way of computing the HOG as the max of all three channels, as is proved by the fact that BGR and RGB image has the same HOG descriptor, but Python does not
The grayscale versions of the image, however, show similar (but not same) descriptor values.
HOG parameters:
cv::HOGDescriptor hogDescriptor;
hogDescriptor.blockSize = cv::Size(8, 8);
hogDescriptor.cellSize = cv::Size(4, 4);
hogDescriptor.blockStride = cv::Size(4, 4);
hogDescriptor.nbins = 9;
hogDescriptor.signedGradient = true;
hogDescriptor.winSize = cv::Size(72, 72);
My question is, why is there such a large difference between the C++ and Python implementations even though Python is just a wrapper for the C++ version?




