cv::Mat frame;
if (!cap.read(frame))
{
std::cerr << "Failed to read frame from camera!" << std::endl;
return -1;
}
ImageData image;
image.alignWidth = image.width = frame.cols;
image.alignHeight = image.height = frame.rows;
image.format = PIXEL_FORMAT_BGR_888;
image.size = frame.total() * frame.elemSize();
uint8_t *buf = new(std::nothrow) uint8_t[image.size];
image.data.reset((uint8_t *)buf, [](uint8_t* p) { delete[](p); });
std::memcpy(image.data.get(), frame.data, image.size);
ImageData resizedImage;
//resize
ret = detect.dvpp_.Resize(resizedImage, image, 416, 416);
if (ret == ACLLITE_ERROR) {
ACLLITE_LOG_ERROR("Resize image failed");
return ACLLITE_ERROR;
}
大佬好! 使用的310B , 修改的YOLOV3_VOC_detection_picture, sample 例程,运行报错, 可能是哪方面原因,上面的 Mat 数据结构,转 imagedata 结构有问题吗? 谢谢; 另外咱们有 opencv c++ 处理 uvc camera 的例程吗, 我看 都是基于 树莓派camera的
cv::Mat frame;
if (!cap.read(frame))
{
std::cerr << "Failed to read frame from camera!" << std::endl;
return -1;
}
ImageData image;
image.alignWidth = image.width = frame.cols;
image.alignHeight = image.height = frame.rows;
image.format = PIXEL_FORMAT_BGR_888;
image.size = frame.total() * frame.elemSize();
uint8_t *buf = new(std::nothrow) uint8_t[image.size];
image.data.reset((uint8_t *)buf, [](uint8_t* p) { delete[](p); });
std::memcpy(image.data.get(), frame.data, image.size);
ImageData resizedImage;
//resize
ret = detect.dvpp_.Resize(resizedImage, image, 416, 416);
if (ret == ACLLITE_ERROR) {
ACLLITE_LOG_ERROR("Resize image failed");
return ACLLITE_ERROR;
}
大佬好! 使用的310B , 修改的YOLOV3_VOC_detection_picture, sample 例程,运行报错, 可能是哪方面原因,上面的 Mat 数据结构,转 imagedata 结构有问题吗? 谢谢; 另外咱们有 opencv c++ 处理 uvc camera 的例程吗, 我看 都是基于 树莓派camera的
int ACL_ERROR_INVALID_PARAM = 100000;
参数校验失败。
请检查接口的入参值是否正确。