我有一段代碼,我試圖理解。這是我的同事給出的,我正在努力爲什麼她會像她那樣工作。她在評論中提到變量inertai1給出了均勻性因子。我想知道這是如何提供一個圖像的一致性。MATLAB Image Mass and Inertia
代碼背景: 最初它是一個2D圖像。每列中的強度值都加上了,我得到了一維矢量。然後將所有值除以1D矢量中的最大值。基本正常化。
如果我是圖像讀取。我具有從0到255的值。
S = sum(I,2); Smax = max(S);
Cprofile = S/Smax;
I2 = I*10;
I2(I2>255) = 255;
S2 = sum(I2,2); S2max = max(S2);
Cprofile2 = S2/S2max;
kCprofile2 = fft(Cprofile2);
//Do some frequency manipulations
Cprofile2_f = ifft(kCprofile2)
inperpx是英寸每像素。
B1和D1是CPROFILE的第一個和最後一個指標,我感興趣的
inertia1=0;
mass1=0;
for ii=b1:d1;
mass1=mass1+inperpx*Cprofile(ii);
inertia1=inertia1+abs(Cprofile2_f(ii)-Cprofile(ii))*inperpx;
end
inertia1=1-inertia1/mass1;
你在想什麼? –
更新的問題:嘗試瞭解代碼背後的物理意義 –
「inperpx」和「Cprofile2_f」的定義是什麼? – rayryeng