Python noob需要帮助!有人能告诉我如何用循环重写代码吗?尝试了一些不同的语法,但似乎不起作用!在
img = cv2.imread("C://Users//user//Desktop//research//images//Underwater_Caustics//set1//set1_color_0001.png")
tile11=img[1:640, 1:360]
cv2.imwrite('tile11_underwater_caustic_set1_0001.png', tile11)
tile12=img[641:1280, 1:360]
cv2.imwrite('tile12_underwater_caustic_set1_0001.png', tile12)
tile13=img[1281:1920, 1:360]
cv2.imwrite('tile13_underwater_caustic_set1_0001.png', tile13)
tile21=img[1:640, 361:720]
cv2.imwrite('tile21_underwater_caustic_set1_0001.png', tile21)
tile22=img[641:1280, 361:720]
cv2.imwrite('tile22_underwater_caustic_set1_0001.png', tile22)
tile23=img[1281:1920, 361:720]
cv2.imwrite('tile23_underwater_caustic_set1_0001.png', tile23)
tile31=img[1:640, 721:1080]
cv2.imwrite('tile31_underwater_caustic_set1_0001.png', tile31)
tile32=img[641:1280, 721:1080]
cv2.imwrite('tile32_underwater_caustic_set1_0001.png', tile32)
tile33=img[1281:1920, 721:1080]
cv2.imwrite('tile33_underwater_caustic_set1_0001.png', tile33)
如您所见,图像将被切成9个大小相等的块,如何使用循环来编写它?在
这是为大规模图像重建使用部分flowfree他的代码。通过在脚本所在的同一区域中使用切片图像的文件夹,可以重建图像。我希望这有帮助。在
这不会产生与代码相同的结果,但会给您一些想法:
我需要图像平铺,最后的部分或边缘瓷砖需要是完整的平铺图像。在
下面是我使用的代码:
相关问题 更多 >
编程相关推荐