我在 Matlab 中有一张图像,我在其中找到了所有的质心。图像中有多个质心,我正在使用“imellipse”来隔离其中一个。我正在尝试查找质心之一的像素位置。在 Matlab 的命令窗口中弹出位置就足够了。这是我的代码:
% --- Executes on button press in pushbutton15.
function pushbutton15_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton15 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
A = imread('PET_MRI_Brain_Tumor.jpg');
Z = imshow(A)
Ibw = im2bw(A);
Ibw = imfill(Ibw,'holes');
Ilabel = bwlabel(Ibw);
stat = regionprops(Ilabel,'centroid');
imshow(Z); hold on;
for x = 1: numel(stat)
plot(stat(x).Centroid(1),stat(x).Centroid(2),'bx');
end
e = imellipse(gca,[55 10 120 120])
BW = createMask(e,Z)
这是我试图推断质心标记的像素位置的图片。 http://imgur.com/DnSQTUi