@@ -11,6 +11,7 @@ package cuda
1111import "C"
1212
1313import (
14+ "image"
1415 "unsafe"
1516
1617 "gocv.io/x/gocv"
@@ -641,3 +642,147 @@ func RShiftWithStream(src GpuMat, shift gocv.Scalar, dst *GpuMat, s Stream) erro
641642 }
642643 return OpenCVResult (C .GpuRShift (src .p , cShift , dst .p , s .p ))
643644}
645+
646+ // AbsSum computes the sum of absolute values of array elements.
647+ // For further details, see:
648+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga690fa79ba4426c53f7d2bebf3d37a32a
649+ func AbsSum (src GpuMat ) (gocv.Scalar , error ) {
650+ var cResult C.struct_Scalar
651+ err := OpenCVResult (C .GpuAbsSum (src .p , nil , & cResult ))
652+ return gocv.Scalar {
653+ Val1 : float64 (cResult .val1 ),
654+ Val2 : float64 (cResult .val2 ),
655+ Val3 : float64 (cResult .val3 ),
656+ Val4 : float64 (cResult .val4 ),
657+ }, err
658+ }
659+
660+ // AbsSumWithMask computes the sum of absolute values of array elements using a mask.
661+ // For further details, see:
662+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga690fa79ba4426c53f7d2bebf3d37a32a
663+ func AbsSumWithMask (src , mask GpuMat ) (gocv.Scalar , error ) {
664+ var cResult C.struct_Scalar
665+ err := OpenCVResult (C .GpuAbsSum (src .p , mask .p , & cResult ))
666+ return gocv.Scalar {
667+ Val1 : float64 (cResult .val1 ),
668+ Val2 : float64 (cResult .val2 ),
669+ Val3 : float64 (cResult .val3 ),
670+ Val4 : float64 (cResult .val4 ),
671+ }, err
672+ }
673+
674+ // CalcAbsSum computes the sum of absolute values of array elements and stores the result in dst.
675+ // For further details, see:
676+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga15c403b76ab2c4d7ed0f5edc09891b7e
677+ func CalcAbsSum (src GpuMat , dst * GpuMat ) error {
678+ return OpenCVResult (C .GpuCalcAbsSum (src .p , dst .p , nil , nil ))
679+ }
680+
681+ // CalcAbsSumWithMask computes the sum of absolute values of array elements using a mask and stores the result in dst.
682+ // For further details, see:
683+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga15c403b76ab2c4d7ed0f5edc09891b7e
684+ func CalcAbsSumWithMask (src GpuMat , dst * GpuMat , mask GpuMat ) error {
685+ return OpenCVResult (C .GpuCalcAbsSum (src .p , dst .p , mask .p , nil ))
686+ }
687+
688+ // CalcAbsSumWithStream computes the sum of absolute values of array elements and stores the result in dst using a Stream.
689+ // For further details, see:
690+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga15c403b76ab2c4d7ed0f5edc09891b7e
691+ func CalcAbsSumWithStream (src GpuMat , dst * GpuMat , mask GpuMat , s Stream ) error {
692+ return OpenCVResult (C .GpuCalcAbsSum (src .p , dst .p , mask .p , s .p ))
693+ }
694+
695+ // MinMax computes the global minimum and maximum in a GpuMat.
696+ // For further details, see:
697+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga8d7de68c10717cf25e787e3c20d2dfee
698+ func MinMax (src GpuMat ) (minVal , maxVal float64 , err error ) {
699+ var cMin , cMax C.double
700+ e := OpenCVResult (C .GpuMinMax (src .p , nil , & cMin , & cMax ))
701+ return float64 (cMin ), float64 (cMax ), e
702+ }
703+
704+ // MinMaxWithMask computes the global minimum and maximum in a GpuMat using a mask.
705+ // For further details, see:
706+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga8d7de68c10717cf25e787e3c20d2dfee
707+ func MinMaxWithMask (src , mask GpuMat ) (minVal , maxVal float64 , err error ) {
708+ var cMin , cMax C.double
709+ e := OpenCVResult (C .GpuMinMax (src .p , mask .p , & cMin , & cMax ))
710+ return float64 (cMin ), float64 (cMax ), e
711+ }
712+
713+ // MinMaxLoc finds the global minimum and maximum in a GpuMat as well as their locations.
714+ // For further details, see:
715+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga5cacbc2a2323c4eaa81e7390c5d9f530
716+ func MinMaxLoc (src GpuMat ) (minVal , maxVal float64 , minLoc , maxLoc image.Point , err error ) {
717+ var cMin , cMax C.double
718+ var minLocX , minLocY , maxLocX , maxLocY C.int
719+ e := OpenCVResult (C .GpuMinMaxLoc (src .p , nil , & cMin , & cMax , & minLocX , & minLocY , & maxLocX , & maxLocY ))
720+ return float64 (cMin ), float64 (cMax ),
721+ image .Pt (int (minLocX ), int (minLocY )),
722+ image .Pt (int (maxLocX ), int (maxLocY )),
723+ e
724+ }
725+
726+ // MinMaxLocWithMask finds the global minimum and maximum in a GpuMat as well as their locations, using a mask.
727+ // For further details, see:
728+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga5cacbc2a2323c4eaa81e7390c5d9f530
729+ func MinMaxLocWithMask (src , mask GpuMat ) (minVal , maxVal float64 , minLoc , maxLoc image.Point , err error ) {
730+ var cMin , cMax C.double
731+ var minLocX , minLocY , maxLocX , maxLocY C.int
732+ e := OpenCVResult (C .GpuMinMaxLoc (src .p , mask .p , & cMin , & cMax , & minLocX , & minLocY , & maxLocX , & maxLocY ))
733+ return float64 (cMin ), float64 (cMax ),
734+ image .Pt (int (minLocX ), int (minLocY )),
735+ image .Pt (int (maxLocX ), int (maxLocY )),
736+ e
737+ }
738+
739+ // Normalize scales and shifts array elements so that they cover a certain range.
740+ // For further details, see:
741+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga4da4738b9956a5baaa2f5f8c2fba438a
742+ func Normalize (src GpuMat , dst * GpuMat , alpha , beta float64 , normType gocv.NormType , dtype int ) error {
743+ return OpenCVResult (C .GpuNormalize (src .p , dst .p , C .double (alpha ), C .double (beta ), C .int (normType ), C .int (dtype ), nil , nil ))
744+ }
745+
746+ // NormalizeWithMask scales and shifts array elements so that they cover a certain range, using a mask.
747+ func NormalizeWithMask (src GpuMat , dst * GpuMat , alpha , beta float64 , normType gocv.NormType , dtype int , mask GpuMat ) error {
748+ return OpenCVResult (C .GpuNormalize (src .p , dst .p , C .double (alpha ), C .double (beta ), C .int (normType ), C .int (dtype ), mask .p , nil ))
749+ }
750+
751+ // NormalizeWithStream scales and shifts array elements so that they cover a certain range, using a mask and Stream.
752+ func NormalizeWithStream (src GpuMat , dst * GpuMat , alpha , beta float64 , normType gocv.NormType , dtype int , mask GpuMat , s Stream ) error {
753+ return OpenCVResult (C .GpuNormalize (src .p , dst .p , C .double (alpha ), C .double (beta ), C .int (normType ), C .int (dtype ), mask .p , s .p ))
754+ }
755+
756+ // FindMinMaxLoc finds the minimum and maximum values and their locations in a GpuMat.
757+ // For further details, see:
758+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#ga93916bc473a62d215d1130fab84d090a
759+ func FindMinMaxLoc (src GpuMat , minMaxVals , loc * GpuMat ) error {
760+ return OpenCVResult (C .GpuFindMinMaxLoc (src .p , minMaxVals .p , loc .p , nil , nil ))
761+ }
762+
763+ // FindMinMaxLocWithMask finds the minimum and maximum values and their locations in a GpuMat using a mask.
764+ func FindMinMaxLocWithMask (src GpuMat , minMaxVals , loc * GpuMat , mask GpuMat ) error {
765+ return OpenCVResult (C .GpuFindMinMaxLoc (src .p , minMaxVals .p , loc .p , mask .p , nil ))
766+ }
767+
768+ // FindMinMaxLocWithStream finds the minimum and maximum values and their locations in a GpuMat using a mask and Stream.
769+ func FindMinMaxLocWithStream (src GpuMat , minMaxVals , loc * GpuMat , mask GpuMat , s Stream ) error {
770+ return OpenCVResult (C .GpuFindMinMaxLoc (src .p , minMaxVals .p , loc .p , mask .p , s .p ))
771+ }
772+
773+ // FindMinMax finds the minimum and maximum values in a GpuMat and stores them in dst.
774+ // For further details, see:
775+ // https://docs.opencv.org/4.x/d5/de6/group__cudaarithm__reduce.html#gae7f5f2aa9f65314470a76fccdff887f2
776+ func FindMinMax (src GpuMat , dst * GpuMat ) error {
777+ return OpenCVResult (C .GpuFindMinMax (src .p , dst .p , nil , nil ))
778+ }
779+
780+ // FindMinMaxWithMask finds the minimum and maximum values in a GpuMat using a mask and stores them in dst.
781+ func FindMinMaxWithMask (src GpuMat , dst * GpuMat , mask GpuMat ) error {
782+ return OpenCVResult (C .GpuFindMinMax (src .p , dst .p , mask .p , nil ))
783+ }
784+
785+ // FindMinMaxWithStream finds the minimum and maximum values in a GpuMat using a mask and Stream, and stores them in dst.
786+ func FindMinMaxWithStream (src GpuMat , dst * GpuMat , mask GpuMat , s Stream ) error {
787+ return OpenCVResult (C .GpuFindMinMax (src .p , dst .p , mask .p , s .p ))
788+ }
0 commit comments