I implemented the HOG for color images based on the excerpt from the original paper "For colour images, we calculate separate gradients for each colour channel, and take the one with the largest norm as the pixel’s gradient vector"[Dalal and Triggs] and the CVPR presentation "For color image, pick the color channel with the highest gradient magnitude for each pixel"[Dalal and Triggs].
To allow this change, I refactored the code so that image gradients are computed in a separate method. If the image has more than 1 channels, this method is called on each channel. Gradient magnitude is calculated for each channel and for each pixel, the gradient vector with maximum magnitude is considered.
This is my first open source contribution and I implemented the change based on my understanding. I pushed my changes to Github. Please review my code and let me know if I implemented the functionality correctly. Please comment on coding style too.