@@ -3053,6 +3053,82 @@ void _OutputArray::assign(const Mat& m) const
3053
3053
}
3054
3054
3055
3055
3056
+ void _OutputArray::assign (const std::vector<UMat>& v) const
3057
+ {
3058
+ int k = kind ();
3059
+ if (k == STD_VECTOR_UMAT)
3060
+ {
3061
+ std::vector<UMat>& this_v = *(std::vector<UMat>*)obj;
3062
+ CV_Assert (this_v.size () == v.size ());
3063
+
3064
+ for (size_t i = 0 ; i < v.size (); i++)
3065
+ {
3066
+ const UMat& m = v[i];
3067
+ UMat& this_m = this_v[i];
3068
+ if (this_m.u != NULL && this_m.u == m.u )
3069
+ continue ; // same object (see dnn::Layer::forward_fallback)
3070
+ m.copyTo (this_m);
3071
+ }
3072
+ }
3073
+ else if (k == STD_VECTOR_MAT)
3074
+ {
3075
+ std::vector<Mat>& this_v = *(std::vector<Mat>*)obj;
3076
+ CV_Assert (this_v.size () == v.size ());
3077
+
3078
+ for (size_t i = 0 ; i < v.size (); i++)
3079
+ {
3080
+ const UMat& m = v[i];
3081
+ Mat& this_m = this_v[i];
3082
+ if (this_m.u != NULL && this_m.u == m.u )
3083
+ continue ; // same object (see dnn::Layer::forward_fallback)
3084
+ m.copyTo (this_m);
3085
+ }
3086
+ }
3087
+ else
3088
+ {
3089
+ CV_Error (Error::StsNotImplemented, " " );
3090
+ }
3091
+ }
3092
+
3093
+
3094
+ void _OutputArray::assign (const std::vector<Mat>& v) const
3095
+ {
3096
+ int k = kind ();
3097
+ if (k == STD_VECTOR_UMAT)
3098
+ {
3099
+ std::vector<UMat>& this_v = *(std::vector<UMat>*)obj;
3100
+ CV_Assert (this_v.size () == v.size ());
3101
+
3102
+ for (size_t i = 0 ; i < v.size (); i++)
3103
+ {
3104
+ const Mat& m = v[i];
3105
+ UMat& this_m = this_v[i];
3106
+ if (this_m.u != NULL && this_m.u == m.u )
3107
+ continue ; // same object (see dnn::Layer::forward_fallback)
3108
+ m.copyTo (this_m);
3109
+ }
3110
+ }
3111
+ else if (k == STD_VECTOR_MAT)
3112
+ {
3113
+ std::vector<Mat>& this_v = *(std::vector<Mat>*)obj;
3114
+ CV_Assert (this_v.size () == v.size ());
3115
+
3116
+ for (size_t i = 0 ; i < v.size (); i++)
3117
+ {
3118
+ const Mat& m = v[i];
3119
+ Mat& this_m = this_v[i];
3120
+ if (this_m.u != NULL && this_m.u == m.u )
3121
+ continue ; // same object (see dnn::Layer::forward_fallback)
3122
+ m.copyTo (this_m);
3123
+ }
3124
+ }
3125
+ else
3126
+ {
3127
+ CV_Error (Error::StsNotImplemented, " " );
3128
+ }
3129
+ }
3130
+
3131
+
3056
3132
static _InputOutputArray _none;
3057
3133
InputOutputArray noArray () { return _none; }
3058
3134
0 commit comments