【发布时间】:2019-10-20 15:01:29
【问题描述】:
我的任务是为深度学习生成数据。我拍摄种子图像,旋转它们并在背景上随机绘制它们。问题是旋转导致图像周围出现虚线边界,我无法弄清楚它出现的原因或如何摆脱它。
def rotateSeed(img):
rotated = imutils.rotate_bound(img, randint(0,360))
for row in range(rotated.shape[0]):
for col in range(rotated.shape[1]):
if (rotated[row,col,0] == 0) and (rotated[row,col,1] == 0) and (rotated[row,col,2] == 0):
rotated[row,col] = default[0,0]
return rotated
代码说明:默认为种子图片的背景色。旋转会产生一个我用默认值覆盖的黑色区域。
只有一个人遇到过这个问题,解决方案并不能解释太多。它甚至没有旋转:OpenCV
【问题讨论】:
-
你可以看看这个..pyimagesearch.com/2017/01/02/…
-
问题可能出在数据上,而不是轮换代码。
标签: python-2.7 opencv image-processing image-rotation imutils