|
|
@@ -89,23 +89,26 @@ namespace Trainning {
|
|
|
// cout << "res:" << res << endl;
|
|
|
|
|
|
VideoCapture cap;
|
|
|
- cap.open("/Users/drew/Desktop/Screenrecorder-2019-01-23-16-03-53-600.mp4");
|
|
|
- long total = cap.get(CAP_PROP_FRAME_COUNT);
|
|
|
- long curr = 0;
|
|
|
+ if(!cap.open("rtmp://49.4.66.233:1935/myapp/test")) {
|
|
|
+ cout << "Error opening video stream or file" << std::endl;
|
|
|
+ exit(-1);
|
|
|
+ }
|
|
|
bool matched = false;
|
|
|
Mat frame;
|
|
|
+ int curr = 0;
|
|
|
while(1)
|
|
|
{
|
|
|
cap.read(frame);//等价于cap.read(frame);
|
|
|
if(frame.empty())
|
|
|
break;
|
|
|
if (curr % 3 == 0){
|
|
|
- cout << curr << "/" << total << endl;
|
|
|
Mat v;
|
|
|
-// rotate(frame, frame, ROTATE_90_COUNTERCLOCKWISE);
|
|
|
+ if (frame.cols < frame.rows) {
|
|
|
+ rotate(frame, frame, ROTATE_90_COUNTERCLOCKWISE);
|
|
|
+ }
|
|
|
resize(frame, v, Size(854,480));
|
|
|
imshow("v", v);
|
|
|
- waitKey(1 );
|
|
|
+ waitKey(1);
|
|
|
Mat p = v.reshape(1, 1);
|
|
|
p.convertTo(p, CV_32FC1);
|
|
|
float res = svm->predict(p);
|