1
1
#include " processing.hpp"
2
2
3
- int getFrame (const std::string &fileName, Mat& src)
4
- {
5
- src = imread (fileName);
6
- if (src.empty ())
7
- {
8
- return 1 ;
9
- }
10
- return 0 ;
11
- }
3
+ #include < opencv2/imgproc/imgproc.hpp>
12
4
13
- int processFrame (const Mat& src, Mat& dst)
5
+ using namespace cv ;
6
+
7
+ void Processing::processFrame (const cv::Mat& src, cv::Mat& dst)
14
8
{
15
9
src.copyTo (dst);
16
10
17
11
cv::Rect region (src.rows /4 , src.cols /4 , src.rows /2 , src.cols /2 );
18
- const int kSize = 11 ;
19
12
Mat roi = dst (region);
20
- medianBlur (roi, roi, kSize );
21
- rectangle (dst, region, Scalar (255 , 0 , 0 ));
22
13
23
- if (dst.empty ())
24
- {
25
- return 1 ;
26
- }
14
+ const int kSize = 11 ;
15
+ medianBlur (roi, roi, kSize );
27
16
28
- return 0 ;
17
+ rectangle (dst, region, Scalar ( 255 , 0 , 0 )) ;
29
18
}
30
-
31
- int show (const std::string &caption, const Mat& src, const Mat& dst)
32
- {
33
- if (src.rows != dst.rows || src.cols != dst.cols )
34
- {
35
- return 1 ;
36
- }
37
-
38
- Mat display (src.rows , src.cols + dst.cols , src.type ());
39
- Mat srcRoi = display (Rect (0 , 0 , src.cols , src.rows ));
40
- src.copyTo (srcRoi);
41
- Mat dstRoi = display (Rect (src.cols , 0 , dst.cols , dst.rows ));
42
- dst.copyTo (dstRoi);
43
-
44
- namedWindow (caption);
45
- imshow (caption, display);
46
- char key = waitKey (1 );
47
-
48
- return key;
49
- }
0 commit comments