#include<iostream>
#include<opencv2/opencv.hpp>
using namespace cv;
using namespace std;
int main()
{
VideoCapture capture;
Mat frame;
const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
// frame= capture.open("789.mp4");
frame= capture.open(source);
if(!capture.isOpened())
{
printf("can not open ...\n");
return -1;
}
printf("1213131\n");
// namedWindow("output", CV_WINDOW_AUTOSIZE);
while (capture.read(frame))
{
imshow("output", frame);
waitKey(10);
}
capture.release();
return 0;
}
Reason: Path. I have a permission problem with this server, and it will report an error if I write the full path. And the executable file I generated and the video file are not in the same directory, …/789.mp4 will not be read, only the two put together to read. Later I found out that
The constructor of capture.open() passed in a const string, so I instantiated a const string source first, then I could write the full path, and then passed it in.
const string source = "/home/gear/big_disk_c/wangjd/shipintest/789.mp4";
frame= capture.open(source);
Read More:
- [Solved] Opencv Error: Error: Assertion failed (data) in cv::Mat::at, file … mat.inl.hpp, line 897(Accessed pixels of non-existent matrix)
- Error: array bound is not an integer constant before ‘]’ token
- No match for ‘operator =’ both ends of the equal sign do not match
- [Solved] C + + compile Error: error: default argument given for parameter 3
- [Solved] error MSB3073: CMake that the project does not need compatibility with older versions.
- [Solved] Vscode Error: “export ‘default‘ (imported as ‘VueRouter‘) was not found in ‘vue-router‘
- [Error] invalid operands to binary ^ (have ‘double‘ and ‘float‘)
- C++ BUG: [Error] invalid array assignment
- How to Fix “initializer element is not constant” error
- [How to Solve] Easyclick read text garbled
- How to Solve error C2039: “to_ String “: not a member of” STD “
- [Solved] Vs error: link: fatal error lnk1168: unable to open for writing
- MOTR compiling error: cannot call member function ‘void std::basic_string<_CharT, _Traits, _Alloc>::_R
- [Solved] Hadoop Error: Error: Could not find or load main class org.apache.hadoop.mapreduce.v2.app.MRAppMaster
- [Solved] Oracle Delete the Archive Error: RMAN-08137
- [Solved] iperf Analyze Error: unable to create a new stream: Invalid argument
- [Solved] ESP32 Error: error: expected initializer before ‘__result_use_check‘
- DM Install Error: error while loading shared libraries: libdmnsort.so:
- Template Render Error Solution (Hexo blog theme, GIT upload)
- buildroot SIGSTKSZ Error: make[5]: *** [Makefile:1915: c-stack.o] Error 1