我想產生不同強度(黑色,灰色,白色)的高斯斑點和對比,但然後,我應該改變下面的代碼中哪個參數?在MATLAB中的高斯斑點
非常感謝提前!
imSize = 300; % image size: n X n
lamda = 10; % wavelength (number of pixels per cycle)
theta = 15; % grating orientation
sigma = 50;
imSize = 300;
% make linear ramp
X = 1:imSize; % X is a vector from 1 to imageSize
X0 = (X/imSize) - .5; % rescale X -> -.5 to .5
[Xm Ym] = meshgrid(X0, X0);
s = sigma/imSize;
gauss = exp(-(((Xm.^2)+(Ym.^2)) ./ (2* s^2))); % formula for 2D gaussian
%%%%%%% NEW VARIABLES
trim = .005; % trim off gaussian values smaller than this
gauss(gauss < trim) = 0; % trim around edges (for 8-bit colour displays)
imagesc(gauss, [-1 1]); % display
colormap gray(256);
axis off; axis image; % use gray colormap
當你做你不得到預期的結果 - '身影, imshow(gauss)',如果我正確理解了「斑點」的概念? – Divakar
非常感謝您的回覆!但是當我做數字時,我得到的結果是,imshow(高斯)是背景強度的變化。我想做一個操作,將背景保持在灰度級,但改變高斯blob本身的亮度(灰色背景上的深灰色,灰色背景上的白色或黑色等) – user1365673
所以基本上,問題是,我怎麼能得到0和-1之間的y軸範圍,而不是0和1 ...或在任何其他對比度,即0和0.5或0和-0.5等 – user1365673