tiff批量转png

目录

  • 写在前面
  • 代码

写在前面

1、本文内容
tiff批量转png

2、平台/环境
opencv, python
3、转载请注明出处:
https://blog.csdn.net/qq_41102371/article/details/132975023

代码

import numpy as np
import cv2


import os

def findAllFile(base):
  file_list=[]
  for root, ds, fs in os.walk(base):
      for f in fs:
        if 'tiff' in f:
          fullname = os.path.join(root, f)
          file_list.append(fullname)
  return file_list


if __name__=="__main__":
  base = './images_0'
  file_list=findAllFile(base)
  for ind,file_name in enumerate(file_list):
    print(file_name)
    img = cv2.imread(file_name,1)
    # cv2.namedWindow("img", cv2.WINDOW_NORMAL)
    # cv2.imshow("img",img)
    # cv2.waitKey(0)
    
    # cv2.imwrite("./image_0_png/"+str(ind)+".png", img )
    cv2.imwrite("./image_1_png/"+str(ind)+".png", img )

主要做激光/影像三维重建,配准、分割等常用点云算法,技术交流、咨询可私信

你可能感兴趣的:(opencv,图像处理,python,opencv,图像处理)