简体   繁体   中英

OpenCV Scalar multiplication gives weird result

In OpenCV, multiplying two scalars returns unexpected result, for example:

cv::Scalar s1(2, 3, 4);
cv::Scalar s2(2, 3, 4);
cv::Scalar s3 = s1 * s2; 

where I expect s3 should be [4,9,16,0] ,however the result is [-21, 12, 16, 0] , I would like to know the logic behind it. Thanks!

From the commonet above ,I would like to summary that the source code of operator* is defined here and the logic behind it is quaternion product .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM