c++ - 错误的数组新长度
问题描述
我正在尝试显示来自网络摄像机的视频,但是当我声明摄像机 ulr 时,程序显示错误的数组新长度。
#include <stdio.h>
#include <iostream>
#include <opencv2/opencv.hpp>
int main(int, char**) {
cv::VideoCapture vcap;
cv::Mat image;
// This works on a D-Link CDS-932Lrtsp://<Admin:mmcc2019>@10.5.1.101/
const std::string videoSt = "http://192.168.226.101:8080/video?x.mjpeg";
std::cout <<"lenght og the cmera ulr is" <<videoSt.length() << std::endl;
//open the video stream and make sure it's opened
if (!vcap.open(videoSt)) {
std::cout << "Error opening video stream or file" << std::endl;
return -1;
}
for (;;) {
if (!vcap.read(image)) {
std::cout << "No frame" << std::endl;
cv::waitKey();
}
cv::imshow("Output Window", image);
if (cv::waitKey(1) >= 0) break;
}
}
解决方案
我刚遇到同样的问题,因为我是opencv_world412.lib
在调试模式下使用的;切换到发布模式,或使用opencv_world412d.lib
将解决此问题。
推荐阅读
- java - 连接时Postgresql java无限循环
- algorithm - Youtube 生成视频片段的算法是什么?
- css - 如何制作包含图像和文本的 4 列,并在同一行中为每列设置链接?
- javascript - MEAN堆栈:通过表单数据将图像文件存储在mongodb中?
- python - 根据指定删除重复的列表字典
- javascript - jquery通过点击标签删除一行table()
- tar - 无法使用 apache-vfs-2.2 读取 tar 文件中的 .any 文件
- curl - 卷曲错误
- java - 使用 RestController 自动装配 Bean 类时出错
- javascript - 如何将文件中的 CSV 表解析为 D3 和弦图?