0
我可以使用什麼方法來緩衝像素的相關像素值?例如,左側的圖像顯示的像素半徑值範圍爲0 - 5(注意「黑色」值爲0)的光柵圖像。右側的圖像顯示了我試圖根據這些像素值生成的緩衝區。每個堆棧交換策略,我還包括一個可重現數據的MATLAB腳本。如何緩衝像素的關聯像素值?
% Generate a grid of 0s to begin with.
m = zeros(300, 400, 'uint8');
% Generate 1000 random pixels.
numRandom = 1000;
linearIndices = randi(numel(m), 1, numRandom);
% Assign a radius value of 1-5 for each pixel
m(linearIndices) = randi(5, [numel(linearIndices) 1]);
% Display it.
image(m);
colormap(hot);
編輯:NVM,使用這裏所說的緩衝區是不明確的。 –
@Ashish您在提供的解決方案中使用「緩衝區」是正確的。 – Borealis