python 生成高斯斑块

x33g5p2x  于2022-04-28 转载在 Python  
字(0.9k)|赞(0)|评价(0)|浏览(420)

矩形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()

相关文章