8 手机电池正反面识别

 

一. 思路

 

 

二.效果

 

 

三. 具体

 

1.使用了掩膜(取电池 边框)

 

2. 正面(训练时,采用“二维码”部分)

 

3.反面(采用“垃圾桶”)

 

 

4.  

a.   CogPMAlignTool,pma-zheng, pma-fan:添加终端---Results.Count。

b. CogToolBlock1:重命名。

                               type:右击CogToolBlock1 --- Add Input -- Add new System type --- Add new System.String

 

 

 

5.脚本

public class CogToolBlockSimpleScript : CogToolBlockAdvancedScript
{
  /// <summary>
  /// Called when the parent tool is run.
  /// Add code here to customize or replace the normal run behavior.
  /// </summary>
  /// <param name="message">Sets the Message in the tool's RunStatus.</param>
  /// <param name="result">Sets the Result in the tool's RunStatus</param>
  /// <returns>True if the tool should run normally,
  ///          False if GroupRun customizes run behavior</returns>
  public override bool GroupRun(ref string message, ref CogToolResultConstants result)
  {
    // To let the execution stop in this script when a debugger is attached, uncomment the following lines.
    // #if DEBUG
    // if (System.Diagnostics.Debugger.IsAttached) System.Diagnostics.Debugger.Break();
    // #endif



    // 此部分
    if( Inputs.YouWu_Count > 0)
    {
      if( Inputs.Zheng_Count1 > 0 )
      {Outputs.type = "正面"; }
      else
      {Outputs.type = "反面";} 
             
    } 
    else
    {
      Outputs.type = "error";
    }
    
    


    
    
    return false;
  }
View Code

 

 

 

6. 字体颜色,大小,“放置---对齐”

 

 

posted @ 2024-01-20 16:24  shadow3  阅读(36)  评论(0编辑  收藏  举报