Microsoft Paint in OpenCV
来源:互联网 发布:手机淘宝如何升级版本 编辑:程序博客网 时间:2024/05/18 01:57
When we first get know of computergraphics, we are often introduced by drawing figures. Based on analyticgeometry, figures can be drawn by connecting the dots which satisfying certainfunction.
After we know these function, it won’t toomuch difficult for us to write a program like Microsoft Paint.
So this project is to make a copy ofMicrosoft Paint and implement its basic function.
Here is my program in running:
Below is the source code of the program:
graphic.h
//--------graphic.h----------// This file is only header file of the porject// Include all class defination and pre defined function////---------------------------#include <opencv2/core/core.hpp>#include <opencv2/highgui/highgui.hpp>#include <stdio.h>#include <math.h>#include <stack>#include <iostream>using namespace cv;// ================== Graphic object class definition ======================class Graphs{public: int thickness_ ; // The thickness of the figure int type_ ; // Type of figure, see discription below int optional_; // Optional byte, use for store additional informationScalar color_; // Color of the shape Point anchor_[4]; // Static array for any figure using less than 4 points Point* extra_anchor_; // Dynamic array for any figure may have multiple points// --------- Type explanation ------------ //// -1: NULL/ERROR/NOT SET// 0: spline// 1: (solid) line// 2: rectangle// 3: circle// 4: triangle// 5: oval// 6: polygen// 7: dot_line// ---------- END ------------------------- //public: //Default constructor Graphs(){ thickness_ = 5; type_ = -1; optional_ = -1;color_ = Scalar(0,0,0); extra_anchor_ = NULL;} //Constructor with parameter Graphs(int _type, Point p0, Point p1, Point p2, Point p3, int _thickness = 5, Scalar _sc = Scalar(0,0,0),int _opti = -1){ thickness_ = _thickness; type_ = _type; optional_ = _opti; extra_anchor_ = NULL;color_ = _sc; anchor_[0] = p0; anchor_[1] = p1; anchor_[2] = p2; anchor_[3] = p3;} //When extra points need to be saved void activeExtentMode(int _size, Point* _ptArry){ optional_ = _size; extra_anchor_ = new Point[_size]; for(int i = 0; i < optional_; i++) extra_anchor_[i] = _ptArry[i];}};// CLASS GRAPHS ENDclass spline{public:Point p[4];int remain;bool modify;spline(){remain = 4;modify = false;}bool full(){if (remain == 0) return true;else return false;}void reset() {remain = 4; modify = false;}};class polygon{public:Point* P_arr;int size;int capacity;bool finish;polygon(){capacity = 10;P_arr = new Point[capacity];size = 0;finish = false;}bool insert(Point _ap){if(size < capacity){P_arr[size] = _ap;size ++;return true;}else{capacity = capacity*2;Point* newP = new Point[capacity];for(int i = 0; i < size; i++){newP[i] = P_arr[i];}delete P_arr;P_arr = newP;P_arr[size] = _ap;size ++;return true;}return false;}void reset(){delete[] P_arr;capacity = 10;P_arr = new Point[capacity];size = 0;finish = false;}};class triangle{public:Point p[3];int remain;bool modify;triangle(){remain = 3;modify = false;}bool full(){if (remain == 0) return true;else return false;}void reset() {remain = 3; modify = false;}};// ^^^^^^^^^^^^^^^^^^ Graphic object class defination end //====================== Static variable definition =========================// ------Use for tool boxMat img_tool;Mat img_toolSelect;// -----Use for main framMat img_background;Mat img_modify;Mat img_display;// -----Use for figure's temperary data when in editingspline SLtemp;triangle TAtemp;polygon PLtemp;// ----- Static variable for call back function and main function usebool editing;int MODE;int THICKNESS;Scalar COLOR;std::vector<Graphs> HISTORY; // Used to store all the figure drawed// ^^^^^^^^^^^^^^^^^^^^^ Static variable definition end//====================== Drawing function definition =========================void DrawLine(Mat img, Point start, Point end, int thickness = 2, Scalar c = COLOR){ int lineType = CV_AA; line(img,start,end,c,thickness,lineType);}void DrawSpline(Mat img, Point p0, Point p1, Point p2, Point p3, int thickness = 2, Scalar c = COLOR){for(float t = 0.0; t<=1.0; t += 0.005 ){int x = (1-t)*(1-t)*(1-t)*p0.x + 3*t*(1-t)*(1-t)*p1.x + 3*t*t*(1-t)*p2.x + t*t*t*p3.x;int y = (1-t)*(1-t)*(1-t)*p0.y + 3*t*(1-t)*(1-t)*p1.y + 3*t*t*(1-t)*p2.y + t*t*t*p3.y;cv::circle(img, cv::Point(x, y), 2,c,thickness,CV_AA);}}void DrawDotLine(Mat img, Point start, Point end, int thickness = 2, Scalar c = COLOR){for(float t = 0.0; t<=1.0; t += 0.08 ){int x = (1-t)*start.x + t*end.x;int y = (1-t)*start.y + t*end.y;cv::circle(img, cv::Point(x, y), 2,c,thickness,CV_AA);}}void DrawRect(Mat img, Point start, Point end, int thickness = 2, Scalar c = COLOR){int lineType = CV_AA;rectangle(img, start, end, c,thickness,lineType);}void DrawCircle(Mat img, Point center, int r, int thickness = 2, Scalar c = COLOR){int lineType = 8;circle(img,center,r, c,thickness,lineType);}void DrawTriangle(Mat img, Point p0, Point p1, Point p2, int thickness = 2, Scalar c = COLOR){int lineType = CV_AA;line( img,p0,p1,c,thickness,lineType);line( img,p1,p2,c,thickness,lineType);line( img,p2,p0,c,thickness,lineType);}void DrawOval(Mat img, Point p0,Point p1, int thickness = 2, Scalar c = COLOR){/*for(float i = 0; i < 360; i++){cv::circle(img,Point(p0.x+(int)a*cos(i),p0.y+(int)b*sin(i)),2,c,thickness,CV_AA);}*/int a = (int) std::abs(p1.x-p0.x);int b = (int) std::abs(p1.y-p0.y);cv::ellipse(img,p0,Size(a,b),0,0,360,c,thickness,CV_AA);}void DrawPolygon(Mat img, Point* Anchors, int size ,int thickness = 2, Scalar c = COLOR){for(int i = 1; i < size; i++){line(img,Anchors[i-1],Anchors[i],c,thickness,CV_AA);}line(img,Anchors[size-1],Anchors[0],c,thickness,CV_AA);}bool select(int x, int y, int sel_x, int sel_y,int range = 10){if ( x <= sel_x + range && x >= sel_x - range){if ( y <= sel_y + range && y >= sel_y - range) return true;else return false;}else return false;}// ^^^^^^^^^^^^^^^^^^^^^ Drawing function definition endvoid on_mouse_edit(int event,int x,int y,int flags,void *ustc){ static Point pre_pt = (-1,-1); // Mouse action starting point static Point cur_pt = (-1,-1); // Mouse action intermidiat pointstatic Point end_pt = (-1,-1); // Mouse action end pointstatic int p_select = 0 ; // Anchor index selection //=====================================Left Press==============================================if(event == CV_EVENT_LBUTTONDOWN ) // left press{/////////////////spline - left click downif( MODE == 0 ) {printf("left click on (%d, %d)\n", x, y);if (!SLtemp.full()) // State: draw curve{SLtemp.p[4-SLtemp.remain] = Point(x,y);SLtemp.remain--;editing = true;}else // change dots or enclose curve{pre_pt.x = x;pre_pt.y = y;if (select(x,y,SLtemp.p[0].x,SLtemp.p[0].y) || select(x,y,SLtemp.p[1].x,SLtemp.p[1].y) || select(x,y,SLtemp.p[2].x,SLtemp.p[2].y) || select(x,y,SLtemp.p[3].x,SLtemp.p[3].y)){if ( select(x,y,SLtemp.p[1].x,SLtemp.p[1].y) ) p_select = 1;else if ( select(x,y,SLtemp.p[2].x,SLtemp.p[2].y) ) p_select = 2;}else // seal the graph{Graphs g(0,SLtemp.p[0],SLtemp.p[1],SLtemp.p[2],SLtemp.p[3],THICKNESS,COLOR);HISTORY.push_back(g);SLtemp.reset();editing = false;}}}/////////////line - left click downif (MODE == 1){printf("left click on (%d, %d)\n", x, y);editing = true;pre_pt = Point(x,y);cv::circle(img_modify,Point(x,y),2, Scalar(0,0,255),5,8);}/////////////Rectangle - left click downif (MODE == 2){printf("left click on (%d, %d)\n", x, y);editing = true;pre_pt = Point(x,y);cv::circle(img_modify,Point(x,y),2, Scalar(0,0,255),5,8);}/////////////Circle - left click downif ( MODE == 3){pre_pt = Point(x,y);editing = true;cv::circle(img_modify,Point(x,y),2, Scalar(0,0,255),5,8);}/////////////Triangle - left click downif ( MODE == 4){if (!TAtemp.full()) // State: store dots{TAtemp.p[3-TAtemp.remain] = Point (x,y);TAtemp.remain--;editing = true;}else // change dots or enclose curve{pre_pt.x = x;pre_pt.y = y;if (select(x,y,TAtemp.p[0].x,TAtemp.p[0].y) || select(x,y,TAtemp.p[1].x,TAtemp.p[1].y) || select(x,y,TAtemp.p[2].x,TAtemp.p[2].y)){if ( select(x,y,TAtemp.p[1].x,TAtemp.p[1].y) ) p_select = 1;else if ( select(x,y,TAtemp.p[2].x,TAtemp.p[2].y) ) p_select = 2;else if ( select(x,y,TAtemp.p[0].x,TAtemp.p[0].y) ) p_select = 0;}else // seal the graph{Graphs g(4,TAtemp.p[0],TAtemp.p[1],TAtemp.p[2],Point(-1,-1),THICKNESS,COLOR);HISTORY.push_back(g);TAtemp.reset();editing = false;}}}/////////////Oval - left click downif ( MODE == 5){pre_pt = Point(x,y);editing = true;cv::circle(img_modify,Point(x,y),2, Scalar(0,0,255),5,8);}/////////////////spline - left click downif( MODE == 6 ) {printf("left click on (%d, %d)\n", x, y);if (PLtemp.finish == false) // State: adding more anchor{editing = true;if(PLtemp.size < 3) PLtemp.insert(Point(x,y)); // if polygon is empty or less than 3 dots which can mark an enclose figure, insert the first oneelse{if( select(x,y,PLtemp.P_arr[0].x,PLtemp.P_arr[0].y,5) ) // click the starting point to seal the polygon{PLtemp.finish = true; }else PLtemp.insert(Point(x,y)); // else adding more dots}}else // enclose curve{Graphs g;g.type_ = 6;g.color_ = COLOR;g.thickness_ = THICKNESS;g.optional_ = PLtemp.size;g.activeExtentMode(PLtemp.size,PLtemp.P_arr);HISTORY.push_back(g);PLtemp.reset();editing = false;}}/////////////line - left click downif (MODE == 7){printf("left click on (%d, %d)\n", x, y);editing = true;pre_pt = Point(x,y);cv::circle(img_modify,Point(x,y),2, Scalar(0,0,255),5,8);}}//=====================================mouse moving==============================================if( event == CV_EVENT_MOUSEMOVE ) //mouse moving {if(editing == false) // Brawsing mode{}else // Editing mode{} //if (mode == 1) circle(img_orig, cv::Point(x, y), 2, cv::Scalar(255, 255, 255),5); } //=====================================Right drag==============================================if (event == CV_EVENT_MOUSEMOVE && (flags & CV_EVENT_FLAG_RBUTTON)){////}//=====================================Left drag==============================================if (event == CV_EVENT_MOUSEMOVE && (flags & CV_EVENT_FLAG_LBUTTON)){////////////////////spline left dragif ( MODE == 0 ){if ( p_select == 1 ){cur_pt.x = x;cur_pt.y = y;SLtemp.p[1] = Point(x,y);}else if ( p_select == 2 ){cur_pt.x = x;cur_pt.y = y;SLtemp.p[2] = Point(x,y);}}///////////////////line left dragif( MODE == 1){img_display.copyTo(img_modify);cur_pt = Point(x,y);cv::circle(img_modify,pre_pt,2, Scalar(0,0,255),5,8);cv::circle(img_modify,cur_pt,2, Scalar(0,0,255),5,8);DrawLine(img_modify,pre_pt,cur_pt,THICKNESS,COLOR);}//////////////////Rectangle left dragif( MODE == 2){img_display.copyTo(img_modify);cur_pt = Point(x,y);cv::circle(img_modify,pre_pt,2, Scalar(0,0,255),5,8);cv::circle(img_modify,cur_pt,2, Scalar(0,0,255),5,8);DrawRect(img_modify,pre_pt,cur_pt,THICKNESS,COLOR);}//////////////////Circle left dragif( MODE == 3){img_display.copyTo(img_modify);cur_pt = Point(x,y);int rad = sqrt((cur_pt.x - pre_pt.x)*(cur_pt.x - pre_pt.x) + (cur_pt.y - pre_pt.y)*(cur_pt.y - pre_pt.y));circle(img_modify,pre_pt,2, Scalar(0,0,255),5,8);circle(img_modify,cur_pt,2, Scalar(0,0,255),5,8);DrawDotLine(img_modify,pre_pt,cur_pt,-1,Scalar(200,0,100));DrawCircle(img_modify,pre_pt,rad,THICKNESS,COLOR);}///////////////////Triangle left dragif( MODE == 4 ){if ( select(x,y,TAtemp.p[0].x,TAtemp.p[0].y) ){cur_pt.x = x;cur_pt.y = y;TAtemp.p[0] = Point(x,y);}if ( select(x,y,TAtemp.p[1].x,TAtemp.p[1].y) ){cur_pt.x = x;cur_pt.y = y;TAtemp.p[1] = Point(x,y);}if ( select(x,y,TAtemp.p[2].x,TAtemp.p[2].y) ){cur_pt.x = x;cur_pt.y = y;TAtemp.p[2] = Point(x,y);}}///////////////////Oval left dragif( MODE == 5){img_display.copyTo(img_modify);cur_pt = Point(x,y);int a = 2;int b = 20;circle(img_modify,pre_pt,2, Scalar(0,0,255),5,8);DrawRect(img_modify,pre_pt,cur_pt,1,Scalar(255,0,100));DrawOval(img_modify,pre_pt,cur_pt,THICKNESS,COLOR);//cv::ellipse(img_modify,pre_pt,Size(a,b),0,0,360,COLOR,THICKNESS,CV_AA);}if( MODE == 7){img_display.copyTo(img_modify);cur_pt = Point(x,y);cv::circle(img_modify,pre_pt,2, Scalar(0,0,255),5,8);cv::circle(img_modify,cur_pt,2, Scalar(0,0,255),5,8);DrawDotLine(img_modify,pre_pt,cur_pt,THICKNESS,COLOR);}/*/////////////////// Eraser if ( mode == 8 ){circle(img_mdfy,Point(x,y),2,Scalar(255,255,255),thickness);}*/}//=====================================Left relesae============================================if(event == CV_EVENT_LBUTTONUP ) {//////////////////spline - left click upif( MODE == 0 ) {}//////////////////line - left click upif (MODE == 1) {printf("left click on (%d, %d)\n", x, y);editing = false;end_pt = Point(x,y);DrawLine(img_modify,pre_pt,end_pt,THICKNESS,COLOR);Graphs g(1,pre_pt,end_pt,Point(-1,-1),Point(-1,-1),THICKNESS,COLOR);HISTORY.push_back(g);}//////////////////rectangle - left click upif (MODE == 2) {end_pt = Point(x,y);DrawRect(img_modify,pre_pt,end_pt,THICKNESS,COLOR);Graphs g(2,pre_pt,end_pt,Point(-1,-1),Point(-1,-1),THICKNESS,COLOR);HISTORY.push_back(g);editing = false;}////////////////circle - left click upif (MODE == 3){end_pt = Point(x,y);int rad = sqrt((cur_pt.x - pre_pt.x)*(cur_pt.x - pre_pt.x) + (cur_pt.y - pre_pt.y)*(cur_pt.y - pre_pt.y));DrawCircle(img_modify,pre_pt,rad,THICKNESS,COLOR);Graphs g(3,pre_pt,end_pt,Point(-1,-1),Point(-1,-1),THICKNESS,COLOR,rad);HISTORY.push_back(g);editing = false;}////////////////circle - left click upif ( MODE == 5){end_pt = Point(x,y);DrawOval(img_modify,pre_pt,end_pt,THICKNESS,COLOR);Graphs g(5,pre_pt,end_pt,Point(-1,-1),Point(-1,-1),THICKNESS,COLOR);HISTORY.push_back(g);editing = false;}//////////////////line - left click upif (MODE == 7) {printf("left click on (%d, %d)\n", x, y);editing = false;end_pt = Point(x,y);DrawDotLine(img_modify,pre_pt,end_pt,THICKNESS,COLOR);Graphs g(7,pre_pt,end_pt,Point(-1,-1),Point(-1,-1),THICKNESS,COLOR);HISTORY.push_back(g);}}}void on_mouse_tool(int event,int x,int y,int flags,void *ustc){if(event == CV_EVENT_LBUTTONDOWN ) // left press{//circle(img_tool,Point(x,y),2, Scalar(0,0,0),5,8);printf("Postiton: (%d, %d) \n",x,y);if ( y > 44 && y < 365) // shape select{if ( y > 44 && y < 108 ){if ( x > 20 && x < 90 ) MODE = 1;else if ( x > 112 && x < 182 ) MODE = 0;else return;}else if ( y > 130 && y < 195){if ( x > 20 && x < 90 ) MODE = 2;else if ( x > 112 && x < 182 ) MODE = 3;else return;}else if ( y > 215 && y < 277 ){if ( x > 20 && x < 90 ) MODE = 4;else if ( x > 112 && x < 182 ) MODE = 5;else return;}else{if ( x > 20 && x < 90 ) MODE = 6;else if ( x > 112 && x < 182 ) MODE = 7;else return;}}else if ( y > 435 && y < 565) // thickness select area{if ( y > 437 && y < 460) THICKNESS = 1;else if ( y > 460 && y < 490) THICKNESS = 2;else if ( y > 490 && y < 525) THICKNESS = 4;else if ( y > 525 && y < 565) THICKNESS = 8;}else if ( y > 628 && y < 660) // color selection line 1{if ( x > 20 && x < 55) COLOR = Scalar(0,0,0);else if ( x > 80 && x < 115) COLOR = Scalar(255,255,255);else if ( x > 135 && x < 170) COLOR = Scalar(0,0,255);}else if ( y > 680 && y < 715) // color selection line 2{if ( x > 20 && x < 55) COLOR = Scalar(0,255,0);else if ( x > 80 && x < 115) COLOR = Scalar(192,128,0);else if ( x > 135 && x < 170) COLOR = Scalar(255,128,255);}else if ( y > 735 && y < 785 ) // Save or goback{if ( x > 20 && x < 75) imwrite("Saved.jpg",img_display);else if (x > 120 && x < 175) HISTORY.pop_back();}}//=====================================mouse moving==============================================if( event == CV_EVENT_MOUSEMOVE ) //mouse moving { } }
draw.cpp
//---------draw.cpp----------// Main function of this porject:Drawing tool// This project implements a sinple drawing software based on OpenCV// To draw figure on white board, simply select the tool and configuration in tool box// For figure only need less than two dots, just click and drag. Otherwise, you can click on white board anywhere to finish you drawing// If you draw a polygon, the click on beginning dots will enclose your figure// Chick return botton on the right down coner to undo last draw// Click save to save your master piece as "Saved.jpg" at same folder of the project//-----------------------------#include "graphic.h"void main(int argc, char* argv[]){ // Static variable and image show initiallizing MODE = -1; THICKNESS = 5 ;editing = false; COLOR = Scalar(255,0,0);img_background.create(640,960,CV_8UC3);img_tool = imread("toolbox.png",1);cv::namedWindow("Editing Window",1); cv::namedWindow("Toolbox",1); // Set backgroundfor(int col = 0; col < 960; col++){for(int row = 0; row < 640; row ++){img_background.ptr<uchar>(row)[3 * col] = 255;img_background.ptr<uchar>(row)[3 * col + 1] = 255;img_background.ptr<uchar>(row)[3 * col + 2] = 255;}} // Set mouse call back setMouseCallback("Editing Window",on_mouse_edit); setMouseCallback("Toolbox",on_mouse_tool); // Display cycle while(true){ // --------- figure editing (with muiltiple click)if(editing){//img_display.copyTo(img_modify);if ( MODE == 0 ){img_display.copyTo(img_modify);if(SLtemp.full()) // if full, draw dots and spline{circle(img_modify,SLtemp.p[0],2, Scalar(0,255,255),5,8);circle(img_modify,SLtemp.p[1],2, Scalar(0,0,255),5,8);circle(img_modify,SLtemp.p[2],2, Scalar(0,0,255),5,8);circle(img_modify,SLtemp.p[3],2, Scalar(0,255,255),5,8);DrawSpline(img_modify,SLtemp.p[0],SLtemp.p[1],SLtemp.p[2],SLtemp.p[3],THICKNESS);DrawLine(img_modify,SLtemp.p[0],SLtemp.p[1],1,Scalar(200,0,230));DrawLine(img_modify,SLtemp.p[2],SLtemp.p[3],1,Scalar(200,0,230));}else // if not, draw dots only{if(SLtemp.remain < 4) circle(img_modify,SLtemp.p[0],2, Scalar(0,255,255),5,8);if(SLtemp.remain < 3) circle(img_modify,SLtemp.p[1],2, Scalar(0,0,255),5,8);if(SLtemp.remain < 2) circle(img_modify,SLtemp.p[2],2, Scalar(0,0,255),5,8);}}else if ( MODE == 4){img_display.copyTo(img_modify);if(TAtemp.full()) // if full, draw dots and triangle{circle(img_modify,TAtemp.p[0],2, Scalar(0,0,255),5,8);circle(img_modify,TAtemp.p[1],2, Scalar(0,0,255),5,8);circle(img_modify,TAtemp.p[2],2, Scalar(0,0,255),5,8);DrawTriangle(img_modify,TAtemp.p[0],TAtemp.p[1],TAtemp.p[2],THICKNESS);}else // if not, draw dots only{if(TAtemp.remain < 3) circle(img_modify,TAtemp.p[0],2, Scalar(0,255,255),5,8);if(TAtemp.remain < 2) circle(img_modify,TAtemp.p[1],2, Scalar(0,0,255),5,8);}}else if ( MODE == 6){img_display.copyTo(img_modify);if(PLtemp.size != 0 ) //if not empty, draw all dots first{for(int i = 0; i < PLtemp.size; i++){circle(img_modify,PLtemp.P_arr[i], 2, Scalar(0,0,255), 5,8);}}if(PLtemp.finish) // if full, draw all connection{DrawPolygon(img_modify,PLtemp.P_arr,PLtemp.size,THICKNESS,COLOR);}else if (PLtemp.size > 1) // if not, draw dots only{for(int i = 1; i < PLtemp.size; i++){line(img_modify,PLtemp.P_arr[i-1],PLtemp.P_arr[i],COLOR,THICKNESS,CV_AA);}}}}// Editing mode display setting end // --------- set display//cv::imshow("Editing Window",img_display); cv::imshow("Toolbox", img_tool); if(editing) // editing mode{imshow("Editing Window",img_modify);}else // refresh mode{ img_background.copyTo(img_display); // Reset the display image if (!HISTORY.empty()) // Draw all the graphs on display image layer by layer{ for(int i = 0; i < HISTORY.size(); i ++){ if ( HISTORY[i].type_ == 0 ) DrawSpline(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1],HISTORY[i].anchor_[2],HISTORY[i].anchor_[3],HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 1 ) DrawLine(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1], HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 2 ) DrawRect(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1], HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 3 ) DrawCircle(img_display,HISTORY[i].anchor_[0],HISTORY[i].optional_, HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 4 ) DrawTriangle(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1],HISTORY[i].anchor_[2],HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 5 ) DrawOval(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1],HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 6 ) DrawPolygon(img_display,HISTORY[i].extra_anchor_,HISTORY[i].optional_,HISTORY[i].thickness_,HISTORY[i].color_);if ( HISTORY[i].type_ == 7 ) DrawDotLine(img_display,HISTORY[i].anchor_[0],HISTORY[i].anchor_[1], -1,HISTORY[i].color_);// .... }}imshow("Editing Window",img_display); // Show the display imageimg_display.copyTo(img_modify); // Copy the last output image to intermidiat image} // --------- Keyboard response char c = cv::waitKey(1); if(c == 27) break;} return;}
0 0
- Microsoft Paint in OpenCV
- Microsoft in buying mood
- Two weeks in Microsoft
- paint
- Paint
- paint
- Paint
- Paint
- Paint
- paint
- paint
- paint
- paint
- Paint
- [openCV]基于Mouse Event的Paint的实现
- Microsoft - Lisence All in One
- Code Generation in Microsoft .NET
- Microsoft Reporting Services in Action
- 新浪微博数据挖掘食谱之十一: 用户篇 (批量获取用户信息)
- Apache之.htaccess备忘录(一)
- HDOJ 2064 汉诺塔III
- 你喜欢嘎哦跟小的
- Leetcode-Longest Palindromic Substring
- Microsoft Paint in OpenCV
- 关于逻辑坐标,设备坐标。分辨率变了之后,窗口如何布局
- SPRING DATA JPA 中几种缓存的配置
- qemu-kvm virtio 虚拟化-----Linux客户机 virtio设备初始化
- 【BZOJ】【P1293】【SCOI2009】【生日礼物】【题解】【水题】
- 2015,我和你的美国梦
- Leetcode-Median of Two Sorted Arrays 时间复杂度O(M+N)
- Android提示版本更新的实现
- 【一步一步学IOS5 】 在表视图中添加搜索栏