Hi.
I'm doing some background modelling. I have a set of images with the same background but the foreground is changing. I'm taking the median pixels from the set of images to retreive the background and the background extraction is successful.
I am then concatenating the 3 channels for the extracted background as follows:
backgroundImage = uint8(cat(3,median_bg_RedValues,median_bg_GreenValues,median_bg_BlueValues));
However, when I try to do image – backgroundImage, any values that are negative are rounded to 0, resulting in a black background.
How can I take the absolute value of the pixel rather than rounding to 0? (..e:
newimg = abs(image - backgroundImage)
(which doesn't work – all negative values are rounded to 0)
I'm loading the other image as standard:
image = imread('test.jpg')
I've even tried changing uint8 to int8 but I get an error:
Error using – Integers can only be combined with integers of the same class, or scalar doubles.
How can I do this nicely?
Thanks for any help.
Best Answer