vandanavk commented on a change in pull request #13357: Add imresize and
copyMakeBorder to mx.image
URL: https://github.com/apache/incubator-mxnet/pull/13357#discussion_r237679110
##########
File path: python/mxnet/image/image.py
##########
@@ -85,10 +83,67 @@ def imread(filename, *args, **kwargs):
return _internal._cvimread(filename, *args, **kwargs)
+def imresize(src, w, h, *args, **kwargs):
+ r"""Resize image with OpenCV.
+
+ .. note:: `imresize` uses OpenCV (not the CV2 Python library). MXNet must
have been built
+ with USE_OPENCV=1 for `imresize` to work.
+
+ Parameters
+ ----------
+ src : NDArray
+ source image
+ w : int, required
+ Width of resized image.
+ h : int, required
+ Height of resized image.
+ interp : int, optional, default=1
+ Interpolation method (default=cv2.INTER_LINEAR).
+ Possible values:
+ 0: Nearest Neighbors Interpolation.
+ 1: Bilinear interpolation.
+ 2: Area-based (resampling using pixel area relation). It may be a
+ preferred method for image decimation, as it gives moire-free
+ results. But when the image is zoomed, it is similar to the Nearest
+ Neighbors method. (used by default).
+ 3: Bicubic interpolation over 4x4 pixel neighborhood.
+ 4: Lanczos interpolation over 8x8 pixel neighborhood.
+ 9: Cubic for enlarge, area for shrink, bilinear for others
+ 10: Random select from interpolation method metioned above.
+ Note:
+ When shrinking an image, it will generally look best with AREA-based
+ interpolation, whereas, when enlarging an image, it will generally
look best
+ with Bicubic (slow) or Bilinear (faster but still looks OK).
+ More details can be found in the documentation of OpenCV, please refer
to
+ http://docs.opencv.org/master/da/d54/group__imgproc__transform.html.
+
+ out : NDArray, optional
+ The output NDArray to hold the result.
+
+ Returns
+ -------
+ out : NDArray or list of NDArrays
+ The output of this function.
+
+ Example
Review comment:
nit: Examples
This may give a make docs error
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services