python opencv cv2.resize()函数
生活随笔
收集整理的這篇文章主要介紹了
python opencv cv2.resize()函数
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
**def resize(src, dsize, dst=None, fx=None, fy=None, interpolation=None): # real signature unknown; restored from __doc__"""resize(src, dsize[, dst[, fx[, fy[, interpolation]]]]) -> dst. @brief Resizes an image. 調(diào)整圖像大小。. . The function resize resizes the image src down to or up to the specified size. Note that the. initial dst type or size are not taken into account. Instead, the size and type are derived from. the `src`,`dsize`,`fx`, and `fy`. If you want to resize src so that it fits the pre-created dst,. you may call the function as follows:函數(shù)調(diào)整大小可將圖像src調(diào)整為指定大小或最大。 請注意,未考慮初始dst類型或大小。 相反,大小和類型是從src,dsize,fx和fy派生的。 如果要調(diào)整src的大小以使其適合預(yù)先創(chuàng)建的dst,則可以按以下方式調(diào)用該函數(shù):. @code 代碼. // explicitly specify 明確指定 dsize=dst.size(); fx and fy will be computed from that. fx和fy將據(jù)此計算。. resize(src, dst, dst.size(), 0, 0, interpolation);. @endcode 結(jié)束代碼. If you want to decimate the image by factor of 2 in each direction, you can call the function this. way:如果要在每個方向上將圖像縮小2倍,則可以通過以下方式調(diào)用該函數(shù):. @code. // specify fx and fy and let the function compute the destination image size.指定fx和fy并讓函數(shù)計算目標圖像尺寸。. resize(src, dst, Size(), 0.5, 0.5, interpolation);. @endcode. To shrink an image, it will generally look best with #INTER_AREA interpolation, whereas to. enlarge an image, it will generally look best with c#INTER_CUBIC (slow) or #INTER_LINEAR. (faster but still looks OK).要縮小圖像,通常使用#INTER_AREA插值效果最佳,而要放大圖像,通常使用c#INTER_CUBIC(速度慢)或#INTER_LINEAR(速度更快,但看起來仍然可以)最好。. . @param src input image. 輸入圖像. @param dst output image; it has the size dsize (when it is non-zero) or the size computed from. src.size(), fx, and fy; the type of dst is the same as of src.輸出圖像; 它的大小為dsize(非零時)或通過src.size(),fx和fy計算得出的大小; dst的類型與src相同。. @param dsize output image size; if it equals zero, it is computed as:. \f[\texttt{dsize = Size(round(fx*src.cols), round(fy*src.rows))}\f]. Either dsize or both fx and fy must be non-zero.輸出圖像尺寸; 如果它等于零,則計算為:\ f [\ texttt {dsize = Size(round(fx * src.cols),round(fy * src.rows))} \ f]。dsize或fx和fy都必須為非零。. @param fx scale factor along the horizontal axis; when it equals 0, it is computed as. \f[\texttt{(double)dsize.width/src.cols}\f]沿水平軸的比例因子; 當它等于0時,將計算為\ f [\ texttt {(double)dsize.width / src.cols} \ f]. @param fy scale factor along the vertical axis; when it equals 0, it is computed as. \f[\texttt{(double)dsize.height/src.rows}\f]沿垂直軸的比例因子; 當它等于0時,將計算為\ f [\ texttt {(double)dsize.height / src.rows} \ f]. @param interpolation interpolation method, see #InterpolationFlags插值方法,請參見#InterpolationFlags. . @sa warpAffine, warpPerspective, remap"""pass**
參考文章:cv2.resize()函數(shù)應(yīng)用示例——python opencv 等比例調(diào)整圖片分辨率大小代碼 cv2.resize()
與50位技術(shù)專家面對面20年技術(shù)見證,附贈技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的python opencv cv2.resize()函数的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python中列表 元组 字典 集合的区
- 下一篇: 如何在C++中调用python程序?