| | |
| | | using std::endl; |
| | | |
| | | #include "opencv2/opencv.hpp" |
| | | #include "opencv2/highgui.hpp" |
| | | #include "opencv2/highgui/highgui.hpp" |
| | | #include "opencv2/highgui/highgui_c.h" |
| | | #include "opencv2/imgproc/imgproc_c.h" |
| | | #ifndef CV_VERSION_EPOCH |
| | |
| | | } |
| | | return src; |
| | | } |
| | | |
| | | int get_stream_fps_cpp(CvCapture *cap) { |
| | | int fps = 25; |
| | | try { |
| | | cv::VideoCapture &cpp_cap = *(cv::VideoCapture *)cap; |
| | | #ifndef CV_VERSION_EPOCH // OpenCV 3.x |
| | | fps = cpp_cap.get(CAP_PROP_FPS); |
| | | #else // OpenCV 2.x |
| | | fps = cpp_cap.get(CV_CAP_PROP_FPS); |
| | | #endif |
| | | } |
| | | catch (...) { |
| | | std::cout << " Can't get FPS of source videofile. For output video FPS = 25 by default. \n"; |
| | | } |
| | | return fps; |
| | | } |
| | | // ---------------------------------------- |
| | | extern "C" { |
| | | image ipl_to_image(IplImage* src); // image.c |
| | |
| | | |
| | | // HSV augmentation |
| | | // CV_BGR2HSV, CV_RGB2HSV, CV_HSV2BGR, CV_HSV2RGB |
| | | cv::Mat hsv_src; |
| | | cvtColor(sized, hsv_src, CV_BGR2HSV); // also BGR -> RGB |
| | | if (ipl->nChannels >= 3) |
| | | { |
| | | cv::Mat hsv_src; |
| | | cvtColor(sized, hsv_src, CV_BGR2HSV); // also BGR -> RGB |
| | | |
| | | std::vector<cv::Mat> hsv; |
| | | cv::split(hsv_src, hsv); |
| | | std::vector<cv::Mat> hsv; |
| | | cv::split(hsv_src, hsv); |
| | | |
| | | hsv[1] *= dsat; |
| | | hsv[2] *= dexp; |
| | | hsv[0] += 179 * dhue; |
| | | hsv[1] *= dsat; |
| | | hsv[2] *= dexp; |
| | | hsv[0] += 179 * dhue; |
| | | |
| | | cv::merge(hsv, hsv_src); |
| | | cv::merge(hsv, hsv_src); |
| | | |
| | | cvtColor(hsv_src, sized, CV_HSV2RGB); // now RGB instead of BGR |
| | | cvtColor(hsv_src, sized, CV_HSV2RGB); // now RGB instead of BGR |
| | | } |
| | | else |
| | | { |
| | | sized *= dexp; |
| | | } |
| | | |
| | | // Mat -> IplImage -> image |
| | | IplImage src = sized; |
| | |
| | | } |
| | | |
| | | |
| | | #endif // OPENCV |
| | | #endif // OPENCV |