python类randn()的实例源码

faceaugmentation.py 文件源码 项目:AWSLambdaFace 作者: excamera 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def augment_image(rgbImg):
    augmented_images = []

    # original image
    augmented_images.append(rgbImg)

    # fliped x-axis
    rimg = rgbImg.copy()
    cv2.flip(rimg, 1, rimg)
    augmented_images.append(rimg)

    # add gaussian noise
    for _ in range(10):
        gaussian_noise = rgbImg.copy()
        cv2.randn(gaussian_noise, 0, 150)
        augmented_images.append(rgbImg + gaussian_noise)
        augmented_images.append(rimg + gaussian_noise)

    for _ in range(10):
        uniform_noise = rgbImg.copy()
        cv2.randu(uniform_noise, 0, 1)
        augmented_images.append(rgbImg + uniform_noise)
        augmented_images.append(rimg + uniform_noise)

    return augmented_images
video.py 文件源码 项目:piwall-cvtools 作者: infinnovation 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
video.py 文件源码 项目:python-opencv2 作者: bunkahle 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
video.py 文件源码 项目:emojivis 作者: JustinShenk 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
signal_generator.py 文件源码 项目:colorcs 作者: ch3njust1n 项目源码 文件源码 阅读 36 收藏 0 点赞 0 评论 0
def applyNoise(self, gaussian):

        # clone HSV channels first
        from copy import deepcopy
        self.n_h = deepcopy(self.h)
        self.n_s = deepcopy(self.s)
        self.n_v = deepcopy(self.v)

        mean, var = gaussian.get('mean'), gaussian.get('var')

        cv2.randn(self.n_h, mean, var)
        cv2.randn(self.n_s, mean, var)
        cv2.randn(self.n_v, mean, var)
video.py 文件源码 项目:OpenCV-Snapchat-DogFilter 作者: sguduguntla 项目源码 文件源码 阅读 19 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
video.py 文件源码 项目:OpenCV-Snapchat-DogFilter 作者: sguduguntla 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        noise = np.zeros(self.render.sceneBg.shape, np.int8)
        cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)

        return True, cv2.add(self.render.getNextFrame(), noise, dtype=cv2.CV_8UC3)
video.py 文件源码 项目:OpenCV-Snapchat-DogFilter 作者: sguduguntla 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        noise = np.zeros(self.render.sceneBg.shape, np.int8)
        cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)

        return True, cv2.add(self.render.getNextFrame(), noise, dtype=cv2.CV_8UC3)
video.py 文件源码 项目:memegenerator 作者: Huxwell 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
video.py 文件源码 项目:Image-Processing-and-Feature-Detection 作者: amita-kapoor 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        w, h = self.frame_size

        if self.bg is None:
            buf = np.zeros((h, w, 3), np.uint8)
        else:
            buf = self.bg.copy()

        self.render(buf)

        if self.noise > 0.0:
            noise = np.zeros((h, w, 3), np.int8)
            cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)
            buf = cv2.add(buf, noise, dtype=cv2.CV_8UC3)
        return True, buf
video.py 文件源码 项目:Image-Processing-and-Feature-Detection 作者: amita-kapoor 项目源码 文件源码 阅读 30 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        noise = np.zeros(self.render.sceneBg.shape, np.int8)
        cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)

        return True, cv2.add(self.render.getNextFrame(), noise, dtype=cv2.CV_8UC3)
video.py 文件源码 项目:Image-Processing-and-Feature-Detection 作者: amita-kapoor 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def read(self, dst=None):
        noise = np.zeros(self.render.sceneBg.shape, np.int8)
        cv2.randn(noise, np.zeros(3), np.ones(3)*255*self.noise)

        return True, cv2.add(self.render.getNextFrame(), noise, dtype=cv2.CV_8UC3)


问题


面经


文章

微信
公众号

扫码关注公众号