drawio常用模版

Bean创建流程

<mxGraphModel dx="1298" dy="758" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="827" pageHeight="1169" background="#ffffff" math="0" shadow="0">
  <root>
    <mxCell id="WIyWlLk6GJQsqaUBKTNV-0" />
    <mxCell id="WIyWlLk6GJQsqaUBKTNV-1" parent="WIyWlLk6GJQsqaUBKTNV-0" />
    <mxCell id="8" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="0" target="2" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="0" value="开始创建A" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="120" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="4" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="7" target="9" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="200" y="320" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="42" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="43" target="40" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="40" y="770" as="targetPoint" />
        <Array as="points">
          <mxPoint x="40" y="200" />
          <mxPoint x="40" y="775" />
        </Array>
      </mxGeometry>
    </mxCell>
    <mxCell id="45" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="40" y="200" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="2" value="检查一级缓存中是否有A" style="rhombus;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="130" y="170" width="140" height="60" as="geometry" />
    </mxCell>
    <mxCell id="14" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="9" target="13" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="9" value="为A设置B属性" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="330" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="7" value="将A的工厂类放入三级缓存" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="260" width="80" height="40" as="geometry" />
    </mxCell>
    <mxCell id="11" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="2" target="7" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="200" y="320" as="targetPoint" />
        <mxPoint x="200" y="230" as="sourcePoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="12" value="否" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="11" vertex="1" connectable="0">
      <mxGeometry x="-0.2" relative="1" as="geometry">
        <mxPoint y="-8" as="offset" />
      </mxGeometry>
    </mxCell>
    <mxCell id="15" value="否" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="13" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="200" y="520" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="38" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0;entryY=0.5;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="13" target="33" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="100" y="610" as="targetPoint" />
        <Array as="points">
          <mxPoint x="80" y="425" />
          <mxPoint x="80" y="613" />
        </Array>
      </mxGeometry>
    </mxCell>
    <mxCell id="39" value="是" style="edgeLabel;html=1;align=center;verticalAlign=middle;resizable=0;points=[];" parent="38" vertex="1" connectable="0">
      <mxGeometry x="-0.115" y="-3" relative="1" as="geometry">
        <mxPoint y="1" as="offset" />
      </mxGeometry>
    </mxCell>
    <mxCell id="13" value="依次检查三级缓存看B是否已经存在" style="rhombus;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="130" y="380" width="140" height="90" as="geometry" />
    </mxCell>
    <mxCell id="19" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="17" target="18" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="17" value="创建B" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="520" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="32" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="18" target="20" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="18" value="将B的工厂类放入三级缓存" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="320" y="170" width="80" height="40" as="geometry" />
    </mxCell>
    <mxCell id="25" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=0.5;entryY=0;entryDx=0;entryDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="20" target="24" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="20" value="为B设置A属性" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="320" y="240" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="27" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="24" target="26" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="24" value="A的工厂类已经在三级缓存" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="320" y="300" width="80" height="40" as="geometry" />
    </mxCell>
    <mxCell id="29" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="26" target="28" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="26" value="利用A的工厂类创建A,并将创建好的对象放入二级缓存,删除三级缓存中的A" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="320" y="370" width="80" height="90" as="geometry" />
    </mxCell>
    <mxCell id="35" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;entryX=1;entryY=0.5;entryDx=0;entryDy=0;exitX=0.5;exitY=1;exitDx=0;exitDy=0;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="28" target="33" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="360" y="620" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="28" value="B创建完成,放入一级缓存,删除二三级缓存中的B" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="320" y="500" width="80" height="70" as="geometry" />
    </mxCell>
    <mxCell id="37" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="33" target="36" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="33" value="B创建完成为A的B属性赋值" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="585" width="80" height="55" as="geometry" />
    </mxCell>
    <mxCell id="41" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="36" target="40" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="36" value="A创建完成,放入一级缓存,删除二三级缓存" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="670" width="80" height="60" as="geometry" />
    </mxCell>
    <mxCell id="40" value="创建结束" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="160" y="760" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="43" value="是" style="text;html=1;align=center;verticalAlign=middle;resizable=0;points=[];autosize=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="30" y="510" width="30" height="20" as="geometry" />
    </mxCell>
    <mxCell id="50" value="" style="edgeStyle=orthogonalEdgeStyle;rounded=0;orthogonalLoop=1;jettySize=auto;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" source="47" target="49" edge="1">
      <mxGeometry relative="1" as="geometry" />
    </mxCell>
    <mxCell id="47" value="开始创建B" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="530" y="120" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="48" value="一级缓存中已经包含B" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="530" y="185" width="80" height="30" as="geometry" />
    </mxCell>
    <mxCell id="49" value="创建结束" style="rounded=0;whiteSpace=wrap;html=1;" parent="WIyWlLk6GJQsqaUBKTNV-1" vertex="1">
      <mxGeometry x="530" y="250" width="80" height="30" as="geometry" />
    </mxCell>
  </root>
</mxGraphModel>

AOP调用流程

<mxGraphModel dx="1298" dy="758" grid="1" gridSize="10" guides="1" tooltips="1" connect="1" arrows="1" fold="1" page="1" pageScale="1" pageWidth="1100" pageHeight="850" background="#ffffff" math="0" shadow="0">
  <root>
    <mxCell id="0" />
    <mxCell id="1" parent="0" />
    <mxCell id="7baba1c4bc27f4b0-2" value="ProxyCreatorSupport" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="1" vertex="1">
      <mxGeometry x="294" y="80" width="140" height="610" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-10" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="7baba1c4bc27f4b0-2" vertex="1">
      <mxGeometry x="65" y="270" width="10" height="340" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-3" value="DefautAopProxyFactory" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="1" vertex="1">
      <mxGeometry x="513" y="80" width="167" height="580" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-13" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="7baba1c4bc27f4b0-3" vertex="1">
      <mxGeometry x="80" y="300" width="10" height="280" as="geometry" />
    </mxCell>
    <mxCell id="12" value="[ 继承了接口 且未强制使用CGLIB ]" style="text;html=1;resizable=0;points=[];autosize=1;align=left;verticalAlign=top;spacingTop=-4;fontColor=#000000;" parent="7baba1c4bc27f4b0-3" vertex="1">
      <mxGeometry x="90" y="345" width="200" height="20" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-4" value="JdkDynamicAopProxy" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="1" vertex="1">
      <mxGeometry x="756" y="80" width="150" height="580" as="geometry" />
    </mxCell>
    <mxCell id="5" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="7baba1c4bc27f4b0-4" vertex="1">
      <mxGeometry x="70" y="393" width="10" height="57" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-5" value="CglibProxyFactory" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="1" vertex="1">
      <mxGeometry x="1000" y="80" width="130" height="580" as="geometry" />
    </mxCell>
    <mxCell id="6" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="7baba1c4bc27f4b0-5" vertex="1">
      <mxGeometry x="60" y="480" width="10" height="60" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-8" value="ProxyFactoryBean" style="shape=umlLifeline;perimeter=lifelinePerimeter;whiteSpace=wrap;html=1;container=1;collapsible=0;recursiveResize=0;outlineConnect=0;rounded=1;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="1" vertex="1">
      <mxGeometry x="70" y="80" width="120" height="620" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-9" value="" style="html=1;points=[];perimeter=orthogonalPerimeter;rounded=0;shadow=0;comic=0;labelBackgroundColor=none;strokeColor=#000000;strokeWidth=1;fillColor=#FFFFFF;fontFamily=Verdana;fontSize=12;fontColor=#000000;align=center;" parent="7baba1c4bc27f4b0-8" vertex="1">
      <mxGeometry x="55" y="100" width="10" height="510" as="geometry" />
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-23" value="getProxy()" style="html=1;verticalAlign=bottom;endArrow=block;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="135" y="351" as="sourcePoint" />
        <mxPoint x="360" y="351" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="7baba1c4bc27f4b0-14" value="createAopProxy()" style="html=1;verticalAlign=bottom;endArrow=block;entryX=-0.1;entryY=0.523;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;elbow=vertical;entryPerimeter=0;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="370" y="382" as="sourcePoint" />
        <mxPoint x="589" y="382" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="2" value="initializeAdvisorChain()" style="html=1;verticalAlign=bottom;endArrow=block;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;elbow=vertical;edgeStyle=orthogonalEdgeStyle;curved=1;entryX=1;entryY=0.286;entryPerimeter=0;exitX=1.038;exitY=0.345;exitPerimeter=0;" parent="1" edge="1">
      <mxGeometry x="0.3007" y="-72" relative="1" as="geometry">
        <mxPoint x="135" y="200" as="sourcePoint" />
        <mxPoint x="140" y="238" as="targetPoint" />
        <Array as="points">
          <mxPoint x="190" y="200" />
          <mxPoint x="190" y="238" />
        </Array>
        <mxPoint x="70" y="54" as="offset" />
      </mxGeometry>
    </mxCell>
    <mxCell id="3" value="getSingletonInstance()" style="html=1;verticalAlign=bottom;endArrow=block;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;elbow=vertical;edgeStyle=orthogonalEdgeStyle;curved=1;entryX=1;entryY=0.286;entryPerimeter=0;exitX=1.038;exitY=0.345;exitPerimeter=0;" parent="1" edge="1">
      <mxGeometry x="0.3007" y="-72" relative="1" as="geometry">
        <mxPoint x="135" y="272" as="sourcePoint" />
        <mxPoint x="140" y="310" as="targetPoint" />
        <Array as="points">
          <mxPoint x="190" y="272" />
          <mxPoint x="190" y="310" />
        </Array>
        <mxPoint x="70" y="54" as="offset" />
      </mxGeometry>
    </mxCell>
    <mxCell id="7" value="new JdkDynamicAopProxy()" style="html=1;verticalAlign=bottom;endArrow=block;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;elbow=vertical;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="603" y="473" as="sourcePoint" />
        <mxPoint x="827" y="473" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="8" value="alt" style="shape=umlFrame;whiteSpace=wrap;html=1;labelBackgroundColor=none;strokeColor=#FF0000;fillColor=none;fontColor=#000000;align=left;width=40;height=20;" parent="1" vertex="1">
      <mxGeometry x="550" y="400" width="580" height="240" as="geometry" />
    </mxCell>
    <mxCell id="13" value="[&amp;nbsp; else&amp;nbsp; ]" style="text;html=1;resizable=0;points=[];autosize=1;align=left;verticalAlign=top;spacingTop=-4;fontColor=#000000;" parent="1" vertex="1">
      <mxGeometry x="610" y="540" width="60" height="20" as="geometry" />
    </mxCell>
    <mxCell id="15" value="new&amp;nbsp;&lt;span&gt;CglibProxyFactory&lt;/span&gt;()" style="html=1;verticalAlign=bottom;endArrow=block;labelBackgroundColor=none;fontFamily=Verdana;fontSize=12;elbow=vertical;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="603" y="560" as="sourcePoint" />
        <mxPoint x="1060" y="560" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="16" value="return" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;strokeColor=#000000;fontColor=#000000;entryX=1.1;entryY=0.425;entryPerimeter=0;" parent="1" edge="1">
      <mxGeometry x="-0.0447" y="-10" relative="1" as="geometry">
        <mxPoint x="826" y="530" as="sourcePoint" />
        <mxPoint x="604" y="529" as="targetPoint" />
        <mxPoint as="offset" />
      </mxGeometry>
    </mxCell>
    <mxCell id="17" value="return" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;strokeColor=#000000;fontColor=#000000;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="1060" y="621" as="sourcePoint" />
        <mxPoint x="603" y="621" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="19" value="return" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;strokeColor=#000000;fontColor=#000000;" parent="1" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="598" y="660" as="sourcePoint" />
        <mxPoint x="370" y="660" as="targetPoint" />
      </mxGeometry>
    </mxCell>
    <mxCell id="21" value="return" style="html=1;verticalAlign=bottom;endArrow=open;dashed=1;endSize=8;strokeColor=#000000;fontColor=#000000;entryX=0.7;entryY=1;entryPerimeter=0;" parent="1" target="7baba1c4bc27f4b0-9" edge="1">
      <mxGeometry relative="1" as="geometry">
        <mxPoint x="358" y="689" as="sourcePoint" />
        <mxPoint x="139" y="689" as="targetPoint" />
      </mxGeometry>
    </mxCell>
  </root>
</mxGraphModel>

  • 8
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
在ROS中使用OpenCV进行模板匹配,可以通过以下步骤实现: 1. 安装OpenCV库:在ROS中使用OpenCV,需要先安装OpenCV库。可以使用以下命令在终端中安装: ``` sudo apt-get install ros-<distro>-opencv* ``` 其中,\<distro\>代表ROS版本,比如ROS Kinetic、ROS Melodic等。 2. 编写代码:创建一个ROS节点,并在其中使用OpenCV库进行模板匹配。可以使用以下代码作为参考: ```python import rospy import cv2 # 订阅图像话题 def callback(img_msg): try: # 将ROS图像消息转换为OpenCV图像 cv_image = cv2.imgmsg_to_cv2(img_msg, "bgr8") # 读取模板 template = cv2.imread("template.png", 0) # 进行模板匹配 res = cv2.matchTemplate(cv_image, template, cv2.TM_CCOEFF_NORMED) # 获取匹配结果 min_val, max_val, min_loc, max_loc = cv2.minMaxLoc(res) # 在原图中绘制匹配结果 cv2.rectangle(cv_image, max_loc, (max_loc[0]+template.shape[1], max_loc[1]+template.shape[0]), (0, 0, 255), 2) # 显示匹配结果 cv2.imshow("Result", cv_image) cv2.waitKey(1) except CvBridgeError as e: print(e) # 创建ROS节点 rospy.init_node("template_matching") # 创建图像订阅者 image_sub = rospy.Subscriber("/camera/image_raw", Image, callback) # 进入主循环 rospy.spin() ``` 在上述代码中,首先通过订阅ROS图像话题获取图像,然后读取模板,并使用`cv2.matchTemplate()`函数进行模板匹配。最后,通过绘制矩形框的方式在原图中显示匹配结果。 3. 运行代码:在终端中运行ROS节点,启动相机节点并发布图像话题。可以使用以下命令启动相机节点: ``` roslaunch <camera_package> <camera.launch> ``` 其中,\<camera_package\>代表相机驱动包的名称,比如usb_cam、raspicam等。 然后,使用以下命令运行ROS节点: ``` rosrun <package_name> template_matching.py ``` 其中,\<package_name\>代表ROS包的名称,可以根据自己的需要进行修改。 以上就是在ROS中使用OpenCV进行模板匹配的基本步骤。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值