【发布时间】:2022-01-01 20:30:20
【问题描述】:
我正在尝试在灰度视频上实现全变分算法。据我了解,这种方法(denoise_TVL1)正在使用该算法。但我得到“输入参数的大小不匹配”CvException。你能帮我理解问题是什么吗?
我有这个列表作为类实例:
public static List<Mat> test = new ArrayList<Mat>();
// src is Mat obj given as parameter
Mat resizedSrc = new Mat();
Size scaleSize = new Size(960,540);
Imgproc.resize(src, resizedSrc, scaleSize);
Mat dst = new Mat(scaleSize, resizedSrc.type());
// On first frame I add resized image to my list, because denoise_TVL1 requirest list as input
// I also tried it without if condition
if(test.isEmpty()){
test.add(resizedSrc);
}
//On this line I get CvException
Photo.denoise_TVL1(test, dst);
// Then I return filtered image
MatOfByte buffer2 = new MatOfByte();
Imgcodecs.imencode(".png", dst, buffer2);
return new Image(new ByteArrayInputStream(buffer2.toArray()));
精确输出:
线程“JavaFX 应用程序线程”中的异常 CvException [org.opencv.core.CvException: cv::Exception: OpenCV(4.5.1) C:\build\master_winpack-bindings-win64-vc14-static\opencv\modules\core\ src\arithm.cpp:669: error: (-209:Sizes of input arguments do not match) 该操作既不是'array op array'(其中数组具有相同的大小和相同的通道数),也不是'array op函数“cv::arithm_op”中的标量和“标量运算数组”
]
它说输入不匹配但它们总是相同的,尤其是在 if 条件下,我总是只发送第一帧作为列表。
【问题讨论】: