File size: 390 Bytes
e22b55b
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import cv2
import numpy as np

class MeanProcess:
    def __init__(self, R_Mean, G_Mean, B_Mean):
        self.R_Mean= R_Mean
        self.G_Mean= G_Mean
        self.B_Mean= B_Mean

    def preprocess(self, image):
        image= np.float32(image)
        B,G,R= cv2.split(image)

        B-= self.B_Mean
        G-= self.G_Mean
        R-= self.R_Mean

        return cv2.merge([B, G, R])