How i can take the average of 100 image using opencv?

后端 未结 3 2015
南方客
南方客 2021-02-06 02:54

i have 100 image, each one is 598 * 598 pixels, and i want to remove the pictorial and noise by taking the average of pixels, but if i want to use Adding for \"pixel by pixel\"t

3条回答
  •  名媛妹妹
    2021-02-06 03:53

    Suppose that the images will not need to undergo transformations (gamma, color space, or alignment). The numpy package lets you do this quickly and succinctly.

    # List of images, all must be the same size and data type.
    images=[img0, img1, ...]
    avg_img = np.mean(images, axis=0)
    

    This will auto-promote the elements to float. If you want the as BGR888, then:

    avg_img = avg_img.astype(np.uint8)
    

    Could also do uint16 for 16 bits per channel. If you are dealing with 8 bits per channel, you almost certainly won't need 100 images.

提交回复
热议问题