[討論] 用MATLAB抓指定點座標已回收

看板MATLAB作者 (冰雪無盡)時間15年前 (2011/01/14 16:13), 編輯推噓0(004)
留言4則, 2人參與, 最新討論串1/1
我已經抓出圖片上我要的東西的位置了 但是目前嘗試過幾個方法 抓不出點座標 請各位大大幫忙想想辦法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
要plot必須要有座標吧?
01/14 16:25, 3F

01/14 16:25, , 4F
弄上來比較快
01/14 16:25, 4F
※ 編輯: jacky78612 來自: 120.107.148.71 (01/14 16:27)
文章代碼(AID): #1DC0Md_5 (MATLAB)