It's quite common (for me) to be confused.
So, just copy the snippet from now on:
img = cv2.imread('./my_img.png')
resized_img = cv2.resize(img,
(img.shape[1], img.shape[0])
)
# HEIGHT, WIDTH = img.shape[0:2]
# resized_img = cv2.resize(img, (WIDTH, HEIGHT))
1
constructor

2
constructor of the Size
class

3

construct function of the Mat
class
Mat(int rows, int cols , int type)
Mat(Size(int cols, int rows), int type)
- Mat use (row,col)
- Point and Size use
(x,y)
, or notate as (width,height)
In other words, these access the same point:
mat.at<type>(y,x)
(cpp)
or your_img_ndarray[y][x]
(python)
mat.at<type>(cv::Point(x,y))
(cpp)
The opencv doc is mainly for C++ code:

- dsize: size of output image
if it equals zero (None in Python), it is computed as:
dsize = Size(round(fx*src.cols), round(fy*src.rows))
1. explicitly specify dsize=dst.size() :
fx and fy will be computed from that.
resize(src, dst, dst.size(), 0, 0, interpolation);
- fx: scale factor along the horizontal axis; when it equals 0, it is computed as
(double)dsize.width/src.cols
2. specify fx and fy , let the function compute the destination image size.
resize(src, dst, Size(), 0.5, 0.5, interpolation);