# What is per-pixel mean?

5 Ansichten (letzte 30 Tage)
Jay am 26 Jun. 2016
Beantwortet: Walter Roberson am 27 Jun. 2016
To train the CNN, RGB images(in some cases color-ROI) are preprocessed by resizing it to the smallest dimension to 256, and then we crop center 256*256 region. After this per-pixel mean(across all the image) is subtracted.
I don't get a proper sense of this concept. Is there anyone can explain?
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Akzeptierte Antwort

Walter Roberson am 27 Jun. 2016
You have a whole series of extracted images that are the same size. The per-pixel mean over the images is the mean across all the pixels for any one fixed location. So for example if the extract images are stored in AllImages,
mean(AllImages(17, 38, :))
would be the per-pixel mean for location (17, 38)
You can do this all at one time for the pixels by using
mean(AllImages, 3)
where the 3 indicates the third dimension, provided that the different images are stored as having a different third-dimensional coordinate in the array.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Weitere Antworten (1)

Image Analyst am 26 Jun. 2016
The image is resized to 256 rows or columns, along whichever dimension is smallest. The size of the other dimension is not given by you - it may also be 256, or it may be something such that the aspect ratio of the image stays the same, or it maybe something else. Regardless, you have a square or rectangular image that's 256 wide along some dimension and then it extracts the middle 256-by-256 square from that rectangular image. For example, the image is originally 480-by-640. Then it's resized to 256 by 640 (or whatever). Then the middle 256-by-256 image is extracted, essentially from row 128 to 384. Now you have a 256-by-256 square image. Then subtract the mean.
% Resize image
[rows, columns, numberOfColorChannels) = size(originalImage); % Get starting dimensions.
resizedImage = imresize(originalImage, [256, columns]);
% Extract middle 256 chunk.
col1 = columns - 128
col2 = col1 + 127
croppedImage = resizedImage(:, col1:col2);
% Compute mean of extracted chunk.
theMean = mean2(croppedImage)
% Subtract mean from the cropped image.
finalImage = croppedImage - theMean; % For grayscale only.
##### 0 Kommentare-2 ältere Kommentare anzeigen-2 ältere Kommentare ausblenden

Melden Sie sich an, um zu kommentieren.

### Kategorien

Mehr zu Get Started with Statistics and Machine Learning Toolbox finden Sie in Help Center und File Exchange

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by