【Python】计算机视觉 手掌图片穴位识别(二)

简介: 【Python】计算机视觉 手掌图片穴位识别(二)

返回至系列文章导航博客


1 简要介绍


看前说明:此方法可能有一定的缺陷,但是我认为有一定的实现可能所以做了这个板块。倘若有专业的中医医生或者相关工作者对此有建议或者意见可以与我联系交流哦~

关于手掌我这里有手掌的图片数据集可供大家下载:手掌数据集


穴位按摩是中国医学的重要组成部分,它是以中国医学理论为指导,以经络腧穴学说为基础,以按摩为主要施治,用来防病治病的一种手段。为方便用户可以随时随地按摩手部穴位,中e诊开发了智能手部穴位定位系统,使用户可以准确地找到手心与手背的穴位。具体功能为用户上传一张其手心或手背照片,系统会自动定位照片中的穴位坐标,并在图中标记处穴位位置,并将标记图片返回给用户。以左手手心为例,操作结果如下图所示:



2 技术详情


为准确定位到图像中的手掌位置,本小组利用mediapipe开发的手部界标模型(MediaPipe Hands)定位到手部关键节点。MediaPipe Hands 是一种高保真手和手指跟踪解决方案。它使用机器学习 (ML) 从单帧中推断出一只手的 21 个 3D 地标。具体21个3D地标如下图所示:



通过MedisPipe Hands手掌定位地标分析,可将上一节中的用户图片代入分析,计算该图手掌的关键节点。计算效果如下图所示:


在明确手掌在图中的关键节点后。本小组通过查阅大量中医文献书籍与资料,找到常见的手掌穴位在手部的相对位置。通过手部关键节点的位置坐标,采用欧式距离计算出图像中穴位的位置坐标并进行标注。同时,可以通过拇指指尖二维纵坐标与小拇指指尖二维纵坐标的大小判断图像中的是手心或是手背。手背智能穴位定位效果如下图所示:



3 代码实现


3.1 导入相应的库


import cv2 as cv
import numpy as np
import mediapipe as mp
import  tqdm
import time
import  matplotlib.pyplot as plt
from PIL import Image, ImageDraw, ImageFont

ps:在导入cv2时我遇到了一个报错“DLL load failed while importing cv2: 找不到指定的模”。若大家也遇到这种问题可至成功解决Python导入opencv报错“DLL load failed while importing cv2: 找不到指定的模”查看解决方法。


3.2 定义在图片中画点写字的函数


这一步方便在计算出穴位坐标后利用该函数对图片进行标记。

def cv2ImgAddText(img, text, left, top, textColor=(0, 255, 0), textSize=20):
    if (isinstance(img, np.ndarray)):  # 判断是否OpenCV图片类型
        img = Image.fromarray(cv.cvtColor(img, cv.COLOR_BGR2RGB))
    # 创建一个可以在给定图像上绘图的对象
    draw = ImageDraw.Draw(img)
    # 字体的格式
    fontStyle = ImageFont.truetype(
        "simsun.ttc", textSize, encoding="utf-8")
    # 绘制文本
    draw.text((left, top), text, textColor, font=fontStyle)
    # 转换回OpenCV格式
    return cv.cvtColor(np.asarray(img), cv.COLOR_RGB2BGR)


3.3 定义手部关键点监测模型并导入


# 手部关键点检测模型
mp_hand=mp.solutions.hands
# 导入模型
hands=mp_hand.Hands(static_image_mode=False,
                    max_num_hands=1,
                    min_detection_confidence=0.3,
                    min_tracking_confidence=0.3
                    )


3.4 导入绘图函数


# 导入绘图函数
mpDraw=mp.solutions.drawing_utils
img=cv.imread(r'C:\Users\13267\Desktop\test\hand2.jpg')#需要标记的手掌图片的位置
#look_img(img)
img_RGB=cv.cvtColor(img,cv.COLOR_BGR2RGB)
results=hands.process(img_RGB)
lmList = []


3.5 将原本三维的坐标系转为2维方便平面坐标计算


if results.multi_hand_landmarks:
    for handLms in results.multi_hand_landmarks:
        for id, lm in enumerate(handLms.landmark):
            h, w, c = img.shape
            cx, cy = int(lm.x * w), int(lm.y * h)
            lmList.append([id, cx, cy])


3.6 计算手部穴位的函数


这里利用了小拇指指尖坐标与大拇指指尖坐标的相对位置来判断图片是手掌还是手背。目前仅能左手来测试!


if lmList[12][2] < lmList[0][2]:
    if lmList[4][1] < lmList[20][1]:
        print('手心')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1 ,cy1 =  lmList[1][1],lmList[1][2]
        img = cv2ImgAddText(img, "鱼际穴", cx1, cy1, (0,0,0), 30)
        cv.circle(img, (cx1, cy1), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        img = cv2ImgAddText(img, "十宣穴1", cx4, cy4, (0,0,0), 30)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx6,cy6 = lmList[6][1],lmList[6][2]
        img = cv2ImgAddText(img, "四缝穴1", cx6, cy6, (0,0,0), 30)
        cv.circle(img, (cx6, cy6), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8, cy8, (0,0,0), 30)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9,cy9 = lmList[9][1],lmList[9][2]
        cv.circle(img, ((3*cx9+cx0)//4, (3*cy9+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "劳宫穴", (3*cx9+cx0)//4, (3*cy9+cy0)//4, (0,0,0), 30)
        x_center,y_center=(cx9+cx0)//2, (cy9+cy0)//2
        cx10,cy10 = lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "四缝穴2", cx10, cy10, (0,0,0), 30)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx11 , cy11 = lmList[11][1],lmList[11][2]
        cx12 , cy12 = lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12, cy12, (0,0,0), 30)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "中冲穴", (2*cx12+cx11)//3, (2*cy12+cy11)//3, (0,0,0), 30)
        cv.circle(img, ((2*cx12+cx11)//3, (2*cy12+cy11)//3), 10, (255, 0, 255), cv.FILLED)
        cx14,cy14 = lmList[14][1],lmList[14][2]
        img = cv2ImgAddText(img, "四缝穴3", cx14, cy14, (0,0,0), 30)
        cv.circle(img, (cx14, cy14), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 = lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16, cy16, (0,0,0), 30)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 = lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "少府穴", (3*cx17+cx0)//4, (3*cy17+cy0)//4, (0,0,0), 30)
        cv.circle(img, ((3*cx17+cx0)//4, (3*cy17+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 = lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "四缝穴4", cx18, cy18, (0,0,0), 30)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 = lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20, cy20, (0,0,0), 30)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)#标记后的图片存储位置
    else:
        print('手背')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1,cy1 = lmList[1][1],lmList[1][2]
        x_zhongquan,y_zhongquan = (3*cx0+cx1)//4,(3*cy0+cy1)//4
        img = cv2ImgAddText(img, "中泉穴", x_zhongquan,y_zhongquan, (0,0,0), 20)
        cv.circle(img, (x_zhongquan, y_zhongquan), 10, (255, 0, 255), cv.FILLED)
        cx2 ,cy2 =  lmList[2][1],lmList[2][2]
        cx3 ,cy3 =  lmList[3][1],lmList[3][2]
        img = cv2ImgAddText(img, "大骨空穴", cx3,cy3, (0,0,0), 20)
        cv.circle(img, (cx3, cy3), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        x_shaoshang,y_shaoshang = (cx3+cx4)//2,(cy3+cy4)//2
        img = cv2ImgAddText(img, "少商穴", x_shaoshang,y_shaoshang, (0,0,0), 20)
        cv.circle(img, (x_shaoshang, y_shaoshang), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "十宣穴1", cx4,cy4, (0,0,0), 20)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx5,cy5 = lmList[5][1],lmList[5][2]
        x_053,y_053 = (3*cx5+cx0)//4,(3*cy5+cy0)//4
        x_05,y_05 = (cx5+cx0)//2,(cy5+cy0)//2
        x_sanjian,y_sanjian = (x_053+cx2)//2,(y_053+cy2)//2
        x_hegu,y_hegu = (x_05+cx2)//2,(y_05+cy2)//2
        img = cv2ImgAddText(img, "三间穴", x_sanjian,y_sanjian, (0,0,0), 20)
        cv.circle(img, (x_sanjian, y_sanjian), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "合谷穴", x_hegu,y_hegu, (0,0,0), 20)
        cv.circle(img, (x_hegu, y_hegu), 10, (255, 0, 255), cv.FILLED)
        x_baxie1,y_baxie1 = (cx2+cx5)//2,(cy2+cy5)//2
        img = cv2ImgAddText(img, "八邪穴1", x_baxie1,y_baxie1, (0,0,0), 20)
        cv.circle(img, (x_baxie1, y_baxie1), 10, (255, 0, 255), cv.FILLED)
        x_yaotong1,y_yaotong1=(cx5+cx0)//2,(cy5+cy0)//2
        img = cv2ImgAddText(img, "腰痛点1", x_yaotong1,y_yaotong1, (0,0,0), 20)
        cv.circle(img, (x_yaotong1, y_yaotong1), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8,cy8, (0,0,0), 20)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9 ,cy9 =  lmList[9][1],lmList[9][2]
        x_baxie2,y_baxie2 = (cx9+cx5)//2,(cy9+cy5)//2
        img = cv2ImgAddText(img, "八邪穴2", x_baxie2,y_baxie2, (0,0,0), 20)
        cv.circle(img, (x_baxie2, y_baxie2), 10, (255, 0, 255), cv.FILLED)
        cx10 ,cy10 =  lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "中魁穴", cx10,cy10, (0,0,0), 20)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx12 ,cy12 =  lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12,cy12, (0,0,0), 20)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        cx13 ,cy13 =  lmList[13][1],lmList[13][2]
        x_baxie3,y_baxie3 = (cx9+cx13)//2,(cy9+cy13)//2
        img = cv2ImgAddText(img, "八邪穴3", x_baxie3,y_baxie3, (0,0,0), 20)
        cv.circle(img, (x_baxie3, y_baxie3), 10, (255, 0, 255), cv.FILLED)
        x_yaotong2,y_yaotong2 = (cx0+cx13)//2,(cy0+cy13)//2
        img = cv2ImgAddText(img, "腰痛点2", x_yaotong2,y_yaotong2, (0,0,0), 20)
        cv.circle(img, (x_yaotong2, y_yaotong2), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 =  lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16,cy16, (0,0,0), 20)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 =  lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "后溪穴", cx17,cy17, (0,0,0), 20)
        cv.circle(img, (cx17, cy17), 10, (255, 0, 255), cv.FILLED)
        x_baxie4,y_baxie4 = (cx13+cx17)//2,(cy13+cy17)//2
        img = cv2ImgAddText(img, "八邪穴4", x_baxie4,y_baxie4, (0,0,0), 20)
        cv.circle(img, (x_baxie4, y_baxie4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 =  lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "小骨空穴", cx18,cy18, (0,0,0), 20)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 =  lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20,cy20, (0,0,0), 20)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)#标记后的图片存储位置
else:
    if lmList[4][1] > lmList[20][1]:
        print('手心')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1 ,cy1 =  lmList[1][1],lmList[1][2]
        img = cv2ImgAddText(img, "鱼际穴", cx1, cy1, (0,0,0), 30)
        cv.circle(img, (cx1, cy1), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        img = cv2ImgAddText(img, "十宣穴1", cx4, cy4, (0,0,0), 30)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx6,cy6 = lmList[6][1],lmList[6][2]
        img = cv2ImgAddText(img, "四缝穴1", cx6, cy6, (0,0,0), 30)
        cv.circle(img, (cx6, cy6), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8, cy8, (0,0,0), 30)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9,cy9 = lmList[9][1],lmList[9][2]
        cv.circle(img, ((3*cx9+cx0)//4, (3*cy9+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "劳宫穴", (3*cx9+cx0)//4, (3*cy9+cy0)//4, (0,0,0), 30)
        x_center,y_center=(cx9+cx0)//2, (cy9+cy0)//2
        cx10,cy10 = lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "四缝穴2", cx10, cy10, (0,0,0), 30)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx11 , cy11 = lmList[11][1],lmList[11][2]
        cx12 , cy12 = lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12, cy12, (0,0,0), 30)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "中冲穴", (2*cx12+cx11)//3, (2*cy12+cy11)//3, (0,0,0), 30)
        cv.circle(img, ((2*cx12+cx11)//3, (2*cy12+cy11)//3), 10, (255, 0, 255), cv.FILLED)
        cx14,cy14 = lmList[14][1],lmList[14][2]
        img = cv2ImgAddText(img, "四缝穴3", cx14, cy14, (0,0,0), 30)
        cv.circle(img, (cx14, cy14), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 = lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16, cy16, (0,0,0), 30)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 = lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "少府穴", (3*cx17+cx0)//4, (3*cy17+cy0)//4, (0,0,0), 30)
        cv.circle(img, ((3*cx17+cx0)//4, (3*cy17+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 = lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "四缝穴4", cx18, cy18, (0,0,0), 30)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 = lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20, cy20, (0,0,0), 30)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)#标记后的图片存储位置
    else:
        print('手背')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1,cy1 = lmList[1][1],lmList[1][2]
        x_zhongquan,y_zhongquan = (3*cx0+cx1)//4,(3*cy0+cy1)//4
        img = cv2ImgAddText(img, "中泉穴", x_zhongquan,y_zhongquan, (0,0,0), 20)
        cv.circle(img, (x_zhongquan, y_zhongquan), 10, (255, 0, 255), cv.FILLED)
        cx2 ,cy2 =  lmList[2][1],lmList[2][2]
        cx3 ,cy3 =  lmList[3][1],lmList[3][2]
        img = cv2ImgAddText(img, "大骨空穴", cx3,cy3, (0,0,0), 20)
        cv.circle(img, (cx3, cy3), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        x_shaoshang,y_shaoshang = (cx3+cx4)//2,(cy3+cy4)//2
        img = cv2ImgAddText(img, "少商穴", x_shaoshang,y_shaoshang, (0,0,0), 20)
        cv.circle(img, (x_shaoshang, y_shaoshang), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "十宣穴1", cx4,cy4, (0,0,0), 20)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx5,cy5 = lmList[5][1],lmList[5][2]
        x_053,y_053 = (3*cx5+cx0)//4,(3*cy5+cy0)//4
        x_05,y_05 = (cx5+cx0)//2,(cy5+cy0)//2
        x_sanjian,y_sanjian = (x_053+cx2)//2,(y_053+cy2)//2
        x_hegu,y_hegu = (x_05+cx2)//2,(y_05+cy2)//2
        img = cv2ImgAddText(img, "三间穴", x_sanjian,y_sanjian, (0,0,0), 20)
        cv.circle(img, (x_sanjian, y_sanjian), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "合谷穴", x_hegu,y_hegu, (0,0,0), 20)
        cv.circle(img, (x_hegu, y_hegu), 10, (255, 0, 255), cv.FILLED)
        x_baxie1,y_baxie1 = (cx2+cx5)//2,(cy2+cy5)//2
        img = cv2ImgAddText(img, "八邪穴1", x_baxie1,y_baxie1, (0,0,0), 20)
        cv.circle(img, (x_baxie1, y_baxie1), 10, (255, 0, 255), cv.FILLED)
        x_yaotong1,y_yaotong1=(cx5+cx0)//2,(cy5+cy0)//2
        img = cv2ImgAddText(img, "腰痛点1", x_yaotong1,y_yaotong1, (0,0,0), 20)
        cv.circle(img, (x_yaotong1, y_yaotong1), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8,cy8, (0,0,0), 20)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9 ,cy9 =  lmList[9][1],lmList[9][2]
        x_baxie2,y_baxie2 = (cx9+cx5)//2,(cy9+cy5)//2
        img = cv2ImgAddText(img, "八邪穴2", x_baxie2,y_baxie2, (0,0,0), 20)
        cv.circle(img, (x_baxie2, y_baxie2), 10, (255, 0, 255), cv.FILLED)
        cx10 ,cy10 =  lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "中魁穴", cx10,cy10, (0,0,0), 20)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx12 ,cy12 =  lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12,cy12, (0,0,0), 20)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        cx13 ,cy13 =  lmList[13][1],lmList[13][2]
        x_baxie3,y_baxie3 = (cx9+cx13)//2,(cy9+cy13)//2
        img = cv2ImgAddText(img, "八邪穴3", x_baxie3,y_baxie3, (0,0,0), 20)
        cv.circle(img, (x_baxie3, y_baxie3), 10, (255, 0, 255), cv.FILLED)
        x_yaotong2,y_yaotong2 = (cx0+cx13)//2,(cy0+cy13)//2
        img = cv2ImgAddText(img, "腰痛点2", x_yaotong2,y_yaotong2, (0,0,0), 20)
        cv.circle(img, (x_yaotong2, y_yaotong2), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 =  lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16,cy16, (0,0,0), 20)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 =  lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "后溪穴", cx17,cy17, (0,0,0), 20)
        cv.circle(img, (cx17, cy17), 10, (255, 0, 255), cv.FILLED)
        x_baxie4,y_baxie4 = (cx13+cx17)//2,(cy13+cy17)//2
        img = cv2ImgAddText(img, "八邪穴4", x_baxie4,y_baxie4, (0,0,0), 20)
        cv.circle(img, (x_baxie4, y_baxie4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 =  lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "小骨空穴", cx18,cy18, (0,0,0), 20)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 =  lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20,cy20, (0,0,0), 20)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)#标记后的图片存储位置
print(lmList)

标记涉及的穴位介绍如下:

手心

鱼际穴:取穴位置在手外侧,第一掌骨桡侧中点赤白肉际处。缓解病症:1.咳嗽、咳血、喉咙干、咽喉肿痛、失声等肺部热证;2.小孩营养不良。


少府穴:取穴位置在手掌,横平第五掌指关节近端,第四、五掌骨之间。缓解病症:1.心悸等心胸病;2.阴部发痒,阴部疼痛;3.小指痉挛。


劳宫穴:取穴位置在掌区,横平第三掌指关节近端,第二、三掌骨之间偏于第三掌骨。缓解病症:1.中风昏迷、中暑等急症;2.心痛、烦闷、癫狂等心志疾病;3.口疮、口臭;4.手癣。


中冲穴:取穴位置在手指,中指末端最高点。缓解病症:1.中风昏迷、不能说话、中暑等急症;2.热病、舌下肿痛。


四缝穴:取穴位置在手背,第二至五掌面的近侧指间关节横纹的中央,一手四穴。缓解病症:1.小儿营养不良;2.百日咳。


十宣穴:取穴位置在手指,十指尖端,距指甲游离缘0.1寸(指寸),左右共10穴。缓解病症:1.昏迷;2.癫痫;3.咽喉肿痛;4.手指麻木。


手背:

中泉穴:取穴位置在前臂前区,腕掌侧远端横纹上,指总伸肌腱桡侧的凹陷中。缓解病症:1.胸胁肿痛、咳嗽、气喘、心痛;2.胃脘疼痛;3.掌中热。


大骨空穴:取穴位置在手指,拇指背面,指间关节处的中点处。缓解病症:1.眼睛疼、迎风流泪、白内障;2.吐泻;3.鼻出血。


少商穴:取穴位置在手指,拇指末节桡侧,指甲根角侧上方0.1寸(指寸)。缓解病症:1.咽喉肿痛、鼻子出血、高热、昏迷等肺系热证;2.癫狂。


十宣穴:取穴位置在手指,十指尖端,距指甲游离缘0.1寸(指寸),左右共10穴。缓解病症:1.昏迷;2.癫痫;3.咽喉肿痛;4.手指麻木。


三间穴:取穴位置在手指,第二掌指关节桡侧近端凹陷中。缓解病症:1.牙疼、咽喉疼等五官病症;2.腹胀等肠道问题;3.嗜睡。


合谷穴:取穴位置在手背,第二掌骨桡侧的中点处。缓解病症:1.头痛、牙痛、鼻子流血等头面五官病症;2.发热等感冒病症;3.闭经等妇产科病症;


八邪穴:取穴位置在手背,第一至五指间,指蹼缘后方赤白肉际处,左右共8次。缓解病症:1.手臂肿痛、手指麻木;2.眼睛疼;3.毒蛇咬伤。


腰痛点:取穴位置在手背第二、三掌骨间及第四、五掌骨间,腕背侧远端横纹与掌指关节的中点处,一手二穴。缓解病症:急性腰扭伤。

中魁穴:取穴位置在手指,中指背面,近侧指间关节的中点处。缓解病症:打嗝、呕吐、食欲不振等脾胃病症。


后溪穴:取穴位置在手内侧,第五掌指关节尺侧近端赤白肉际凹陷中。缓解病症:1.头和颈部头痛、腰背疼、手指及胳膊抽筋的疼;2.眼红、耳朵聋;3.癫狂痫;4.疟疾。


小骨空穴:取穴位置在手指,小指背面,近侧指间关节的中点处。缓解病症:1.眼睛疼,迎风流泪,白内障;2.指关节疼。


4 完整代码展示(可直接使用!)


import cv2 as cv
import numpy as np
import mediapipe as mp
import  tqdm
import time
import  matplotlib.pyplot as plt
from PIL import Image, ImageDraw, ImageFont
def cv2ImgAddText(img, text, left, top, textColor=(0, 255, 0), textSize=20):
    if (isinstance(img, np.ndarray)):  # 判断是否OpenCV图片类型
        img = Image.fromarray(cv.cvtColor(img, cv.COLOR_BGR2RGB))
    # 创建一个可以在给定图像上绘图的对象
    draw = ImageDraw.Draw(img)
    # 字体的格式
    fontStyle = ImageFont.truetype(
        "simsun.ttc", textSize, encoding="utf-8")
    # 绘制文本
    draw.text((left, top), text, textColor, font=fontStyle)
    # 转换回OpenCV格式
    return cv.cvtColor(np.asarray(img), cv.COLOR_RGB2BGR)
# 手部关键点检测模型
mp_hand=mp.solutions.hands
# 导入模型
hands=mp_hand.Hands(static_image_mode=False,
                    max_num_hands=1,
                    min_detection_confidence=0.3,
                    min_tracking_confidence=0.3
                    )
# 导入绘图函数
mpDraw=mp.solutions.drawing_utils
img=cv.imread(r'C:\Users\13267\Desktop\test\hand2.jpg')
#look_img(img)
img_RGB=cv.cvtColor(img,cv.COLOR_BGR2RGB)
results=hands.process(img_RGB)
lmList = []
if results.multi_hand_landmarks:
    for handLms in results.multi_hand_landmarks:
        for id, lm in enumerate(handLms.landmark):
            h, w, c = img.shape
            cx, cy = int(lm.x * w), int(lm.y * h)
            lmList.append([id, cx, cy])
if lmList[12][2] < lmList[0][2]:
    if lmList[4][1] < lmList[20][1]:
        print('手心')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1 ,cy1 =  lmList[1][1],lmList[1][2]
        img = cv2ImgAddText(img, "鱼际穴", cx1, cy1, (0,0,0), 30)
        cv.circle(img, (cx1, cy1), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        img = cv2ImgAddText(img, "十宣穴1", cx4, cy4, (0,0,0), 30)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx6,cy6 = lmList[6][1],lmList[6][2]
        img = cv2ImgAddText(img, "四缝穴1", cx6, cy6, (0,0,0), 30)
        cv.circle(img, (cx6, cy6), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8, cy8, (0,0,0), 30)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9,cy9 = lmList[9][1],lmList[9][2]
        cv.circle(img, ((3*cx9+cx0)//4, (3*cy9+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "劳宫穴", (3*cx9+cx0)//4, (3*cy9+cy0)//4, (0,0,0), 30)
        x_center,y_center=(cx9+cx0)//2, (cy9+cy0)//2
        cx10,cy10 = lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "四缝穴2", cx10, cy10, (0,0,0), 30)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx11 , cy11 = lmList[11][1],lmList[11][2]
        cx12 , cy12 = lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12, cy12, (0,0,0), 30)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "中冲穴", (2*cx12+cx11)//3, (2*cy12+cy11)//3, (0,0,0), 30)
        cv.circle(img, ((2*cx12+cx11)//3, (2*cy12+cy11)//3), 10, (255, 0, 255), cv.FILLED)
        cx14,cy14 = lmList[14][1],lmList[14][2]
        img = cv2ImgAddText(img, "四缝穴3", cx14, cy14, (0,0,0), 30)
        cv.circle(img, (cx14, cy14), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 = lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16, cy16, (0,0,0), 30)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 = lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "少府穴", (3*cx17+cx0)//4, (3*cy17+cy0)//4, (0,0,0), 30)
        cv.circle(img, ((3*cx17+cx0)//4, (3*cy17+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 = lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "四缝穴4", cx18, cy18, (0,0,0), 30)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 = lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20, cy20, (0,0,0), 30)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)
    else:
        print('手背')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1,cy1 = lmList[1][1],lmList[1][2]
        x_zhongquan,y_zhongquan = (3*cx0+cx1)//4,(3*cy0+cy1)//4
        img = cv2ImgAddText(img, "中泉穴", x_zhongquan,y_zhongquan, (0,0,0), 20)
        cv.circle(img, (x_zhongquan, y_zhongquan), 10, (255, 0, 255), cv.FILLED)
        cx2 ,cy2 =  lmList[2][1],lmList[2][2]
        cx3 ,cy3 =  lmList[3][1],lmList[3][2]
        img = cv2ImgAddText(img, "大骨空穴", cx3,cy3, (0,0,0), 20)
        cv.circle(img, (cx3, cy3), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        x_shaoshang,y_shaoshang = (cx3+cx4)//2,(cy3+cy4)//2
        img = cv2ImgAddText(img, "少商穴", x_shaoshang,y_shaoshang, (0,0,0), 20)
        cv.circle(img, (x_shaoshang, y_shaoshang), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "十宣穴1", cx4,cy4, (0,0,0), 20)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx5,cy5 = lmList[5][1],lmList[5][2]
        x_053,y_053 = (3*cx5+cx0)//4,(3*cy5+cy0)//4
        x_05,y_05 = (cx5+cx0)//2,(cy5+cy0)//2
        x_sanjian,y_sanjian = (x_053+cx2)//2,(y_053+cy2)//2
        x_hegu,y_hegu = (x_05+cx2)//2,(y_05+cy2)//2
        img = cv2ImgAddText(img, "三间穴", x_sanjian,y_sanjian, (0,0,0), 20)
        cv.circle(img, (x_sanjian, y_sanjian), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "合谷穴", x_hegu,y_hegu, (0,0,0), 20)
        cv.circle(img, (x_hegu, y_hegu), 10, (255, 0, 255), cv.FILLED)
        x_baxie1,y_baxie1 = (cx2+cx5)//2,(cy2+cy5)//2
        img = cv2ImgAddText(img, "八邪穴1", x_baxie1,y_baxie1, (0,0,0), 20)
        cv.circle(img, (x_baxie1, y_baxie1), 10, (255, 0, 255), cv.FILLED)
        x_yaotong1,y_yaotong1=(cx5+cx0)//2,(cy5+cy0)//2
        img = cv2ImgAddText(img, "腰痛点1", x_yaotong1,y_yaotong1, (0,0,0), 20)
        cv.circle(img, (x_yaotong1, y_yaotong1), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8,cy8, (0,0,0), 20)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9 ,cy9 =  lmList[9][1],lmList[9][2]
        x_baxie2,y_baxie2 = (cx9+cx5)//2,(cy9+cy5)//2
        img = cv2ImgAddText(img, "八邪穴2", x_baxie2,y_baxie2, (0,0,0), 20)
        cv.circle(img, (x_baxie2, y_baxie2), 10, (255, 0, 255), cv.FILLED)
        cx10 ,cy10 =  lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "中魁穴", cx10,cy10, (0,0,0), 20)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx12 ,cy12 =  lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12,cy12, (0,0,0), 20)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        cx13 ,cy13 =  lmList[13][1],lmList[13][2]
        x_baxie3,y_baxie3 = (cx9+cx13)//2,(cy9+cy13)//2
        img = cv2ImgAddText(img, "八邪穴3", x_baxie3,y_baxie3, (0,0,0), 20)
        cv.circle(img, (x_baxie3, y_baxie3), 10, (255, 0, 255), cv.FILLED)
        x_yaotong2,y_yaotong2 = (cx0+cx13)//2,(cy0+cy13)//2
        img = cv2ImgAddText(img, "腰痛点2", x_yaotong2,y_yaotong2, (0,0,0), 20)
        cv.circle(img, (x_yaotong2, y_yaotong2), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 =  lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16,cy16, (0,0,0), 20)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 =  lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "后溪穴", cx17,cy17, (0,0,0), 20)
        cv.circle(img, (cx17, cy17), 10, (255, 0, 255), cv.FILLED)
        x_baxie4,y_baxie4 = (cx13+cx17)//2,(cy13+cy17)//2
        img = cv2ImgAddText(img, "八邪穴4", x_baxie4,y_baxie4, (0,0,0), 20)
        cv.circle(img, (x_baxie4, y_baxie4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 =  lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "小骨空穴", cx18,cy18, (0,0,0), 20)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 =  lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20,cy20, (0,0,0), 20)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)
else:
    if lmList[4][1] > lmList[20][1]:
        print('手心')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1 ,cy1 =  lmList[1][1],lmList[1][2]
        img = cv2ImgAddText(img, "鱼际穴", cx1, cy1, (0,0,0), 30)
        cv.circle(img, (cx1, cy1), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        img = cv2ImgAddText(img, "十宣穴1", cx4, cy4, (0,0,0), 30)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx6,cy6 = lmList[6][1],lmList[6][2]
        img = cv2ImgAddText(img, "四缝穴1", cx6, cy6, (0,0,0), 30)
        cv.circle(img, (cx6, cy6), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8, cy8, (0,0,0), 30)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9,cy9 = lmList[9][1],lmList[9][2]
        cv.circle(img, ((3*cx9+cx0)//4, (3*cy9+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "劳宫穴", (3*cx9+cx0)//4, (3*cy9+cy0)//4, (0,0,0), 30)
        x_center,y_center=(cx9+cx0)//2, (cy9+cy0)//2
        cx10,cy10 = lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "四缝穴2", cx10, cy10, (0,0,0), 30)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx11 , cy11 = lmList[11][1],lmList[11][2]
        cx12 , cy12 = lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12, cy12, (0,0,0), 30)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "中冲穴", (2*cx12+cx11)//3, (2*cy12+cy11)//3, (0,0,0), 30)
        cv.circle(img, ((2*cx12+cx11)//3, (2*cy12+cy11)//3), 10, (255, 0, 255), cv.FILLED)
        cx14,cy14 = lmList[14][1],lmList[14][2]
        img = cv2ImgAddText(img, "四缝穴3", cx14, cy14, (0,0,0), 30)
        cv.circle(img, (cx14, cy14), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 = lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16, cy16, (0,0,0), 30)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 = lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "少府穴", (3*cx17+cx0)//4, (3*cy17+cy0)//4, (0,0,0), 30)
        cv.circle(img, ((3*cx17+cx0)//4, (3*cy17+cy0)//4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 = lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "四缝穴4", cx18, cy18, (0,0,0), 30)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 = lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20, cy20, (0,0,0), 30)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)
    else:
        print('手背')
        cx0,cy0 = lmList[0][1],lmList[0][2]
        cx1,cy1 = lmList[1][1],lmList[1][2]
        x_zhongquan,y_zhongquan = (3*cx0+cx1)//4,(3*cy0+cy1)//4
        img = cv2ImgAddText(img, "中泉穴", x_zhongquan,y_zhongquan, (0,0,0), 20)
        cv.circle(img, (x_zhongquan, y_zhongquan), 10, (255, 0, 255), cv.FILLED)
        cx2 ,cy2 =  lmList[2][1],lmList[2][2]
        cx3 ,cy3 =  lmList[3][1],lmList[3][2]
        img = cv2ImgAddText(img, "大骨空穴", cx3,cy3, (0,0,0), 20)
        cv.circle(img, (cx3, cy3), 10, (255, 0, 255), cv.FILLED)
        cx4,cy4 = lmList[4][1],lmList[4][2]
        x_shaoshang,y_shaoshang = (cx3+cx4)//2,(cy3+cy4)//2
        img = cv2ImgAddText(img, "少商穴", x_shaoshang,y_shaoshang, (0,0,0), 20)
        cv.circle(img, (x_shaoshang, y_shaoshang), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "十宣穴1", cx4,cy4, (0,0,0), 20)
        cv.circle(img, (cx4, cy4), 10, (255, 0, 255), cv.FILLED)
        cx5,cy5 = lmList[5][1],lmList[5][2]
        x_053,y_053 = (3*cx5+cx0)//4,(3*cy5+cy0)//4
        x_05,y_05 = (cx5+cx0)//2,(cy5+cy0)//2
        x_sanjian,y_sanjian = (x_053+cx2)//2,(y_053+cy2)//2
        x_hegu,y_hegu = (x_05+cx2)//2,(y_05+cy2)//2
        img = cv2ImgAddText(img, "三间穴", x_sanjian,y_sanjian, (0,0,0), 20)
        cv.circle(img, (x_sanjian, y_sanjian), 10, (255, 0, 255), cv.FILLED)
        img = cv2ImgAddText(img, "合谷穴", x_hegu,y_hegu, (0,0,0), 20)
        cv.circle(img, (x_hegu, y_hegu), 10, (255, 0, 255), cv.FILLED)
        x_baxie1,y_baxie1 = (cx2+cx5)//2,(cy2+cy5)//2
        img = cv2ImgAddText(img, "八邪穴1", x_baxie1,y_baxie1, (0,0,0), 20)
        cv.circle(img, (x_baxie1, y_baxie1), 10, (255, 0, 255), cv.FILLED)
        x_yaotong1,y_yaotong1=(cx5+cx0)//2,(cy5+cy0)//2
        img = cv2ImgAddText(img, "腰痛点1", x_yaotong1,y_yaotong1, (0,0,0), 20)
        cv.circle(img, (x_yaotong1, y_yaotong1), 10, (255, 0, 255), cv.FILLED)
        cx8,cy8 = lmList[8][1],lmList[8][2]
        img = cv2ImgAddText(img, "十宣穴2", cx8,cy8, (0,0,0), 20)
        cv.circle(img, (cx8, cy8), 10, (255, 0, 255), cv.FILLED)
        cx9 ,cy9 =  lmList[9][1],lmList[9][2]
        x_baxie2,y_baxie2 = (cx9+cx5)//2,(cy9+cy5)//2
        img = cv2ImgAddText(img, "八邪穴2", x_baxie2,y_baxie2, (0,0,0), 20)
        cv.circle(img, (x_baxie2, y_baxie2), 10, (255, 0, 255), cv.FILLED)
        cx10 ,cy10 =  lmList[10][1],lmList[10][2]
        img = cv2ImgAddText(img, "中魁穴", cx10,cy10, (0,0,0), 20)
        cv.circle(img, (cx10, cy10), 10, (255, 0, 255), cv.FILLED)
        cx12 ,cy12 =  lmList[12][1],lmList[12][2]
        img = cv2ImgAddText(img, "十宣穴3", cx12,cy12, (0,0,0), 20)
        cv.circle(img, (cx12, cy12), 10, (255, 0, 255), cv.FILLED)
        cx13 ,cy13 =  lmList[13][1],lmList[13][2]
        x_baxie3,y_baxie3 = (cx9+cx13)//2,(cy9+cy13)//2
        img = cv2ImgAddText(img, "八邪穴3", x_baxie3,y_baxie3, (0,0,0), 20)
        cv.circle(img, (x_baxie3, y_baxie3), 10, (255, 0, 255), cv.FILLED)
        x_yaotong2,y_yaotong2 = (cx0+cx13)//2,(cy0+cy13)//2
        img = cv2ImgAddText(img, "腰痛点2", x_yaotong2,y_yaotong2, (0,0,0), 20)
        cv.circle(img, (x_yaotong2, y_yaotong2), 10, (255, 0, 255), cv.FILLED)
        cx16,cy16 =  lmList[16][1],lmList[16][2]
        img = cv2ImgAddText(img, "十宣穴4", cx16,cy16, (0,0,0), 20)
        cv.circle(img, (cx16, cy16), 10, (255, 0, 255), cv.FILLED)
        cx17,cy17 =  lmList[17][1],lmList[17][2]
        img = cv2ImgAddText(img, "后溪穴", cx17,cy17, (0,0,0), 20)
        cv.circle(img, (cx17, cy17), 10, (255, 0, 255), cv.FILLED)
        x_baxie4,y_baxie4 = (cx13+cx17)//2,(cy13+cy17)//2
        img = cv2ImgAddText(img, "八邪穴4", x_baxie4,y_baxie4, (0,0,0), 20)
        cv.circle(img, (x_baxie4, y_baxie4), 10, (255, 0, 255), cv.FILLED)
        cx18,cy18 =  lmList[18][1],lmList[18][2]
        img = cv2ImgAddText(img, "小骨空穴", cx18,cy18, (0,0,0), 20)
        cv.circle(img, (cx18, cy18), 10, (255, 0, 255), cv.FILLED)
        cx20,cy20 =  lmList[20][1],lmList[20][2]
        img = cv2ImgAddText(img, "十宣穴5", cx20,cy20, (0,0,0), 20)
        cv.circle(img, (cx20, cy20), 10, (255, 0, 255), cv.FILLED)
        cv.imwrite(r'C:\Users\13267\Desktop\test\hands2.jpg',img)
print(lmList)

5 实验结果展示


相关文章
|
2月前
|
存储 人工智能 开发工具
AI助理化繁为简,速取代码参数——使用python SDK 处理OSS存储的图片
只需要通过向AI助理提问的方式输入您的需求,即可瞬间获得核心流程代码及参数,缩短学习路径、提升开发效率。
1451 4
AI助理化繁为简,速取代码参数——使用python SDK 处理OSS存储的图片
|
2月前
|
Python
Python实用记录(六):如何打开txt文档并删除指定绝对路径下图片
这篇文章介绍了如何使用Python打开txt文档,删除文档中指定路径的图片,并提供了一段示例代码来展示这一过程。
32 1
|
2月前
|
计算机视觉 Python
Python实用记录(一):如何将不同类型视频按关键帧提取并保存图片,实现图片裁剪功能
这篇文章介绍了如何使用Python和OpenCV库从不同格式的视频文件中按关键帧提取图片,并展示了图片裁剪的方法。
90 0
|
4月前
|
计算机视觉 Windows Python
windows下使用python + opencv读取含有中文路径的图片 和 把图片数据保存到含有中文的路径下
在Windows系统中,直接使用`cv2.imread()`和`cv2.imwrite()`处理含中文路径的图像文件时会遇到问题。读取时会返回空数据,保存时则无法正确保存至目标目录。为解决这些问题,可以使用`cv2.imdecode()`结合`np.fromfile()`来读取图像,并使用`cv2.imencode()`结合`tofile()`方法来保存图像至含中文的路径。这种方法有效避免了路径编码问题,确保图像处理流程顺畅进行。
420 1
|
2月前
|
Python
Socket学习笔记(二):python通过socket实现客户端到服务器端的图片传输
使用Python的socket库实现客户端到服务器端的图片传输,包括客户端和服务器端的代码实现,以及传输结果的展示。
164 3
Socket学习笔记(二):python通过socket实现客户端到服务器端的图片传输
|
2月前
|
Python
Python实用记录(四):os模块-去后缀或者改后缀/指定目录下图片或者子目录图片写入txt/csv
本文介绍了如何使用Python的os模块来操作文件,包括更改文件后缀、分割文件路径和后缀、将指定目录下的所有图片写入txt文档,以及将指定目录下所有子目录中的图片写入csv文档,并为每个子目录分配一个标签。
27 1
|
2月前
|
编解码 UED Python
Python批量修改指定目录下图片的大小名文章
Python批量修改指定目录下图片的大小名文章
20 1
|
2月前
|
iOS开发 MacOS Python
Python编程小案例—利用flask查询本机IP归属并输出网页图片
Python编程小案例—利用flask查询本机IP归属并输出网页图片
26 1
|
2月前
|
数据采集 自然语言处理 Python
用 Python 生成并识别图片验证码
用 Python 生成并识别图片验证码
53 1
|
3月前
|
数据采集 开发者 Python
Python之怎么爬取图片网站
Python之怎么爬取图片网站