python 生成高斯斑块

python 生成高斯斑块,第1张

矩形roi填充斑块

import cv2
import numpy as np
img = np.zeros([200,200,3],np.uint8)
img[:,:,:]=255

img[50:100,50:100]=[0,0,0]
cv2.imshow("asdf",img)


img_ = cv2.GaussianBlur(img,(51,51),0)
cv2.imshow('img_',img_)

cv2.waitKey()

圆形roi填充斑块

import cv2
import numpy as np
img = np.zeros([200,200,3],np.uint8)
img[:,:,:]=255

img = cv2.circle(img, (100, 100), 50, (0, 0, 0), -1)
# img = cv2.circle(img, (50, 50), 50, (255, 0, 0), 1, 8, 0)  # 画圆

# img[50:100,50:100]=[0,0,0]
cv2.imshow("img",img)


img_ = cv2.GaussianBlur(img,(51,51),0)
cv2.imshow('result',img_)

cv2.waitKey()

椭圆roi

import cv2
import numpy as np
img = np.zeros([200,200,3],np.uint8)
img[:,:,:]=255

img=cv2.ellipse(img, (100,100), (75, 50), 0, 0, 360, (0, 0, 0), -1)
# img = cv2.circle(img, (100, 100), 50, (0, 0, 0), -1)
# img = cv2.circle(img, (50, 50), 50, (255, 0, 0), 1, 8, 0)  # 画圆

# img[50:100,50:100]=[0,0,0]
cv2.imshow("img",img)


img_ = cv2.GaussianBlur(img,(51,51),0)
cv2.imshow('result',img_)

cv2.waitKey()

欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/langs/756619.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-04-30
下一篇 2022-04-30

发表评论

登录后才能评论

评论列表(0条)

保存