我需要检测和分段的开放式卡车在道路上的负载。如何使用背景减法和mask R-CNN屏蔽和提取负载区域
作为一个简单的例子,我下载了一个背景图片和Photoshop的卡车和负载到
背景:https://i.ibb.co/DpSWc84/Original.jpg
修改:https://i.ibb.co/6NVsYGq/Modified.jpg
我使用了BS和Mask R-CNN,但是输出不够合适。输出屏蔽包括卡车边界区域和装载区域的一些孔和噪声
def applyMask(image, maskList): # apply masks that created by Mask R-CNN to image
masked_for_load = resize(image,maskList[0].shape)
for mask in maskList :
masked_for_load[:, :] = np.where(mask == 1,0,masked_for_load[:, :]) # set pixels that include cars or trucks to zero
return masked_for_load
(score, diff) = compare_ssim(grayA, grayB, full=True)
diff = (diff * 255).astype("uint8")
# threshold the difference image, followed by finding contours to obtain the regions of the two input images that differ
thresh = cv2.threshold(diff, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
# output mask, ready to apply on original image
loadMask = applyMask(thresh,maskList)
掩码R-CNN输出:https://i.ibb.co/jgxr65Z/bar-out.jpg
BS输出:https://i.ibb.co/yQZT0V4/before-mask.jpg
从BS输出减去R-CNN输出后:https://i.ibb.co/JqZwfvg/after-mask.jpg
但是预期的输出必须是这样的:https://i.ibb.co/z40fqjq/expected.jpg
如何使用python、opencv和keras工具实现这一点
目前没有回答
相关问题 更多 >
编程相关推荐