OpenCV的是主要針對real-time計算機視覺的編程函數庫。cv2.transpose()
方法用於轉置2D數組。函數cv::transpose將圖像逆時針旋轉90度。
用法: cv2.cv.transpose( src[, dst] )
參數:
src:它是要轉置矩陣的圖像。
dst:它是與src圖像大小和深度相同的輸出圖像。它是一個可選參數。
Return Value:它返回一個圖像。
用於以下所有示例的圖像:
例:
# Python program to explain cv2.transpose() method
# importing cv2
import cv2
# path
path = r'C:\Users\user\Desktop\geeks14.png'
# Reading an image in default mode
src = cv2.imread(path)
# Window name in which image is displayed
window_name = 'Image'
# Using cv2.transpose() method
image = cv2.transpose(src)
# Displaying the image
cv2.imshow(window_name, image)
cv2.waitKey(0)
輸出:
相關用法
- Python OpenCV cv2.imread()用法及代碼示例
- Python OpenCV cv2.imshow()用法及代碼示例
- Python OpenCV cv2.imwrite()用法及代碼示例
- Python OpenCV cv2.line()用法及代碼示例
- Python OpenCV cv2.rectangle()用法及代碼示例
- Python OpenCV cv2.circle()用法及代碼示例
- Python OpenCV cv2.putText()用法及代碼示例
- Python OpenCV cv2.ellipse()用法及代碼示例
- Python OpenCV cv2.cvtColor()用法及代碼示例
- Python OpenCV cv2.copyMakeBorder()用法及代碼示例
- Python OpenCV cv2.arrowedLine()用法及代碼示例
- Python OpenCV cv2.blur()用法及代碼示例
- Python OpenCV cv2.erode()用法及代碼示例
注:本文由純淨天空篩選整理自divyamohan123大神的英文原創作品 Python OpenCV – cv2.transpose() method。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。