@@ -22,3 +22,27 @@ d) - our filter
2222## Edge detection
2323Here is the output of Canny edge detector that was applied on the image with and without preprocessing with our filter.
2424![ edges] ( /images/edge_detection.png )
25+ 26+ ## Code usage
27+ Libraries used:
28+ - opencv 4.3.0 for the usage of Mat type
29+ 30+ Here is the simple example of filter usage with opencv Mat images:
31+ 32+ ``` cpp
33+ // opencv included in Source.cpp if you need to change include path,
34+ // you should change it there
35+ #include " Source.cpp"
36+ 37+ int main ()
38+ {
39+ cv::Mat matImage = cv::imread("your_input_file_name", cv::IMREAD_COLOR); //read images using opencv from file into Mat type
40+ 41+ int kernelSize = 3; //set kernelSize = 3 for filtering with 3x3 kernel
42+ Filter<float, uint8_t> filter; //create the instance of filter
43+ cv::Mat matOutput = filter(matImage, kernelSize); //filter image
44+ 45+ cv::imwrite ("your_output_file_name", matOutput); //write the result
46+ return 0;
47+ }
48+ ```
0 commit comments