#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] Cmake compile opencv open-source project Error: but it set OpenCV_FOUND to FALSE so package “OpenCV” is considered to be…
- [Solved] OpenCV error: #error “This header with legacy C API declarations has been removed from OpenCV.
- [Solved] VScode Run C++ File Error: fatal error:opencv2\core.hpp:No such file or diretory
- C++ new types may not be defined in a return type Error?
- [Solved] Opencv3. X fatal error: opencv2/nonfree/nonfree.hpp: there is no such file or directory
- Opencv Can not Find opencv2/gpu/gpu.hpp [How to Solve]
- [Solved] Opencv Calls PB Model Error: cv2.error: OpenCV(4.2.0)…
- [Solved] Error ‘false‘ undeclared (first use in this function)
- C++ Opencv+BaiDu OCR“error“: “unsupported_grant_type“, “error_description“: “The authorization grant
- [Solved] Ubuntu uses gym to save the video error: “unknown encoder ‘libx264′”
- [Solved] Eval Error: Uncaught ReferenceError: False is not defined
- The Ajax return value reports an error, and the spring boot development Ajax return value reports an error
- [Solved] The “QtRunWork“ task returned false but did not log an error
- How to Solve Namedparameterjdbctemplate.queryforobject() Return Error
- Tidb2.1 reports Error statement count 5001 exceeded the transaction limit, autocommit = false
- CMake Error: The source directory “opencv Install Catalog“ does not appear to contain CMakeLists.txt.
- [Solved] ORB_SLAM3 Compile Error: opencv4.0 not found four
- [Solved] Opencv Error: Error: Assertion failed (data) in cv::Mat::at, file … mat.inl.hpp, line 897(Accessed pixels of non-existent matrix)
- Avpro Video Error: MediaPlayer.FileLocation [How to Solve]
- How to Fix win10 video dxgkrnl fatal error