Read Multiple images on a folder in OpenCv (python)

前端 未结 6 1315
孤独总比滥情好
孤独总比滥情好 2021-01-31 06:15

I want to read multiple images on a same folder using opencv (python). To do that do I need to use for loop or while loop with imread func

6条回答
  •  清歌不尽
    2021-01-31 06:40

    This one has better time efficiency.

    def read_img(img_list, img):
        n = cv2.imread(img, 0)
        img_list.append(n)
        return img_list
    
    path = glob.glob("*.bmp") #or jpg
    list_ = []`
    
    cv_image = [read_img(list_, img) for img in path]
    
    

提交回复
热议问题