T
T
tj572019-11-30 01:12:48
C++ / C#
tj57, 2019-11-30 01:12:48

How to fix "sizes of input arguments do not match" error in OpenCV?

The error occurs when calling the weighted sum function AddWeighted (on the last line). The BLOCK_SIZE parameter is 100.

Scalar newColor = Scalar(0, 0, 0);
if (firstScore > secondScore)
{
  newColor = Scalar(255, 255, 255);
}
else
{
  newColor = Scalar(0, 0, 0);
}
Mat fragment = resultMat(Rect(j * BLOCK_SIZE, i * BLOCK_SIZE, BLOCK_SIZE, BLOCK_SIZE));
Mat color(fragment.size(), CV_8UC3, newColor);
double alpha = 1.0;
addWeighted(color, alpha, fragment, 1.0 - alpha, 0.0, fragment);

Error code:
5de1977408e66246357290.jpeg
What is causing the error? Perhaps the CV_8UC3 format is incorrect in this case?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question