且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用Python裁剪图像中的矩形

更新时间:2023-01-22 19:04:04

如果您具有矩形的坐标,则可以尝试:

if you have the coordinates of the rectangles you can try:

cropped = img [y1:y2, x1:x2]

cv2.imwrite('cropped.png', cropped)