Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main()
- {
- Mat src; Mat src_gray;
- src = imread("D:/2.jpg");
- cvtColor(src, src_gray, COLOR_BGR2GRAY);
- cv::blur(src_gray, src_gray, Size(1, 15));
- Canny(src_gray, src_gray, 100, 200, 3);
- /// Find contours
- vector<vector<Point> > contours;
- vector<Vec4i> hierarchy;
- RNG rng(12345);
- findContours(src_gray, contours, hierarchy, CV_RETR_TREE, CV_CHAIN_APPROX_SIMPLE, Point(0, 0));
- /// Draw contours
- Mat drawing = Mat::zeros(src_gray.size(), CV_8UC3);
- for (int i = 0; i < contours.size(); i++)
- {
- drawContours(drawing, contours, i, (255), 1, 8, hierarchy, 0, Point());
- }
- imshow("Result window", drawing);
- imwrite("D:/C_Backup_Folder/Ivan_codes/VideoStitcher/result/2_res.jpg", drawing);
- cv::waitKey();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement