【问题标题】:Feet pressure points for pronation detection in foot scan image足部扫描图像中用于旋前检测的足部压力点
【发布时间】:2019-01-08 01:09:13
【问题描述】:

在检测足部扫描图像中的足部旋前时遇到问题,我尝试根据阈值标记压力点并能够得到一些结果,但是这种技术在那些足部颜色较深的图像中失败了。我尝试过的结果是Here,但我希望最终结果看起来像这些Feet Image Results
任何帮助/建议将不胜感激。
谢谢

编辑 我已经添加了手部扫描图像,其中压力点被圈出,并且处理的图像应该只检测压力点,但它基于我上面提到的皮肤颜色而失败。我正在应用颜色阈值。检测失败的图片是Here

【问题讨论】:

  • 你能添加一个不能正常工作的图像示例吗?
  • @J.D.我编辑了我的问题并添加了图片
  • 看来您需要实际的压力传感器数据而不是照片...
  • @Nyerguds 是的,你是对的

标签: c# opencv image-processing


【解决方案1】:

没有足够的色差来轻松做到这一点。我尝试增加对比度并转换为 HSV 颜色空间 (info - opencv),这样可以更轻松地选择颜色。

结果:

# load image
img = cv2.imread("hand.png")

#increase contrast
new_image = np.zeros(img.shape, img.dtype)
alpha = 4 # Simple contrast control
beta = -300    # Simple brightness control
for y in range(img.shape[0]):
    for x in range(img.shape[1]):
        for c in range(img.shape[2]):
            new_image[y,x,c] = np.clip(alpha*img[y,x,c] + beta, 0, 255)

# convert to HSV
hsv = cv2.cvtColor(new_image, cv2.COLOR_BGR2HSV) 
# set lower and upper color limits
lower_val = np.array([30,0,200])
upper_val = np.array([75,240,255])
# Threshold the HSV image 
mask = cv2.inRange(hsv, lower_val, upper_val)
# remove noise
kernel =  np.ones((3,3),np.uint8)
mask = cv2.morphologyEx(mask, cv2.MORPH_CLOSE, kernel)

# select whole hand
# set lower and upper color limits
lower_val = np.array([0,0,100])
upper_val = np.array([179,255,255])
# Threshold the HSV image 
mask2 = cv2.inRange(hsv, lower_val, upper_val)

# create a mask that has the whole hand, but not the prssure points
mask_combined = cv2.bitwise_xor(mask, mask2)
# Create a copy of the image
image = img.copy()
# Fill copy image with a blue-green-ish color
image[:] = (150, 150, 20)
# use the combined mask to color in upressured area's of the hand
res2 = cv2.bitwise_and(image,image, mask= mask_combined)
# Fill copy image with red color(set each pixel to red)
image[:] = (20, 20, 205)
# use the pressure mask to color in pressured area's
res = cv2.bitwise_and(image,image, mask= mask)
# combine colored images
final = dst = cv2.add(res2,res)
#show image
cv2.imshow("img", img)
cv2.imshow("result", final)
cv2.imshow("mask", mask)
cv2.imshow("mask2", mask_combined)
cv2.waitKey(0)
cv2.destroyAllWindows()      

注意:我裁剪了您提供的图像,如果您有完整图像,则可以通过调整颜色限制和形态来改善结果 - 请阅读here

【讨论】:

  • 我非常感谢您的帮助,我明白了您的意思,但我想要整个脚或您的情况下的手图像以颜色阈值的形式产生您提供的解决方案是指向压力点但剩余的手不可见,我希望它清晰可见,并且在我附加的压力点和我的问题中的图像上只是色差
  • 我对代码进行了扩展,还掩盖了手,并创建了一个彩色的最终结果。它不是很漂亮,但它和我能做的一样好,不用花太多时间。希望您可以自己改进这一点。祝你好运!
猜你喜欢
  • 2011-01-29
  • 2020-10-07
  • 2014-11-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-10-16
  • 2021-09-08
  • 2017-05-20
相关资源
最近更新 更多