Pixel location to intensity value
조회 수: 1 (최근 30일)
이전 댓글 표시
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
채택된 답변
Image Analyst
2013년 11월 11일
Use convolution:
grayImage = double(MRI1(:,:,Slicenumber));
kernel = ones(3)/9;
neighborhoodMeans = conv2(grayImage, kernel, 'same');
You could also use imfilter().
댓글 수: 0
추가 답변 (0개)
참고 항목
카테고리
Help Center 및 File Exchange에서 3-D Volumetric Image Processing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!