Вопрос

In a OpenCV project I'm trying to blend to images with addweighted.

In the beginning of the section I make sure, all the Mat-objects have the same settings

HSVgreen = calibHSV;
HSVblue = calibHSV;
HSVyellow = calibHSV;
HSVred = calibHSV;
HSVall = calibHSV;

After this, I'm using an inRange operation:

inRange(calibHSV, Scalar(H_MIN, S_MIN, V_MIN), Scalar(H_MAX, S_MAX, V_MAX), HSVred);

Right after the inRange there is the addWeighted command which brings me the "Size of input arguments does not match" exception.

addWeighted(HSVgreen,ALPHA_VAL,HSVred,ALPHA_VAL,0.0,HSVall);

After inspecting the args for a while I found out that the HSVred Mat gets changed during a inRange operation just befor the addWeighted cmd.

In the section "step" of the HSVred-Object ,the argument "p" gets changed from 1200 to 400, so that a changes happens to the array"buf".
What does this change mean? What do I need to do, so I still can execute this addWeighted command?

Это было полезно?

Решение

I just check the doc, here is the inRange function:

OpenCV doc: inRange()

So your input array is a three channels picture, and the output array will be a one channel picture, that is why 1200 has been changed to 400. (1200/3)

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top