# 使用 LiteRT 进行姿态估计和显示

Source: [https://docs.qualcomm.com/doc/80-70022-50SC/topic/single-camera-stream-with-pose-estimation-and-display.html](https://docs.qualcomm.com/doc/80-70022-50SC/topic/single-camera-stream-with-pose-estimation-and-display.html)

这些用例实现了 HRNet LiteRT 模型通过姿态估计来处理单个摄像头流。

## 使用 qtivoverlay 插件应用姿态估计叠加

在目标设备上运行用例：

    gst-launch-1.0 -e \
    qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! tee name=split \
    split. ! queue ! qtimetamux name=metamux ! queue ! qtivoverlay ! queue ! waylandsink fullscreen=true sync=false \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so \
    external-delegate-options="QNNExternalDelegate,backend_type=htp;" model=/etc/models/hrnet_pose_quantized.tflite ! queue ! \
    qtimlpostprocess results=2 module=hrnet labels=/etc/labels/hrnet_pose.json settings=/etc/labels/hrnet_settings.json ! text/x-raw ! queue ! metamux.Copy to clipboard

要停止用例，请使用 CTRL + C。

下图显示了用例执行的流程：

1. 从摄像头源传来的视频流中识别场景中人物的姿势。
2. 使用 overlaylib 叠加可用的姿势。
3. 显示结果。

Figure : 姿态估计叠加的 pipeline
                
                <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export pipeline_pose_estimation_overlay.svg pipeline_pose_estimation_overla -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="9.79167in" height="3.64557in" viewbox="0 0 705 262.481" xml:space="preserve" color-interpolation-filters="sRGB" class="st12"><v:documentproperties v:langid="1033" v:viewmarkup="false"></v:documentproperties>
<style>.svg-1 .st1 { fill: #fafafa; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st2 { fill: #d2d7e1; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st3 { fill: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st4 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-1 .st5 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st6 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st7 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st8 { fill: none }
.svg-1 .st9 { fill: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-1 .st10 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-1 .st11 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-1 .st12 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>pipeline_pose_estimation_overla</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape3-1" v:mid="3" v:groupcontext="shape" transform="translate(0.375,-0.37516)">		<title>Sheet.3</title>		<path d="M0 256.86 A5.62513 5.62513 -180 0 0 5.62 262.48 L698.63 262.48 A5.62513 5.62513 -180 0 0 704.25 256.86 L704.25					 6.37 A5.62513 5.62513 -180 0 0 698.63 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 0 6.37 L0 256.86 Z" class="st1"></path>	</g>	<g id="shape4-3" v:mid="4" v:groupcontext="shape">		<title>Sheet.4</title>		<path d="M699 0.75 C701.89 0.75 704.25 3.11 704.25 6 L704.25 256.48 C704.25 259.38 701.89 261.73 699 261.73 L6 261.73					 C3.11 261.73 0.75 259.38 0.75 256.48 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L699 0.75 ZM699 0 L6 0 C2.69 0					 0 2.69 0 6 L0 256.48 C0 259.79 2.69 262.48 6 262.48 L699 262.48 C702.31 262.48 705 259.79 705 256.48 L705					 6 C705 2.69 702.31 0 699 0 Z" class="st2"></path>	</g>	<g id="shape15-5" v:mid="15" v:groupcontext="shape" transform="translate(15,-209.981)">		<title>Sheet.15</title>		<desc>camsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="40.07" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>camsrc</text>		</g>	<g id="shape18-8" v:mid="18" v:groupcontext="shape" transform="translate(135,-228.731)">		<title>Sheet.18</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape19-11" v:mid="19" v:groupcontext="shape" transform="translate(149.217,-226.113)">		<title>Sheet.19</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape21-13" v:mid="21" v:groupcontext="shape" transform="translate(476.231,51.7309) rotate(90)">		<title>Sheet.21</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape22-16" v:mid="22" v:groupcontext="shape" transform="translate(211.132,-192)">		<title>Sheet.22</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape24-18" v:mid="24" v:groupcontext="shape" transform="translate(153.75,-209.981)">		<title>Sheet.24</title>		<desc>tee</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="51.68" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>tee</text>		</g>	<g id="shape27-21" v:mid="27" v:groupcontext="shape" transform="translate(153.75,-154.5)">		<title>Sheet.27</title>		<desc>qtimlvconverter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="18.39" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlvconverter</text>		</g>	<g id="shape30-24" v:mid="30" v:groupcontext="shape" transform="translate(476.231,107.981) rotate(90)">		<title>Sheet.30</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape31-27" v:mid="31" v:groupcontext="shape" transform="translate(211.132,-135.75)">		<title>Sheet.31</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape33-29" v:mid="33" v:groupcontext="shape" transform="translate(153.75,-98.25)">		<title>Sheet.33</title>		<desc>qtimltflite</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 -0 227.98 L0 259.48 Z" class="st7"></path>		<text x="34.36" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimltflite</text>		</g>	<g id="shape36-32" v:mid="36" v:groupcontext="shape" transform="translate(476.231,164.231) rotate(90)">		<title>Sheet.36</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape37-35" v:mid="37" v:groupcontext="shape" transform="translate(211.132,-79.5)">		<title>Sheet.37</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape39-37" v:mid="39" v:groupcontext="shape" transform="translate(153.75,-42)">		<title>Sheet.39</title>		<desc>qtimlpostprocess</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 -0 227.98 L0 259.48 Z" class="st7"></path>		<text x="13.29" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlpostprocess</text>		</g>	<g id="shape42-40" v:mid="42" v:groupcontext="shape" transform="translate(273.75,-228.731)">		<title>Sheet.42</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape43-43" v:mid="43" v:groupcontext="shape" transform="translate(287.966,-226.113)">		<title>Sheet.43</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape45-45" v:mid="45" v:groupcontext="shape" transform="translate(292.5,-209.981)">		<title>Sheet.45</title>		<desc>qtimetamux</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="27.97" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimetamux</text>		</g>	<g id="shape48-48" v:mid="48" v:groupcontext="shape" transform="translate(412.5,-228.731)">		<title>Sheet.48</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape49-51" v:mid="49" v:groupcontext="shape" transform="translate(426.716,-226.113)">		<title>Sheet.49</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape51-53" v:mid="51" v:groupcontext="shape" transform="translate(431.25,-209.981)">		<title>Sheet.51</title>		<desc>qtioverlay</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="34.08" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtioverlay</text>		</g>	<g id="shape54-56" v:mid="54" v:groupcontext="shape" transform="translate(551.25,-228.731)">		<title>Sheet.54</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape55-59" v:mid="55" v:groupcontext="shape" transform="translate(565.466,-226.113)">		<title>Sheet.55</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape57-61" v:mid="57" v:groupcontext="shape" transform="translate(570,-209.981)">		<title>Sheet.57</title>		<desc>Waylandsink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="26.26" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Waylandsink</text>		</g>	<g id="shape60-64" v:mid="60" v:groupcontext="shape" transform="translate(273.75,-58.9772)">		<title>Sheet.60</title>		<path d="M0 262.48 L78.75 262.48 L78.75 115.17 L0 262.48 Z" class="st8"></path>		<path d="M0 262.48 L78.75 262.48 L78.75 115.17" class="st5"></path>	</g>	<g id="shape61-67" v:mid="61" v:groupcontext="shape" transform="translate(349.882,-205.523)">		<title>Sheet.61</title>		<path d="M5.24 262.48 L2.62 257.95 L0 262.48 L5.24 262.48 Z" class="st6"></path>	</g>	<g id="group70-69" transform="translate(579.875,-14.7814)" v:mid="70" v:groupcontext="group">		<title>Sheet.70</title>		<g id="shape7-70" v:mid="7" v:groupcontext="shape" transform="translate(15.1883,0)">			<title>Sheet.7</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="27.9403" cy="256.181" width="55.89" height="12.6"></v:textrect>			<rect x="0" y="249.881" width="55.8807" height="12.6" class="st9"></rect>			<text x="0" y="259.33" class="st10" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape8-73" v:mid="8" v:groupcontext="shape" transform="translate(3.09752E-14,-0.218607)">			<title>Sheet.8</title>			<path d="M0 260.98 A1.50003 1.50003 -180 0 0 1.5 262.48 L10.5 262.48 A1.50003 1.50003 -180 0 0 12 260.98 L12 251.98						 A1.50003 1.50003 -180 0 0 10.5 250.48 L1.5 250.48 A1.50003 1.50003 -180 0 0 -0 251.98 L0 260.98 Z" class="st7"></path>		</g>		<g id="shape10-75" v:mid="10" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.10</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="256.181" width="21" height="12.6"></v:textrect>			<rect x="0" y="249.881" width="21" height="12.6" class="st9"></rect>			<text x="0" y="259.33" class="st11" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape11-78" v:mid="11" v:groupcontext="shape" transform="translate(73.9363,-0.218607)">			<title>Sheet.11</title>			<path d="M0 260.98 A1.50003 1.50003 -180 0 0 1.5 262.48 L10.5 262.48 A1.50003 1.50003 -180 0 0 12 260.98 L12 251.98						 A1.50003 1.50003 -180 0 0 10.5 250.48 L1.5 250.48 A1.50003 1.50003 -180 0 0 0 251.98 L0 260.98 Z" class="st3"></path>		</g>	</g></g>
</svg>

下表列出了 pipeline 执行的顺序处理阶段：

| 处理过程 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_l2f_zgm_vbc"><br>                                    <li class="li">采集视频流（源）并创建源的两个副本：<ol class="ol" type="a" id="single-camera-stream-with-pose-estimation-and-display__ol_m2f_zgm_vbc"><br>                                            <li class="li">一个被发送到 qtimetamux 插件以保留视频流。</li><br><br>                                            <li class="li">另一个被发送到 ML 推理 pipeline。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |
| **预处理** | **预处理** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimlvconverter.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_xsf_q5l_vbc"><br>                                    <li class="li">在其接收端口上接收视频流。</li><br><br>                                    <li class="li">执行预处理：<ul class="ul" id="single-camera-stream-with-pose-estimation-and-display__ul_ff2_twl_vbc"><br>                                            <li class="li">颜色转换</li><br><br>                                            <li class="li">缩小/放大</li><br><br>                                            <li class="li">在模型需要浮点值作为输入时，对流数据进行归一化</li><br><br>                                        </ul><br></li><br><br>                                    <li class="li">在其发送端口上将视频流转换为张量数据。<p class="p">HRNet 模型使用此张量流进行推理。</p><br></li><br><br>                                </ol> |
| **推理** | **推理** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimltflite.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_bwn_s5l_vbc"><br>                                    <li class="li">加载 HRNet 模型。</li><br><br>                                    <li class="li">为选择的 delegate 修改图。</li><br><br>                                    <li class="li">在其接收端口上接收张量数据。</li><br><br>                                    <li class="li">运行推理并在其发送端口上生成带有姿态估计结果的张量数据。</li><br><br>                                </ol> |
| **后处理** | **后处理** |
| qtimlpostprocess | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_gr1_w5l_vbc"><br>                                    <li class="li">从其接收端口上的 HRNet 模型接收推理张量。</li><br><br>                                    <li class="li">将张量转换为多媒体插件稍后可以处理的视频或文本等格式。</li><br><br>                                    <li class="li">将阈值应用于所选的结果数。</li><br><br>                                    <li class="li">加载姿态估计模型的相应模块。 <p class="p">在此用例中，qtimlpostprocess 执行以下操作：</p><ol class="ol" type="a" id="single-camera-stream-with-pose-estimation-and-display__ol_lyh_txn_vbc"><br>                                            <li class="li">加载 HRNet 子模块。</li><br><br>                                            <li class="li">将结果生成为文本结构。</li><br><br>                                            <li class="li">接着发送到 qtimetamux 的接收端口。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |
| [qtimetamux](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimetamux.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_ll3_x5l_vbc"><br>                                    <li class="li">在其接收端口上接收视频流和文本流，以及与视频流相对应的姿态结果。</li><br><br>                                    <li class="li">在其接收端口上生成包含视频流内容的 GST 缓冲存。</li><br><br>                                    <li class="li">将姿态从数据接收端口添加到其发送端口上的 GST 缓存元数据（元复用）。</li><br><br>                                </ol> |
| [qtivoverlay](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtioverlay.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_wst_y5l_vbc"><br>                                    <li class="li">接收多路复用流。</li><br><br>                                    <li class="li">使用 CL 将姿态叠加在 VideoFrame 上。</li><br><br>                                    <li class="li">在其发送端口上生成带有叠加层的 GST 缓存。</li><br><br>                                </ol> |
| **输出** | **输出** |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50SC/topic/waylandsink.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_pxz_4xn_vbc"><br>                                    <li class="li">在其接收端口上接收视频流。</li><br><br>                                    <li class="li">将视频流提交到 Weston。</li><br><br>                                    <li class="li">Weston 在本地显示设备上渲染以下内容：<ol class="ol" type="a" id="single-camera-stream-with-pose-estimation-and-display__ol_uxg_yxn_vbc"><br>                                            <li class="li">从摄像头采集的视频流。</li><br><br>                                            <li class="li">为该场景中的多人生成的姿态。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |

##  使用 qtivcomposer 混合原始帧与姿态估计遮罩

在目标设备上运行用例：

    gst-launch-1.0 -e --gst-debug=2 \
    qtiqmmfsrc name=camsrc ! video/x-raw,format=NV12_Q08C,width=1280,height=720,framerate=30/1 ! queue ! tee name=split \
    split. ! queue ! qtivcomposer name=mixer ! queue ! waylandsink fullscreen=true sync=false \
    split. ! queue ! qtimlvconverter ! queue ! qtimltflite delegate=external external-delegate-path=libQnnTFLiteDelegate.so external-delegate-options="QNNExternalDelegate,backend_type=htp;" \
    model=/etc/models/hrnet_pose_quantized.tflite ! queue ! qtimlpostprocess results=2 module=hrnet labels=/etc/labels/hrnet_pose.json settings=/etc/labels/hrnet_settings.json \
     ! video/x-raw,format=BGRA,width=640,height=360 ! queue ! mixer.Copy to clipboard

要停止用例，请使用 CTRL + C。

下图显示了用例执行的流程：

1. 从摄像头源传来的视频流中识别场景中人物的姿态。
2. 使用 qtivcomposer 合成姿态和视频流。
3. 显示结果。

Figure : 使用 qtivcomposer 进行姿态估计遮罩的 pipeline
                
                <!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->

<!-- Generated by Microsoft Visio, SVG Export pipeline_pose_estimation_mask_using_qtivcomposer.svg pipeline_pose_estimation_mask_u -->
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:ev="http://www.w3.org/2001/xml-events" xmlns:v="http://schemas.microsoft.com/visio/2003/SVGExtensions/" width="7.86458in" height="3.64557in" viewbox="0 0 566.25 262.481" xml:space="preserve" color-interpolation-filters="sRGB" class="st12"><v:documentproperties v:langid="1033" v:viewmarkup="false"></v:documentproperties>
<style>.svg-2 .st1 { fill: #fafafa; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st2 { fill: #d2d7e1; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st3 { fill: #007884; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st4 { fill: #ffffff; font-family: Roboto; font-size: 1.00001em }
.svg-2 .st5 { stroke: #000000; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st6 { fill: #000000; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st7 { fill: #2a2aea; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st8 { fill: none }
.svg-2 .st9 { fill: none; stroke: none; stroke-linecap: butt; stroke-width: 0.75 }
.svg-2 .st10 { fill: #000000; font-family: Roboto; font-size: 0.874992em }
.svg-2 .st11 { fill: #000000; font-family: SimHei; font-size: 0.874992em }
.svg-2 .st12 { fill: none; fill-rule: evenodd; font-size: 12px; overflow: visible; stroke-linecap: square; stroke-miterlimit: 3 }</style>
<g v:mid="0" v:index="1" v:groupcontext="foregroundPage">	<title>pipeline_pose_estimation_mask_u</title>	<v:pageproperties v:drawingscale="1" v:pagescale="1" v:drawingunits="19" v:shadowoffsetx="9" v:shadowoffsety="-9"></v:pageproperties>	<g id="shape3-1" v:mid="3" v:groupcontext="shape" transform="translate(0.375,-0.375137)">		<title>Sheet.3</title>		<path d="M0 256.86 A5.62513 5.62513 -180 0 0 5.62 262.48 L559.87 262.48 A5.62513 5.62513 -180 0 0 565.5 256.86 L565.5					 6.37 A5.62513 5.62513 -180 0 0 559.87 0.75 L5.62 0.75 A5.62513 5.62513 -180 0 0 -0 6.37 L0 256.86 Z" class="st1"></path>	</g>	<g id="shape4-3" v:mid="4" v:groupcontext="shape">		<title>Sheet.4</title>		<path d="M560.25 0.75 C563.14 0.75 565.5 3.11 565.5 6 L565.5 256.48 C565.5 259.38 563.14 261.73 560.25 261.73 L6 261.73					 C3.11 261.73 0.75 259.38 0.75 256.48 L0.75 6 C0.75 3.11 3.11 0.75 6 0.75 L560.25 0.75 ZM560.25 0 L6 0 C2.69					 0 0 2.69 0 6 L0 256.48 C0 259.79 2.69 262.48 6 262.48 L560.25 262.48 C563.56 262.48 566.25 259.79 566.25					 256.48 L566.25 6 C566.25 2.69 563.56 0 560.25 0 Z" class="st2"></path>	</g>	<g id="shape15-5" v:mid="15" v:groupcontext="shape" transform="translate(15,-209.981)">		<title>Sheet.15</title>		<desc>camsrc</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="40.07" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>camsrc</text>		</g>	<g id="shape18-8" v:mid="18" v:groupcontext="shape" transform="translate(135,-228.731)">		<title>Sheet.18</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape19-11" v:mid="19" v:groupcontext="shape" transform="translate(149.217,-226.113)">		<title>Sheet.19</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape21-13" v:mid="21" v:groupcontext="shape" transform="translate(476.231,51.7309) rotate(90)">		<title>Sheet.21</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape22-16" v:mid="22" v:groupcontext="shape" transform="translate(211.132,-192)">		<title>Sheet.22</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape24-18" v:mid="24" v:groupcontext="shape" transform="translate(153.75,-209.981)">		<title>Sheet.24</title>		<desc>tee</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="51.68" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>tee</text>		</g>	<g id="shape27-21" v:mid="27" v:groupcontext="shape" transform="translate(153.75,-154.5)">		<title>Sheet.27</title>		<desc>qtimlvconverter</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="18.39" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlvconverter</text>		</g>	<g id="shape30-24" v:mid="30" v:groupcontext="shape" transform="translate(476.231,107.981) rotate(90)">		<title>Sheet.30</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape31-27" v:mid="31" v:groupcontext="shape" transform="translate(211.132,-135.75)">		<title>Sheet.31</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape33-29" v:mid="33" v:groupcontext="shape" transform="translate(153.75,-98.25)">		<title>Sheet.33</title>		<desc>qtimltflite</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="34.36" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimltflite</text>		</g>	<g id="shape36-32" v:mid="36" v:groupcontext="shape" transform="translate(476.231,164.231) rotate(90)">		<title>Sheet.36</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape37-35" v:mid="37" v:groupcontext="shape" transform="translate(211.132,-79.5)">		<title>Sheet.37</title>		<path d="M0 257.95 L2.62 262.48 L5.24 257.95 L0 257.95 Z" class="st6"></path>	</g>	<g id="shape39-37" v:mid="39" v:groupcontext="shape" transform="translate(153.75,-42)">		<title>Sheet.39</title>		<desc>qtimlpostprocess</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 -0 227.98 L0 259.48 Z" class="st7"></path>		<text x="13.29" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtimlpostprocess</text>		</g>	<g id="shape42-40" v:mid="42" v:groupcontext="shape" transform="translate(273.75,-228.731)">		<title>Sheet.42</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape43-43" v:mid="43" v:groupcontext="shape" transform="translate(287.966,-226.113)">		<title>Sheet.43</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape45-45" v:mid="45" v:groupcontext="shape" transform="translate(292.5,-209.981)">		<title>Sheet.45</title>		<desc>qtivcomposer</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st7"></path>		<text x="23.36" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>qtivcomposer</text>		</g>	<g id="shape48-48" v:mid="48" v:groupcontext="shape" transform="translate(412.5,-228.731)">		<title>Sheet.48</title>		<path d="M0 262.48 L14.98 262.48" class="st5"></path>	</g>	<g id="shape49-51" v:mid="49" v:groupcontext="shape" transform="translate(426.716,-226.113)">		<title>Sheet.49</title>		<path d="M0 262.48 L4.53 259.86 L0 257.25 L0 262.48 Z" class="st6"></path>	</g>	<g id="shape51-53" v:mid="51" v:groupcontext="shape" transform="translate(431.25,-209.981)">		<title>Sheet.51</title>		<desc>Waylandsink</desc>		<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>		<v:textrect cx="60" cy="243.731" width="120.01" height="37.5"></v:textrect>		<path d="M-0 259.48 A3.00007 3.00007 -180 0 0 3 262.48 L117 262.48 A3.00007 3.00007 -180 0 0 120 259.48 L120 227.98 A3.00007					 3.00007 -180 0 0 117 224.98 L3 224.98 A3.00007 3.00007 -180 0 0 0 227.98 L0 259.48 Z" class="st3"></path>		<text x="26.26" y="247.33" class="st4" v:langid="1033"><v:paragraph v:horizalign="1"></v:paragraph><v:tablist></v:tablist>Waylandsink</text>		</g>	<g id="shape54-56" v:mid="54" v:groupcontext="shape" transform="translate(273.75,-60.75)">		<title>Sheet.54</title>		<path d="M0 262.48 L78.75 262.48 L78.75 117.64 L0 262.48 Z" class="st8"></path>		<path d="M0 262.48 L78.75 262.48 L78.75 117.64" class="st5"></path>	</g>	<g id="shape55-59" v:mid="55" v:groupcontext="shape" transform="translate(349.882,-204.829)">		<title>Sheet.55</title>		<path d="M5.24 262.48 L2.62 257.95 L0 262.48 L5.24 262.48 Z" class="st6"></path>	</g>	<g id="group64-61" transform="translate(441.125,-14.7814)" v:mid="64" v:groupcontext="group">		<title>Sheet.64</title>		<g id="shape7-62" v:mid="7" v:groupcontext="shape" transform="translate(15.1882,0)">			<title>Sheet.7</title>			<desc>Qualcomm</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="28.4845" cy="256.181" width="56.97" height="12.6"></v:textrect>			<rect x="0" y="249.881" width="56.969" height="12.6" class="st9"></rect>			<text x="0" y="259.33" class="st10" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>Qualcomm  </text>			</g>		<g id="shape8-65" v:mid="8" v:groupcontext="shape" transform="translate(3.09752E-14,-0.218619)">			<title>Sheet.8</title>			<path d="M0 260.98 A1.50003 1.50003 -180 0 0 1.5 262.48 L10.5 262.48 A1.50003 1.50003 -180 0 0 12 260.98 L12 251.98						 A1.50003 1.50003 -180 0 0 10.5 250.48 L1.5 250.48 A1.50003 1.50003 -180 0 0 -0 251.98 L0 260.98 Z" class="st7"></path>		</g>		<g id="shape10-67" v:mid="10" v:groupcontext="shape" transform="translate(89.1246,0)">			<title>Sheet.10</title>			<desc>开源</desc>			<v:textblock v:margins="rect(0,0,0,0)"></v:textblock>			<v:textrect cx="10.5" cy="256.181" width="21" height="12.6"></v:textrect>			<rect x="0" y="249.881" width="21" height="12.6" class="st9"></rect>			<text x="0" y="259.33" class="st11" v:langid="1033"><v:paragraph></v:paragraph><v:tablist></v:tablist>开源</text>			</g>		<g id="shape11-70" v:mid="11" v:groupcontext="shape" transform="translate(73.9363,-0.218619)">			<title>Sheet.11</title>			<path d="M0 260.98 A1.50003 1.50003 -180 0 0 1.5 262.48 L10.5 262.48 A1.50003 1.50003 -180 0 0 12 260.98 L12 251.98						 A1.50003 1.50003 -180 0 0 10.5 250.48 L1.5 250.48 A1.50003 1.50003 -180 0 0 -0 251.98 L0 260.98 Z" class="st3"></path>		</g>	</g></g>
</svg>

下表列出了 pipeline 执行的顺序处理阶段：

| 处理过程 | 说明 |
| --- | --- |
| [qtiqmmfsrc](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtiqmmfsrc.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_gqx_gzn_vbc"><br>                                    <li class="li">采集视频流（源）并创建源的两个副本：<ul class="ul" id="single-camera-stream-with-pose-estimation-and-display__ol_hqx_gzn_vbc"><br>                                            <li class="li">一个被发送到 qtimetamux 插件以保留视频流。</li><br><br>                                            <li class="li">另一个被发送到 ML 推理 pipeline。</li><br><br>                                        </ul><br></li><br><br>                                </ol> |
| **预处理** | **预处理** |
| [qtimlvconverter](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimlvconverter.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_iqx_gzn_vbc"><br>                                    <li class="li">在其接收端口上接收视频流。</li><br><br>                                    <li class="li">执行预处理：<ul class="ul" id="single-camera-stream-with-pose-estimation-and-display__ul_jqx_gzn_vbc"><br>                                            <li class="li">颜色转换</li><br><br>                                            <li class="li">缩小/放大</li><br><br>                                            <li class="li">在模型需要浮点值作为输入时，对流数据进行归一化</li><br><br>                                        </ul><br></li><br><br>                                    <li class="li">在其发送端口上将视频流转换为张量数据。<p class="p">HRNet 模型使用此张量流进行推理。</p><br></li><br><br>                                </ol> |
| **推理** | **推理** |
| [qtimltflite](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtimltflite.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_kqx_gzn_vbc"><br>                                    <li class="li">加载 HRNet 模型。</li><br><br>                                    <li class="li">为选择的 delegate 修改图。</li><br><br>                                    <li class="li">在其接收端口上接收张量数据。</li><br><br>                                    <li class="li">运行推理并在其发送端口上生成带有姿态估计结果的张量数据。</li><br><br>                                </ol> |
| **后处理** | **后处理** |
| qtimlpostprocess | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_lqx_gzn_vbc"><br>                                    <li class="li">从其接收端口上的 HRNet 模型接收推理张量。</li><br><br>                                    <li class="li">将张量转换为多媒体插件稍后可以处理的视频或文本等格式。</li><br><br>                                    <li class="li">将阈值应用于所选的结果数。</li><br><br>                                    <li class="li">加载姿态估计模型的相应模块。 <p class="p">在此用例中，qtimlpostprocess 执行以下操作：</p><ol class="ol" type="a" id="single-camera-stream-with-pose-estimation-and-display__ol_mqx_gzn_vbc"><br>                                            <li class="li">加载 HRNet 子模块。</li><br><br>                                            <li class="li">将结果生成为所绘制姿态的视频帧。</li><br><br>                                            <li class="li">将它们发送至 qtivcomposer 的接收端口。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |
| [qtivcomposer](https://docs.qualcomm.com/doc/80-70022-50SC/topic/qtivcomposer.html) | <ol class="ol"><br>                                    <li class="li"> 在接收端口上接收原始视频流和姿态视频流。</li><br><br>                                    <li class="li">在其发送端口上，生成 GST 缓存，其内容由来自其接收端口的视频流组成。</li><br><br>                                </ol> |
| **输出** | **输出** |
| [Waylandsink](https://docs.qualcomm.com/doc/80-70022-50SC/topic/waylandsink.html) | <ol class="ol" id="single-camera-stream-with-pose-estimation-and-display__ol_pqx_gzn_vbc"><br>                                    <li class="li">在其接收端口上接收视频流。</li><br><br>                                    <li class="li">将视频流提交到 Weston。</li><br><br>                                    <li class="li">Weston 在本地显示设备上渲染以下内容：<ol class="ol" type="a" id="single-camera-stream-with-pose-estimation-and-display__ol_qqx_gzn_vbc"><br>                                            <li class="li">从摄像头采集的视频流。</li><br><br>                                            <li class="li">为该场景中的多人生成的姿态。</li><br><br>                                        </ol><br></li><br><br>                                </ol> |

**Parent Topic:** [LiteRT 用例](https://docs.qualcomm.com/doc/80-70022-50SC/topic/tensorflow-lite-use-cases.html)

Last Published: Nov 05, 2025

[Previous Topic
使用 LiteRT 进行图像分割和编码](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/single-camera-stream-with-image-segmentation-and-encode.md) [Next Topic
使用 LiteRT 进行姿态估计和编码](https://docs.qualcomm.com/bundle/publicresource/80-70022-50SC/topics/single-camera-stream-with-pose-estimation-and-encode.md)