[討論] 用MATLAB抓指定點座標已回收
我已經抓出圖片上我要的東西的位置了
但是目前嘗試過幾個方法
抓不出點座標
請各位大大幫忙想想辦法QQ
謝謝大家
圖片請看
http://ppt.cc/gyvB
(這是我的圖...紅色框框部分是我希望可以拿到座標的點...希望是左上角座標)
以下是我寫的CODE
yuantu=imread('C:\Documents and Settings\y\My
Documents\MATLAB\test_picture\Picture_11.jpg');
pipeitu=imread('test_picture11.jpg');
yuantu2gray=rgb2gray(yuantu);
pipeitu2gray=rgb2gray(pipeitu);
[pipei_height,pipei_width]=size(pipeitu2gray);
[yuantu_height,yuantu_width]=size(yuantu2gray);
imshow(yuantu);
image(yuantu);
hold on
grid on
size(yuantu);
hold on
grid on
hold on;
tic
for i=1:yuantu_height-pipei_height
for j=1:yuantu_width-pipei_width
temp_picture=imcrop(yuantu2gray,[j,i,pipei_width-1,pipei_height-1]);
r=corr2(temp_picture,pipeitu2gray);
if r>0.9
plot(j:j+pipei_width,i,'r');
plot(j:j+pipei_width,i+pipei_height,'r');
plot(j,i:i+pipei_height,'r');
plot(j+pipei_width,i:i+pipei_height,'r');
end
end
end
toc
figure;
imshow(pipeitu2gray);
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 120.107.148.71
→
01/14 16:24, , 1F
01/14 16:24, 1F
→
01/14 16:24, , 2F
01/14 16:24, 2F
→
01/14 16:25, , 3F
01/14 16:25, 3F
→
01/14 16:25, , 4F
01/14 16:25, 4F
※ 編輯: jacky78612 來自: 120.107.148.71 (01/14 16:27)