zoukankan      html  css  js  c++  java
  • VC/halcon入门之显示图片

    建立vc++控制台程序

    添加代码如下:

    #include "stdafx.h"
    
    
    #include "HalconCpp.h"
    #include <iostream>
    using namespace Halcon;
    using namespace std;
    int main(int argc, char *argv[])
    {
      cout << "-------------------------------" << endl;
      cout << "Example program for HALCON/C++:" << endl;
      cout << "-------------------------------" << endl;
      cout << "- read image <monkey>" << endl;
      cout << "- open graphics window" << endl;
      cout << "- segmentation of the eyes" << endl << endl;
    
    
      HRegionArray  Eyes;                     // result of the segmentation
      HByteImage    Mandrill("monkey");       // read input image
      HWindow       w(0,0,Mandrill.Width(),Mandrill.Height());   // open window
    
      w.SetPart(0,0,Mandrill.Height()-1,Mandrill.Width()-1);
    
      Mandrill.Display (w);                   // display the Mandrill
    
      HRegionArray regs = (Mandrill >= 128).Connection();  // find bright regions
    
      for (long i = 0; i < regs.Num(); i++)   // check each region
      {
        if ((regs[i].Area() > 500) &&         // for minimum size
            (regs[i].Area() < 50000) &&       // for maximum size
        (regs[i].Anisometry() < 1.7))     // and shape
        {
           Eyes.Append(regs[i]);              // add found region to the list
        }
      }
    
      w.SetColor("red");                      // prepare display of regions
      w.SetDraw("margin");
      w.SetLineWidth(3);
    
      (Eyes.FillUp() << 9).Display(w);        // expand filled eyes and display
      w.Click();                              // wait for mouse click
    
      cout << "The End." << endl;
      return(0);
    }

    运行结果如下:

    通过该例程,我们可以得出在vc中使用Halcon时,通过Halcon提供的类函数处理数据,遵循c++的语法知识。

  • 相关阅读:
    转载:渗透利器-余弦
    搜索引擎?
    Gartner:用自适应安全架构来应对高级定向攻击
    内网渗透测试思路-FREEBUF
    渗透测试常规思路分析-FREEBUF
    SQLMAP使用笔记
    如何打造一款优秀的产品管理系统?
    阿里的钉钉能干掉腾讯的微信么?
    下一个亿万市场:企业级SaaS服务谁能独领风骚
    如何注册iClap账号?
  • 原文地址:https://www.cnblogs.com/wt1990/p/4505433.html
Copyright © 2011-2022 走看看