项目位置:OpenCV-Sample
代码位置:45-spiltPictureToNxN.py
效果:
原图:

裁剪后的效果:

import cv2 as cv
row = 15
column = 15
org_img = cv.imread('D:\code\pic.jpg')
height, width = org_img.shape[:2]
print('height %d widht %d' % (height, width))
row_step = (int)(height/row)
column_step = (int)(width/column)
print('row step %d col step %d'% (row_step, column_step))
print('height %d widht %d' % (row_step*row, column_st

本文介绍了如何利用OpenCV库在Python中将一张图片分割成NxN的小块,通过提供的代码示例45-spiltPictureToNxN.py展示了具体的实现过程,从而帮助提高深度学习数据集的质量。

7749

被折叠的 条评论
为什么被折叠?



