[英]CNN Classification Keras Frames
如果我理解正确,您想裁剪图像,取其中心部分。 如果图像大小相同,您可以像这样对它们进行切片(数字仅作为示例):
y0 = 10 # the y top coordinate of the rectangle to extract
height = 40 # the height of the rectangle you want to extract
x0 = 10 # the x left coordinate of the rectangle
width = 20 # the width of the rectangle
# img is the newly cropped image
img = x[y0:y0+height,x0:x0+width, :]
重要提示:设置x0和y0坐标时,你必须给你要裁剪的矩形左上角的position。 坐标系的原点O也位于图像的左上角。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.