A computer-implemented method for producing a histogram of oriented gradients, HOG, for at least a portion of an image comprising: receiving the image through an input image interface; dividing said image portion into cells, each cell comprising a plurality of image pixels; associating a configurable combination of at least one sector with a respective bin, each sector corresponding to a respective angle within a full circle and each bin being corresponding to a respective angle within a full circle, for each image pixel of a cell, obtaining a horizontal gradient component, gx, and a vertical gradient component, gy, based on differences in pixel values along at least a row of said image and a column of said image respectively including said pixel; and allocating a respective gradient weight to each sector of a pair of sectors bounding said pixel gradient according to a relative angle of said pixel gradient to each of the pair of sectors bounding said pixel gradient; and allocating the gradient weight for a sector to an associated bin according to an angle between said sector and said associated bin; and accumulating a weighted pixel gradient for each pixel of a cell associated with a bin to provide a HOG for said cell; and outputting said HOG through an output interface, characterized in that said sectors extend along lines gx=2".gy, where n is any integer value with a magnitude greater than or equal to 1; or said sectors each have an index n extending along lines: b*16=a*(n+1) where 0≤n≤5, b=gy and a=gx; and b*16=a*(13-n) where 7≤n≤12, a = gx + gy and b = gx - gy. receiving the image through an input image interface; dividing said image portion into cells, each cell comprising a plurality of image pixels; associating a configurable combination of at least one sector with a respective bin, each sector corresponding to a respective angle within a full circle and each bin being corresponding to a respective angle within a full circle, for each image pixel of a cell, obtaining a horizontal gradient component, gx, and a vertical gradient component, gy, based on differences in pixel values along at least a row of said image and a column of said image respectively including said pixel; and allocating a respective gradient weight to each sector of a pair of sectors bounding said pixel gradient according to a relative angle of said pixel gradient to each of the pair of sectors bounding said pixel gradient; and allocating the gradient weight for a sector to an associated bin according to an angle between said sector and said associated bin; and obtaining a horizontal gradient component, gx, and a vertical gradient component, gy, based on differences in pixel values along at least a row of said image and a column of said image respectively including said pixel; and allocating a respective gradient weight to each sector of a pair of sectors bounding said pixel gradient according to a relative angle of said pixel gradient to each of the pair of sectors bounding said pixel gradient; and allocating the gradient weight for a sector to an associated bin according to an angle between said sector and said associated bin; and accumulating a weighted pixel gradient for each pixel of a cell associated with a bin to provide a HOG for said cell; and outputting said HOG through an output interface, characterized in that said sectors extend along lines gx=2".gy, where n is any integer value with a magnitude greater than or equal to 1; or said sectors each have an index n extending along lines: b*16=a*(n+1) where 0≤n≤5, b=gy and a=gx; and b*16=a*(13-n) where 7≤n≤12, a = gx + gy and b = gx - gy.