Pixel location to intensity value

1 visualización (últimos 30 días)
Hugo
Hugo el 11 de Nov. de 2013
Respondida: Image Analyst el 11 de Nov. de 2013
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

Respuesta aceptada

Image Analyst
Image Analyst el 11 de Nov. de 2013
Use convolution:
grayImage = double(MRI1(:,:,Slicenumber));
kernel = ones(3)/9;
neighborhoodMeans = conv2(grayImage, kernel, 'same');
You could also use imfilter().

Más respuestas (0)

Categorías

Más información sobre 3-D Volumetric Image Processing en Help Center y File Exchange.

Community Treasure Hunt

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

Start Hunting!

Translated by