Pixel location to intensity value
1 visualizzazione (ultimi 30 giorni)
Mostra commenti meno recenti
I'm trying to create a algorithm that calculates the mean intensity of a given pixel and it's neighbors, i use the script beneath to select a slice and pixel in my volume and build a matrix with the pixel and neighbor locations. Can anybody help me to translate this location to an intensity value?
if true
% Slicenumber = round(size(MRI1 ,3)/2);
figure, imshow (MRI1(:,:,Slicenumber),[]);
uiwait(msgbox('Select a point'))
[x,y]=getpts;
Position(1) = round(double(x(1)));
Position(2) = round(double(y(1)));
Position(3) = Slicenumber;
a = [ 1 0 0; -1 0 0; 1 1 0; 0 1 0; -1 1 0; 1 -1 0; 0 -1 0; -1 -1 0];
neighbors = a+repmat(Position,[8 1]);
end
0 Commenti
Risposta accettata
Image Analyst
il 11 Nov 2013
Use convolution:
grayImage = double(MRI1(:,:,Slicenumber));
kernel = ones(3)/9;
neighborhoodMeans = conv2(grayImage, kernel, 'same');
You could also use imfilter().
0 Commenti
Più risposte (0)
Vedere anche
Categorie
Scopri di più su 3-D Volumetric Image Processing in Help Center e File Exchange
Prodotti
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!