Using python-interface for OpenCV, one can easily access the pixel of image using [] operator,like this:
img = cv.LoadImage('test.jpg')
pixel = img[10,10]
variable pixel here is a python tuple object like (10,20,30) (3 channels for example), it's not very convenient to process computation since tuple type does not support operator '-' or '+'. If I hope to do a substruction on a pixel like 255 - (10,20,30), I must code like this:
import numpy as np
pixel = tuple( np.array([255,255,255]) - np.array(pixel) )
is there a faster and easier solution?
Another qustion : is there a way to make a substraction on all pixels, like using a matrix substraction in Matlab: 255 - img (don't use OpenCV build-in function).