python,opencv,8位图转24位图

# -*- coding: utf-8 -*-
"""
Created on Tue Sep 11 18:50:42 2018

@author: LX
"""

import cv2
import os
def data_eight_twentyfor(filedir,savedir,i):
    list=os.listdir(filedir)
    print(len(list))
   """
    for file in os.listdir(filedir):
        img=cv2.imread(file)
        bgr2gray = cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
        aa = cv2.cvtColor(bgr2gray,cv2.COLOR_GRAY2BGR)
        cv2.imwrite(savedir+i+'.jpg',aa)
        i=i+1
"""


if __name__=='__main__':
    filedir='D:\\thumbimg'
    savedir='D:\\newresult\\'
    i=0
    data_eight_twentyfor(filedir,savedir,i)

 

posted @ 2019-02-12 11:26  yangly  阅读(2480)  评论(0编辑  收藏  举报