What is per-pixel mean?
Afficher commentaires plus anciens
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?
Réponse acceptée
Plus de réponses (1)
Image Analyst
le 26 Juin 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.
Catégories
En savoir plus sur Deep Learning Toolbox dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!