What is per-pixel mean?

조회 수: 9 (최근 30일)
Jay
Jay 2016년 6월 26일
답변: Walter Roberson 2016년 6월 27일
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?

채택된 답변

Walter Roberson
Walter Roberson 2016년 6월 27일
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.

추가 답변 (1개)

Image Analyst
Image Analyst 2016년 6월 26일
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.

카테고리

Help CenterFile Exchange에서 Image Processing and Computer Vision에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by