Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Subtract mean from image

I'm implementing a CNN with Theano. In the paper, I have to do this image preprocess before train the CNN

We extracted RGB patches of 61x61 dimensions associated with each poselet activation, subtracted the mean and used this data to train the convnet model shown in Table 1

Can you tell me what does it mean with "subtracted the mean"? Tell me if these steps are correct (it is what I understood) 1) Compute the mean for Red Channel, Green Channel and Blue Channel for the whole image 2) For each pixel, subtract from red value the mean of red channel, from green value the mean of green channel and the same for the blue channel 3) Is it correct to have negative value or do I have use the abs?

Thanks all!!

like image 544
sakuragi Avatar asked Apr 20 '15 09:04

sakuragi


People also ask

What is mean subtraction in image processing?

Image subtraction or pixel subtraction is a process whereby the digital numeric value of one pixel or whole image is subtracted from another image. This is primarily done for one of two reasons – levelling uneven sections of an image such as half an image having a shadow on it, or detecting changes between two images.

How do you find the mean of an image?

mean: simply divide the sum of pixel values by the total count - number of pixels in the dataset computed as len(df) * image_size * image_size.

What is image subtraction and averaging?

While image averaging is usually utilized for noise reduction, image subtraction can be employed to mitigate the effect of uneven illuminance. Moreover, we'll see that image subtraction allows us to compare images and detect changes.

What is a mean image?

Mean image is an image where i,j,c pixel is an average of i,j,c pixels from all images. So you take a mean separately for each position and each color channel. It requires all images to have the same size of course, otherwise it is not defined.


1 Answers

You should read paper carefully, but what is the most probable is that they mean mean of the patches, so you have N matrices 61x61 pixels, which is equivalent of a vector of length 61^2 (if there are three channels then 3*61^2). What they do - they simple compute mean of each dimension, so they calculate mean over these N vectors in respect to each of the 3*61^2 dimensions. As the result they obtain a mean vector of length 3*61^2 (or mean matrix/mean patch if you prefer) and they substract it from all of these N patches. Resulting patches will have negatives values, it is perfectly fine, you should not take abs value, neural networks prefer this kind of data.

like image 162
lejlot Avatar answered Oct 17 '22 22:10

lejlot