@@ -423,11 +423,10 @@ static cv::Moments cpp(const interop::Moments &m)
423423// no heap cv::_InputArray is allocated per call. Use the InProxy/OutProxy/IoProxy
424424// views below at the head of a CVAPI body.
425425//
426- // Scalar/Double inputs: cv::_InputArray references a cv::Scalar, so the caller must
427- // keep `scalarScratch` alive for the whole OpenCV call (one scratch per input that
428- // may be a scalar).
429- // Vec inputs: cv::_InputArray references proxy.payload; the by-value parameter copy
430- // stays valid for the call.
426+ // Scalar inputs: cv::_InputArray references a cv::Scalar, so the caller must keep
427+ // `scalarScratch` alive for the whole OpenCV call (one scratch per scalar input).
428+ // Double/Vec inputs: cv::_InputArray references proxy.payload; the proxy stays valid
429+ // for the call.
431430// -------------------------------------------------------------------------
432431static cv::_InputArray fromInputProxy (const interop::InputArrayProxy &p, cv::Scalar &scalarScratch)
433432{
@@ -437,9 +436,9 @@ static cv::_InputArray fromInputProxy(const interop::InputArrayProxy &p, cv::Sca
437436 case 2 : return cv::_InputArray (*static_cast <cv::UMat *>(p.handle ));
438437 case 3 : return cv::_InputArray (*static_cast <cv::MatExpr *>(p.handle ));
439438 case 4 :
440- case 5 :
441439 scalarScratch = cv::Scalar (p.payload [0 ], p.payload [1 ], p.payload [2 ], p.payload [3 ]);
442440 return cv::_InputArray (scalarScratch);
441+ case 5 : return cv::_InputArray (p.payload [0 ]);
443442 case 6 :
444443 switch (p.vecDepth )
445444 {
@@ -493,10 +492,10 @@ static cv::_InputOutputArray fromInputOutputProxy(const interop::InputOutputArra
493492class InProxy
494493{
495494 // Stable storage for a scalar operand. A cv::_InputArray built from a cv::Scalar keeps a POINTER
496- // to that Scalar (it does not copy it), so the Scalar must outlive the _InputArray's use. For
497- // Scalar/Double kinds fromInputProxy() writes scratch_ and returns a cv::_InputArray referencing
495+ // to that Scalar (it does not copy it), so the Scalar must outlive the _InputArray's use.
496+ // For the Scalar kind, fromInputProxy() writes scratch_ and returns a cv::_InputArray referencing
498497 // it; holding scratch_ as a member keeps it alive for the whole OpenCV call (the InProxy lives to
499- // the end of the call expression). Unused for Mat/UMat/MatExpr/Vec/Raw kinds.
498+ // the end of the call expression). Unused for Mat/UMat/MatExpr/Double/ Vec/Raw kinds.
500499 cv::Scalar scratch_;
501500 cv::_InputArray ia_;
502501public:
0 commit comments