@@ -77,17 +77,13 @@ void cv::gpu::addWeighted(InputArray, double, InputArray, double, double, Output
77
77
78
78
double cv::gpu::threshold (InputArray, OutputArray, double , double , int , Stream&) {throw_no_cuda (); return 0.0 ;}
79
79
80
- void cv::gpu::magnitude (const GpuMat&, GpuMat&, Stream&) { throw_no_cuda (); }
81
- void cv::gpu::magnitude (const GpuMat&, const GpuMat&, GpuMat&, Stream&) { throw_no_cuda (); }
82
-
83
- void cv::gpu::magnitudeSqr (const GpuMat&, GpuMat&, Stream&) { throw_no_cuda (); }
84
- void cv::gpu::magnitudeSqr (const GpuMat&, const GpuMat&, GpuMat&, Stream&) { throw_no_cuda (); }
85
-
86
- void cv::gpu::phase (const GpuMat&, const GpuMat&, GpuMat&, bool , Stream&) { throw_no_cuda (); }
87
-
88
- void cv::gpu::cartToPolar (const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, bool , Stream&) { throw_no_cuda (); }
89
-
90
- void cv::gpu::polarToCart (const GpuMat&, const GpuMat&, GpuMat&, GpuMat&, bool , Stream&) { throw_no_cuda (); }
80
+ void cv::gpu::magnitude (InputArray, OutputArray, Stream&) { throw_no_cuda (); }
81
+ void cv::gpu::magnitude (InputArray, InputArray, OutputArray, Stream&) { throw_no_cuda (); }
82
+ void cv::gpu::magnitudeSqr (InputArray, OutputArray, Stream&) { throw_no_cuda (); }
83
+ void cv::gpu::magnitudeSqr (InputArray, InputArray, OutputArray, Stream&) { throw_no_cuda (); }
84
+ void cv::gpu::phase (InputArray, InputArray, OutputArray, bool , Stream&) { throw_no_cuda (); }
85
+ void cv::gpu::cartToPolar (InputArray, InputArray, OutputArray, OutputArray, bool , Stream&) { throw_no_cuda (); }
86
+ void cv::gpu::polarToCart (InputArray, InputArray, OutputArray, OutputArray, bool , Stream&) { throw_no_cuda (); }
91
87
92
88
#else
93
89
@@ -3005,12 +3001,10 @@ namespace
3005
3001
{
3006
3002
typedef NppStatus (*nppMagnitude_t)(const Npp32fc* pSrc, int nSrcStep, Npp32f* pDst, int nDstStep, NppiSize oSizeROI);
3007
3003
3008
- inline void npp_magnitude (const GpuMat& src, GpuMat& dst, nppMagnitude_t func, cudaStream_t stream)
3004
+ void npp_magnitude (const GpuMat& src, GpuMat& dst, nppMagnitude_t func, cudaStream_t stream)
3009
3005
{
3010
3006
CV_Assert (src.type () == CV_32FC2);
3011
3007
3012
- dst.create (src.size (), CV_32FC1);
3013
-
3014
3008
NppiSize sz;
3015
3009
sz.width = src.cols ;
3016
3010
sz.height = src.rows ;
@@ -3024,13 +3018,23 @@ namespace
3024
3018
}
3025
3019
}
3026
3020
3027
- void cv::gpu::magnitude (const GpuMat& src, GpuMat& dst , Stream& stream)
3021
+ void cv::gpu::magnitude (InputArray _src, OutputArray _dst , Stream& stream)
3028
3022
{
3023
+ GpuMat src = _src.getGpuMat ();
3024
+
3025
+ _dst.create (src.size (), CV_32FC1);
3026
+ GpuMat dst = _dst.getGpuMat ();
3027
+
3029
3028
npp_magnitude (src, dst, nppiMagnitude_32fc32f_C1R, StreamAccessor::getStream (stream));
3030
3029
}
3031
3030
3032
- void cv::gpu::magnitudeSqr (const GpuMat& src, GpuMat& dst , Stream& stream)
3031
+ void cv::gpu::magnitudeSqr (InputArray _src, OutputArray _dst , Stream& stream)
3033
3032
{
3033
+ GpuMat src = _src.getGpuMat ();
3034
+
3035
+ _dst.create (src.size (), CV_32FC1);
3036
+ GpuMat dst = _dst.getGpuMat ();
3037
+
3034
3038
npp_magnitude (src, dst, nppiMagnitudeSqr_32fc32f_C1R, StreamAccessor::getStream (stream));
3035
3039
}
3036
3040
@@ -3048,18 +3052,13 @@ namespace cv { namespace gpu { namespace cudev
3048
3052
3049
3053
namespace
3050
3054
{
3051
- inline void cartToPolar_caller (const GpuMat& x, const GpuMat& y, GpuMat* mag, bool magSqr, GpuMat* angle, bool angleInDegrees, cudaStream_t stream)
3055
+ void cartToPolar_caller (const GpuMat& x, const GpuMat& y, GpuMat* mag, bool magSqr, GpuMat* angle, bool angleInDegrees, cudaStream_t stream)
3052
3056
{
3053
3057
using namespace ::cv::gpu::cudev::mathfunc;
3054
3058
3055
3059
CV_Assert (x.size () == y.size () && x.type () == y.type ());
3056
3060
CV_Assert (x.depth () == CV_32F);
3057
3061
3058
- if (mag)
3059
- mag->create (x.size (), x.type ());
3060
- if (angle)
3061
- angle->create (x.size (), x.type ());
3062
-
3063
3062
GpuMat x1cn = x.reshape (1 );
3064
3063
GpuMat y1cn = y.reshape (1 );
3065
3064
GpuMat mag1cn = mag ? mag->reshape (1 ) : GpuMat ();
@@ -3068,16 +3067,13 @@ namespace
3068
3067
cartToPolar_gpu (x1cn, y1cn, mag1cn, magSqr, angle1cn, angleInDegrees, stream);
3069
3068
}
3070
3069
3071
- inline void polarToCart_caller (const GpuMat& mag, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, cudaStream_t stream)
3070
+ void polarToCart_caller (const GpuMat& mag, const GpuMat& angle, GpuMat& x, GpuMat& y, bool angleInDegrees, cudaStream_t stream)
3072
3071
{
3073
3072
using namespace ::cv::gpu::cudev::mathfunc;
3074
3073
3075
3074
CV_Assert ((mag.empty () || mag.size () == angle.size ()) && mag.type () == angle.type ());
3076
3075
CV_Assert (mag.depth () == CV_32F);
3077
3076
3078
- x.create (mag.size (), mag.type ());
3079
- y.create (mag.size (), mag.type ());
3080
-
3081
3077
GpuMat mag1cn = mag.reshape (1 );
3082
3078
GpuMat angle1cn = angle.reshape (1 );
3083
3079
GpuMat x1cn = x.reshape (1 );
@@ -3087,29 +3083,65 @@ namespace
3087
3083
}
3088
3084
}
3089
3085
3090
- void cv::gpu::magnitude (const GpuMat& x, const GpuMat& y, GpuMat& dst , Stream& stream)
3086
+ void cv::gpu::magnitude (InputArray _x, InputArray _y, OutputArray _dst , Stream& stream)
3091
3087
{
3088
+ GpuMat x = _x.getGpuMat ();
3089
+ GpuMat y = _y.getGpuMat ();
3090
+
3091
+ _dst.create (x.size (), CV_32FC1);
3092
+ GpuMat dst = _dst.getGpuMat ();
3093
+
3092
3094
cartToPolar_caller (x, y, &dst, false , 0 , false , StreamAccessor::getStream (stream));
3093
3095
}
3094
3096
3095
- void cv::gpu::magnitudeSqr (const GpuMat& x, const GpuMat& y, GpuMat& dst , Stream& stream)
3097
+ void cv::gpu::magnitudeSqr (InputArray _x, InputArray _y, OutputArray _dst , Stream& stream)
3096
3098
{
3099
+ GpuMat x = _x.getGpuMat ();
3100
+ GpuMat y = _y.getGpuMat ();
3101
+
3102
+ _dst.create (x.size (), CV_32FC1);
3103
+ GpuMat dst = _dst.getGpuMat ();
3104
+
3097
3105
cartToPolar_caller (x, y, &dst, true , 0 , false , StreamAccessor::getStream (stream));
3098
3106
}
3099
3107
3100
- void cv::gpu::phase (const GpuMat& x, const GpuMat& y, GpuMat& angle , bool angleInDegrees, Stream& stream)
3108
+ void cv::gpu::phase (InputArray _x, InputArray _y, OutputArray _dst , bool angleInDegrees, Stream& stream)
3101
3109
{
3102
- cartToPolar_caller (x, y, 0 , false , &angle, angleInDegrees, StreamAccessor::getStream (stream));
3110
+ GpuMat x = _x.getGpuMat ();
3111
+ GpuMat y = _y.getGpuMat ();
3112
+
3113
+ _dst.create (x.size (), CV_32FC1);
3114
+ GpuMat dst = _dst.getGpuMat ();
3115
+
3116
+ cartToPolar_caller (x, y, 0 , false , &dst, angleInDegrees, StreamAccessor::getStream (stream));
3103
3117
}
3104
3118
3105
- void cv::gpu::cartToPolar (const GpuMat& x, const GpuMat& y, GpuMat& mag, GpuMat& angle , bool angleInDegrees, Stream& stream)
3119
+ void cv::gpu::cartToPolar (InputArray _x, InputArray _y, OutputArray _mag, OutputArray _angle , bool angleInDegrees, Stream& stream)
3106
3120
{
3121
+ GpuMat x = _x.getGpuMat ();
3122
+ GpuMat y = _y.getGpuMat ();
3123
+
3124
+ _mag.create (x.size (), CV_32FC1);
3125
+ GpuMat mag = _mag.getGpuMat ();
3126
+
3127
+ _angle.create (x.size (), CV_32FC1);
3128
+ GpuMat angle = _angle.getGpuMat ();
3129
+
3107
3130
cartToPolar_caller (x, y, &mag, false , &angle, angleInDegrees, StreamAccessor::getStream (stream));
3108
3131
}
3109
3132
3110
- void cv::gpu::polarToCart (const GpuMat& magnitude, const GpuMat& angle, GpuMat& x, GpuMat& y , bool angleInDegrees, Stream& stream)
3133
+ void cv::gpu::polarToCart (InputArray _mag, InputArray _angle, OutputArray _x, OutputArray _y , bool angleInDegrees, Stream& stream)
3111
3134
{
3112
- polarToCart_caller (magnitude, angle, x, y, angleInDegrees, StreamAccessor::getStream (stream));
3135
+ GpuMat mag = _mag.getGpuMat ();
3136
+ GpuMat angle = _angle.getGpuMat ();
3137
+
3138
+ _x.create (mag.size (), CV_32FC1);
3139
+ GpuMat x = _x.getGpuMat ();
3140
+
3141
+ _y.create (mag.size (), CV_32FC1);
3142
+ GpuMat y = _y.getGpuMat ();
3143
+
3144
+ polarToCart_caller (mag, angle, x, y, angleInDegrees, StreamAccessor::getStream (stream));
3113
3145
}
3114
3146
3115
3147
#endif
0 commit comments