bsxfun@minus and mean does not give the right answer ?

조회 수: 1 (최근 30일)
RuiQi
RuiQi 2016년 6월 16일
댓글: Guillaume 2016년 6월 16일
I have many images of dimension 3 (RGB) each that are concatenated in the 4th dimension to produce a 4 dimensional matrix named data. Then I subtract each pixel in every image by the mean along the 4th dimension. However, when I sum up the data along the 4th dimension, I do not get an output of zero. I was hoping if someone can point out my mistakes. The code (excluding the reading of data) is written below. Would the error be simply due to rounding errors ?
data = double(cat(4, positive_samples.var(:,:,:,:), negative_samples.var(:,:,:,:)));
dataMean = mean(data, 4);
data = bsxfun(@minus, data, dataMean);
sum(data,4)
  댓글 수: 1
Guillaume
Guillaume 2016년 6월 16일
If the matrices that you concatenate are indeed 3D, why have you got four colons in
positive_samples.var(:,:,:,:) %implying var is at least 4D
Also, what value is
s = sum(data, 4); %after subtracting the mean
max(s(:)) %what is the maximum deviation from 0?

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Correlation and Convolution에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by