Pixel-wise summation and subtraction in EmguCV -
i'm looking elegant way perform pixel-wise summation , subtraction in emgucv.
i'm trying calculate haar-like features of image. one-dimensional situation, it's done multiplying vector [x x x x x x x x] following vector element-wise:
[ 1 -1 1 -1 1 -1 1 -1] [ 1 1 -1 -1 1 1 -1 -1] [ 1 1 1 1 -1 -1 -1 -1]
so need add or subtract element pixels of image.
say,
bgr sum = new bgr(); sum = sum + img[0,0] - img[0,1] + img[0,2] - img[0,3];
obviously won't compile since there's no operator "+" in class bgr. i've make new bgr specifying each of b, g, r value, ugly.
any idea on performing elegant pixel-wise operation?
you use img.getsum()
if first flip sign of pixels want subtracted. might able multiplying image element-wise matrix consisting of 1
, -1
@ appropriate places.
Comments
Post a Comment