-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcanny_img.cpp
More file actions
39 lines (22 loc) · 709 Bytes
/
canny_img.cpp
File metadata and controls
39 lines (22 loc) · 709 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
#include <opencv2/opencv.hpp>
#include <cstdio>
#include <cstdlib>
#include <iostream>
using namespace std;
void detect_edge(cv::Mat);
int main(int argc, char** argv){
cv::Mat img_orig = cv::imread("1.jpg", -1);
cout << "Called function";
detect_edge(img_orig);
}
void detect_edge(cv::Mat img_original){
cv::Mat img_gray, img_canny;
// img_original = cv::imread("1.jpg", -1);
cv::cvtColor(img_original, img_gray, cv::COLOR_BGR2GRAY);
cv::namedWindow("gray image", cv::WINDOW_AUTOSIZE);
cv::imshow("gray image", img_gray);
cv::Canny(img_gray, img_canny, 10, 100, 3, true);
cv::namedWindow("canny image", cv::WINDOW_AUTOSIZE);
cv::imshow("canny image", img_canny);
cv::waitKey(0);
}