繼續我們昨天的工作,先把這個有中間分隔線(rccentreline)的矩形畫出來,然後等間隔增加線影象,讓他變成找線工具。對比「丁」字型線影象工具roibase類,有如下增加:
1,增加了三條線宣告: public mg_line otherline1;//上----------
public mg_line otherline2;//下----------
public mg_line lastline;//-------|
2, public roibase()//建構函式增加: start = new pointf(10, 10);
end = new pointf(70, 10);
otherline1 = new mg_line(start, end);
start = new pointf(10, 70);
end = new pointf(70, 70);
otherline2 = new mg_line(start, end);
start = new pointf(70, 10);
end = new pointf(70, 70);
lastline = new mg_line(start, end);
3, public int ispointinrect(pointf point)//判斷操作是否在相應區域增加:
pointf herline2centre = new pointf((otherline2.pt_start.x + otherline2.pt_end.x) / (float)2,
(otherline2.pt_start.y + otherline2.pt_end.y) / (float)2);
else if (point.x <= herline2centre.x + 5 && point.x >= herline2centre.x - 5
&& point.y >= herline2centre.y - 5 && point.y <= herline2centre.y + 5)
4, public void roireset(float deltachang, float deltakuan)//線影象工具重置增加:
start = new pointf(rccentreline.pt_start.x, rccentreline.pt_start.y - 30 - deltakuan / (float)2);
end = new pointf(rccentreline.pt_start.x + 60 + deltachang, rccentreline.pt_start.y - 30 - deltakuan / (float)2);
otherline1 = new mg_line(start, end);
start = new pointf(rccentreline.pt_start.x, rccentreline.pt_start.y + 30 + deltakuan / (float)2);
end = new pointf(rccentreline.pt_start.x + 60 + deltachang, rccentreline.pt_start.y + 30 + deltakuan / (float)2);
otherline2 = new mg_line(start, end);
start = new pointf(rccentreline.pt_start.x + 60 + deltachang, rccentreline.pt_start.y - 30 - deltakuan / (float)2);
end = new pointf(rccentreline.pt_start.x + 60 + deltachang, rccentreline.pt_start.y + 30 + deltakuan / (float)2);
lastline = new mg_line(start, end);
5, public void updateroi(float rotationangle)//更新我們設計的線影象工具增加:
otherline1.rotate(rccentreline.pt_start, rotationangle);
otherline2.rotate(rccentreline.pt_start, rotationangle);
lastline.rotate(rccentreline.pt_start, rotationangle);
6, public void drag(pointf point)//拖動線影象工具增加: otherline1.move(delta);
otherline2.move(delta);
lastline.move(delta);
7, public void drawlineandrect(graphics g, pen p, int dir)//畫出線影象工具增加:
g.drawline(p, otherline1.pt_start, otherline1.pt_end);
g.drawline(p, otherline2.pt_start, otherline2.pt_end);
g.drawline(p, lastline.pt_start, lastline.pt_end);
//down
g.drawrectangle(p, (int)(otherline2.pt_end.x + otherline2.pt_start.x) / 2 - 5,
(int)(otherline2.pt_end.y + otherline2.pt_start.y) / 2 - 5, 10, 10);
//白到黑 centretodown
if (dir == 0)
//黑到白 downtocentre
if (dir == 1)
10,最後乙個,彈性改變後整個基礎框架的更新,函式是
public void dragtolerancey(pointf point)//程式邏輯不對20160627,已經更正
if ((m_rccenter.x - aa.x) == 0)
else
pointf deltadelta = new pointf(qq.x - aa.x, qq.y - aa.y);
otherline2.move(deltadelta);
pointf delta11 = new pointf(-deltadelta.x, -deltadelta.y);
otherline1.move(delta11);
//deal with startline and endline
startline.updatepstart(otherline1.pt_start);
startline.updatepend(otherline2.pt_start);
lastline.updatepstart(otherline1.pt_end);
lastline.updatepend(otherline2.pt_end);
}(待續...........................)
機器視覺入門之路(零,可遇可求)
不知何人說,可遇不可求!但自從發明了計算機,指明了一條可遇可求的路!搞計算機,都是從零開始的,這體現了搞計算機的辛苦和原創精神。視覺資訊處理腦機制 中有句話,眼是人的前腦。而當下借用這句話形容,計算機視覺 cv 便就是人工智慧 ai 的前腦。learning opencv中的learning是什麼意...
機器視覺入門之路(二八,畫素的操作(拉普拉斯))
假定gx i,j buffer i w j buffer i w j 1 那麼gx i,j 1 gx i,j x 先求gx i,j 1 用 j 1 替換buffer i w j buffer i w j 1 中j,所以gx i,j 1 buffer i w j 1 buffer i w j 1 1 ...
基於視覺的機械人SLAM入門
安裝 如下 2 進入pangolin資料夾,建立編譯資料夾並且配置編譯。cd pangolin mkdir build cd build cmake dcpp11 no boosr 1.sudo make j8安裝命令如下 orb slam22.編譯orb slam2包 如下 cd lenovo r...