Skip to content

Commit 7fd0f30

Browse files
committed
cuda resize onnx done
- rebase to 4.x
1 parent 2603516 commit 7fd0f30

File tree

4 files changed

+952
-2
lines changed

4 files changed

+952
-2
lines changed

modules/cudawarping/include/opencv2/cudawarping.hpp

+28
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,34 @@ supported for now.
107107
*/
108108
CV_EXPORTS_W void resize(InputArray src, OutputArray dst, Size dsize, double fx=0, double fy=0, int interpolation = INTER_LINEAR, Stream& stream = Stream::Null());
109109

110+
/** @brief onnx resize op
111+
https://github.com/onnx/onnx/blob/main/docs/Operators.md#Resize
112+
https://github.com/onnx/onnx/blob/main/onnx/reference/ops/op_resize.py
113+
114+
Not support `exclude_outside` and `extrapolation_value` yet.
115+
116+
To get a similar result to `cv::resize`, give dsize and:
117+
INTER_NEAREST : ASYMMETRIC + NEAREST_FLOOR
118+
INTER_LINEAR : HALF_PIXEL
119+
INTER_CUBIC : HALF_PIXEL + cubicCoeff(-0.75)
120+
121+
@param src input image.
122+
@param dst output image; it has the size dsize (when it is non-zero) or the size computed from src.size(), scale; the type of dst is the same as of src.
123+
@param dsize output image size; if it equals to zero, it is computed as:
124+
\f[\texttt{dsize = Size(int(scale.x * src.cols), int(scale.y * src.rows))}\f]
125+
Either dsize or scale must be non-zero.
126+
@param scale scale factor; use same definition as ONNX, if scale > 1, it's upsampling.
127+
@param interpolation interpolation / coordiante, see #InterpolationFlags and #ResizeONNXFlags
128+
@param cubicCoeff cubic sampling coeff; range \f[[-1.0, 0)\f]
129+
@param roi crop region; if provided, the rois' coordinates are normalized in the coordinate system of the input image; it only takes effect with INTER_TF_CROP_RESIZE (ONNX tf_crop_and_resize)
130+
@param stream Stream for the asynchronous version.
131+
132+
@sa resize, resizeOnnx
133+
*/
134+
CV_EXPORTS_W void resizeOnnx(InputArray src, OutputArray dst, Size dsize,
135+
Point2d scale = Point2d(), int interpolation = INTER_LINEAR | INTER_HALF_PIXEL,
136+
float cubicCoeff = -0.75f, Rect2d const& roi = Rect2d(), Stream& stream = Stream::Null());
137+
110138
/** @brief Applies an affine transformation to an image.
111139
112140
@param src Source image. CV_8U , CV_16U , CV_32S , or CV_32F depth and 1, 3, or 4 channels are

0 commit comments

Comments
 (0)