saturneric.github.io/2019/10/09/NaoVision-General-Introduction/index.html

446 lines
21 KiB
HTML
Raw Normal View History

2019-10-25 06:36:20 +00:00
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=2">
<meta name="theme-color" content="#222">
<meta name="generator" content="Hexo 3.9.0">
<link rel="apple-touch-icon" sizes="180x180" href="/images/apple-touch-icon-next.png?v=7.4.1">
<link rel="icon" type="image/png" sizes="32x32" href="/images/favicon-32x32-next.png?v=7.4.1">
<link rel="icon" type="image/png" sizes="16x16" href="/images/favicon-16x16-next.png?v=7.4.1">
<link rel="mask-icon" href="/images/logo.svg?v=7.4.1" color="#222">
<link rel="stylesheet" href="/css/main.css?v=7.4.1">
<link rel="stylesheet" href="/lib/font-awesome/css/font-awesome.min.css?v=4.7.0">
<script id="hexo-configurations">
var NexT = window.NexT || {};
var CONFIG = {
root: '/',
scheme: 'Muse',
version: '7.4.1',
exturl: false,
sidebar: {"position":"left","display":"post","offset":12,"onmobile":false},
copycode: {"enable":false,"show_result":false,"style":null},
back2top: {"enable":true,"sidebar":false,"scrollpercent":false},
bookmark: {"enable":false,"color":"#222","save":"auto"},
fancybox: false,
mediumzoom: false,
lazyload: false,
pangu: false,
algolia: {
appID: '',
apiKey: '',
indexName: '',
hits: {"per_page":10},
labels: {"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}","hits_stats":"${hits} results found in ${time} ms"}
},
localsearch: {"enable":false,"trigger":"auto","top_n_per_article":1,"unescape":false,"preload":false},
path: '',
motion: {"enable":true,"async":false,"transition":{"post_block":"fadeIn","post_header":"slideDownIn","post_body":"slideDownIn","coll_header":"slideLeftIn","sidebar":"slideUpIn"}},
translation: {
copy_button: 'Copy',
copy_success: 'Copied',
copy_failure: 'Copy failed'
},
sidebarPadding: 40
};
</script>
<meta name="description" content="NaoVision Concise DocumentProject SummaryIntroductionNaoVision is a dedicated NAO group of dedicated vision method solutions for NAO robots in the RoboCup competition. NaoVision was written in C++ and">
<meta name="keywords" content="Software, Computing">
<meta property="og:type" content="article">
<meta property="og:title" content="NaoVision">
<meta property="og:url" content="http://saturneric.cn/2019/10/09/NaoVision-General-Introduction/index.html">
<meta property="og:site_name" content="Hu Yu&#39;s Personal Blog">
<meta property="og:description" content="NaoVision Concise DocumentProject SummaryIntroductionNaoVision is a dedicated NAO group of dedicated vision method solutions for NAO robots in the RoboCup competition. NaoVision was written in C++ and">
<meta property="og:locale" content="en">
<meta property="og:updated_time" content="2019-10-25T06:35:45.513Z">
<meta name="twitter:card" content="summary">
<meta name="twitter:title" content="NaoVision">
<meta name="twitter:description" content="NaoVision Concise DocumentProject SummaryIntroductionNaoVision is a dedicated NAO group of dedicated vision method solutions for NAO robots in the RoboCup competition. NaoVision was written in C++ and">
<link rel="canonical" href="http://saturneric.cn/2019/10/09/NaoVision-General-Introduction/">
<script id="page-configurations">
// https://hexo.io/docs/variables.html
CONFIG.page = {
sidebar: "",
isHome: false,
isPost: true,
isPage: false,
isArchive: false
};
</script>
<title>NaoVision | Hu Yu's Personal Blog</title>
<noscript>
<style>
.use-motion .brand,
.use-motion .menu-item,
.sidebar-inner,
.use-motion .post-block,
.use-motion .pagination,
.use-motion .comments,
.use-motion .post-header,
.use-motion .post-body,
.use-motion .collection-header { opacity: initial; }
.use-motion .logo,
.use-motion .site-title,
.use-motion .site-subtitle {
opacity: initial;
top: initial;
}
.use-motion .logo-line-before i { left: initial; }
.use-motion .logo-line-after i { right: initial; }
</style>
</noscript>
</head>
<body itemscope itemtype="http://schema.org/WebPage">
<div class="container use-motion">
<div class="headband"></div>
<header id="header" class="header" itemscope itemtype="http://schema.org/WPHeader">
<div class="header-inner"><div class="site-brand-container">
<div class="site-meta">
<div>
<a href="/" class="brand" rel="start">
<span class="logo-line-before"><i></i></span>
<span class="site-title">Hu Yu's Personal Blog</span>
<span class="logo-line-after"><i></i></span>
</a>
</div>
<p class="site-subtitle">Technical Articles about Computing and Software.</p>
</div>
<div class="site-nav-toggle">
<div class="toggle" aria-label="Toggle navigation bar">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
</div>
</div>
<nav class="site-nav">
<ul id="menu" class="menu">
<li class="menu-item menu-item-home">
<a href="/" rel="section"><i class="fa fa-fw fa-home"></i>Home</a>
</li>
<li class="menu-item menu-item-archives">
<a href="/archives/" rel="section"><i class="fa fa-fw fa-archive"></i>Archives</a>
</li>
</ul>
</nav>
</div>
</header>
<div class="back-to-top">
<i class="fa fa-arrow-up"></i>
<span>0%</span>
</div>
<main id="main" class="main">
<div class="main-inner">
<div class="content-wrap">
<div id="content" class="content">
<div class="posts-expand">
<article itemscope itemtype="http://schema.org/Article" class="post-block " lang="en">
<link itemprop="mainEntityOfPage" href="http://saturneric.cn/2019/10/09/NaoVision-General-Introduction/">
<span hidden itemprop="author" itemscope itemtype="http://schema.org/Person">
<meta itemprop="name" content="Hu Yu">
<meta itemprop="description" content="">
<meta itemprop="image" content="/images/avatar.gif">
</span>
<span hidden itemprop="publisher" itemscope itemtype="http://schema.org/Organization">
<meta itemprop="name" content="Hu Yu's Personal Blog">
</span>
<header class="post-header">
<h1 class="post-title" itemprop="name headline">NaoVision
</h1>
<div class="post-meta">
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-o"></i>
</span>
<span class="post-meta-item-text">Posted on</span>
<time title="Created: 2019-10-09 23:22:44" itemprop="dateCreated datePublished" datetime="2019-10-09T23:22:44+08:00">2019-10-09</time>
</span>
<span class="post-meta-item">
<span class="post-meta-item-icon">
<i class="fa fa-calendar-check-o"></i>
</span>
<span class="post-meta-item-text">Edited on</span>
<time title="Modified: 2019-10-25 14:35:45" itemprop="dateModified" datetime="2019-10-25T14:35:45+08:00">2019-10-25</time>
</span>
</div>
</header>
<div class="post-body" itemprop="articleBody">
<h1 id="NaoVision-Concise-Document"><a href="#NaoVision-Concise-Document" class="headerlink" title="NaoVision Concise Document"></a>NaoVision Concise Document</h1><h2 id="Project-Summary"><a href="#Project-Summary" class="headerlink" title="Project Summary"></a>Project Summary</h2><h3 id="Introduction"><a href="#Introduction" class="headerlink" title="Introduction"></a>Introduction</h3><p>NaoVision is a dedicated NAO group of dedicated vision method solutions for NAO robots in the RoboCup competition. NaoVision was written in C++ and is designed to solve the problem that NAO robots in the Bhuman system under the original fixed threshold scheme for the color discrimination of the field is easily interfered by light and other factors, resulting in the actual game NAO robot for the objects in the field (especially football) The identification is not fast enough and accurate.</p>
<p>Correspondingly, for the judgment of the football field, NaoVision adopts the OTSU algorithm to realize the automatic adjustment of the image processing threshold, and is able to correctly identify and mark the field pixels in most cases without being affected by the light shadow.</p>
<p>Based on the color discrimination of the site, NaoVision creates a scan line in the picture. The boundary between the site and the non-site is determined by sampling and scanning the pixels where the scan line is located. The picture is then divided into part and non-site parts by connecting between the demarcation points.</p>
<p>In general, in order to reduce the computational overhead, NaoVision only calculates the picture pixels belonging to the site part. After determining the calculation range, NaoVison will create smaller scan lines within the calculation range for more detailed scanning and detection of objects within the calculation range.</p>
<p>Then, NaoVision limited the detection of circular objects in the field. The program will perform a uniform skip scan on the scan line. After detecting pixels that do not belong to the field within the calculation range, three non-collinear points are randomly selected around the pixel. Based on these three points, the scanning is performed in eight directions, and it is known that the pixels of the field are detected and returned. Then judge whether the 24 effective points are on a circle, and simultaneously calculate the center coordinates of the circle and its radius. After the circle is added to the candidate queue, the program will continue to scan the rest of the calculation area.</p>
<p>(To be continued)</p>
<h3 id="Main-Component"><a href="#Main-Component" class="headerlink" title="Main Component"></a>Main Component</h3><p>Under NaoVisions solution (developed with Visual Studio 2019), there is</p>
<ul>
<li><strong>NAOFastTools</strong> Core Toolset</li>
<li><strong>NFTCommandLineTools</strong> Common Command Line Tools</li>
<li><strong>NFTDeamon</strong> Daemon</li>
<li><strong>NFTGUI</strong> Debugging Interface</li>
<li><strong>NFTTest</strong> OpenCV Docking Toolset</li>
<li><strong>UnitTest</strong> Unit Test Project</li>
</ul>
<h3 id="Brief-Process-Introduction"><a href="#Brief-Process-Introduction" class="headerlink" title="Brief Process Introduction"></a>Brief Process Introduction</h3><p>Problem Description: Due to various problems with the direct embedding scheme of NFT and BHuman, this project intends to adopt the independent process with BHuman.</p>
<p>In the actual game process, the <strong>NAOFastTools Framework</strong> is driven by the <strong>NFTDeamon</strong>, running in parallel with Nao qi and BHuman in the NAO robot system. <strong>NFTDeamon</strong> communicates with BHuman by sharing memory. Camera data is obtained from BHuman. After calculation, visual correction information is transmitted to BHuman. In the usual debugging process, you can use the <strong>NFTCommandLineTools ** or **NFTGUI Debug Interface</strong> to establish a connection with the <strong>NFTDeamon</strong> to monitor and adjust the <strong>NAOFastTools Framework</strong> or *<em>BHuman *</em> Operating status and related parameters.</p>
<p>(To be continued)</p>
<h4 id="Introduction-To-Each-Component"><a href="#Introduction-To-Each-Component" class="headerlink" title="Introduction To Each Component"></a>Introduction To Each Component</h4><h5 id="1-NAOFastTools-Core-Toolset"><a href="#1-NAOFastTools-Core-Toolset" class="headerlink" title="1. NAOFastTools Core Toolset"></a>1. NAOFastTools Core Toolset</h5><p>The core framework for image processing and storage of the solution and the corresponding graphics processing module stored in the NAOFastTools Core Tools Group (hereinafter referred to as NFT) is the core project of the solution. The project follows the C++14 standard, and a small portion of the code contains C++14 features (the system with BHuman2018 has libstdc++.so that supports C++14). NFT eventually generates a static link library (NAOFastTools.lib and NAOFastTools.a) that corresponds to Windows and Linux. NFT works by linking with other programs. In addition to compiling in the VS environment, the NFT framework can also be compiled in a Linux environment, provided that the clang, make, and cmake tools are properly installed. The following is an extremely simple introduction to several of the most important common classes and functions in the NFT (including not limited to the following) (the actual use requires code understanding).</p>
<p>OperaMatrix is a proxy class that is a layer of proxy access to the Matrix class of the Eigen linear algebra library. In addition to providing proxy access services, it also provides a smart pointer service that automatically creates and releases Matrix objects based on reference counts. One or more OperaMatrix corresponds to a Matrix object. OperaMatrix objects provide a variety of constructors to meet the needs of users in most situations. The elements in OperaMatrix are stored in memory in a column-first manner, and the user can directly get a pointer to the first element of the matrix via the getData() interface. The number of rows and columns of the matrix corresponding to OperaMatrix can be obtained using getRows() and getCols().</p>
<p>The Image class is a storage vector for images that contains one or more OpreaMatrix objects, corresponding to multiple channels of the image. An OperaMatrix stores pixel data for a corresponding channel. Normally, the type of pixel data (PIXEL_TYPE) is defined in NFT.h. The number of channels in an image can be obtained using the getColumns() method, and a reference to a channel can be obtained directly using the [] operator. The height and width of the image are obtained using the getHeight() and getWidth() methods.</p>
<p>The ImageYUV422 class inherits from the Image class, which provides storage for the compressed color space YUV422. Need to note that it has one and only one channel. In a specific memory implementation, it compresses the pixel data of three channels into one channel for storage. If you need to get the Y, Cr, and Cb values of a pixel, you can call getY(int, int), getCr(int, int), getCb(int, int) to access it. Further, if it is necessary to modify the Y, Cr, and Cb values of a certain pixel in the picture, the corresponding setter is called and the coordinate parameters of the pixel are provided.</p>
<p>The ImageColored class inherits from the ImageYUV422 class and has one and only one channel. It mainly provides a single-channel image storage function and is a storage carrier for the output of the site color discrimination module. It is also a storage carrier for input data for many other vision modules. It disables all of the features of the ImageYUV422 parent class that have operations on the YUV color space.</p>
<p>The ImageSaver class is a storage service class for the Image class. It can store the data in the Image object correctly in a file on a Windows or Linux system (.nftd suffix). It can also build the corresponding Image object by reading the file in .nftd format.</p>
<p>(To be continued)</p>
<h5 id="2-NFTGUI-Debugging-Interface"><a href="#2-NFTGUI-Debugging-Interface" class="headerlink" title="2. NFTGUI Debugging Interface"></a>2. NFTGUI Debugging Interface</h5><p>The NFTGUI debugging interface is based on Qt5. It is a visual debugging interface for NAOFastTools. It can output intermediate results and internal related parameters for processing each graphics processing module.</p>
<p>(To be continued)</p>
<h5 id="3-NFTTest-Opencv-Docking-Toolset"><a href="#3-NFTTest-Opencv-Docking-Toolset" class="headerlink" title="3.NFTTest Opencv Docking Toolset"></a>3.NFTTest Opencv Docking Toolset</h5><p>The NFTTest Opencv Docking Toolset is a bridge between the NaoVision framework and the OpenCV framework. It provides a conversion function between the main data structures between the two frameworks. In addition, the project is also used for the most basic debugging information output during the development process. .</p>
<p>(To be continued)</p>
<h5 id="4-UnitTest"><a href="#4-UnitTest" class="headerlink" title="4.UnitTest"></a>4.UnitTest</h5><p>Based on the Google Test test framework, the unit test code of the core framework in NAOFastTools is stored. This code will ensure that the core framework can run efficiently and accurately, and it is convenient to discover the loopholes in the framework in time.</p>
<p>(To be continued)</p>
</div>
<footer class="post-footer">
</footer>
</article>
</div>
</div>
</div>
<div class="toggle sidebar-toggle">
<span class="toggle-line toggle-line-first"></span>
<span class="toggle-line toggle-line-middle"></span>
<span class="toggle-line toggle-line-last"></span>
</div>
<aside class="sidebar">
<div class="sidebar-inner">
<ul class="sidebar-nav motion-element">
<li class="sidebar-nav-toc">
Table of Contents
</li>
<li class="sidebar-nav-overview">
Overview
</li>
</ul>
<!--noindex-->
<div class="post-toc-wrap sidebar-panel">
<div class="post-toc motion-element"><ol class="nav"><li class="nav-item nav-level-1"><a class="nav-link" href="#NaoVision-Concise-Document"><span class="nav-number">1.</span> <span class="nav-text">NaoVision Concise Document</span></a><ol class="nav-child"><li class="nav-item nav-level-2"><a class="nav-link" href="#Project-Summary"><span class="nav-number">1.1.</span> <span class="nav-text">Project Summary</span></a><ol class="nav-child"><li class="nav-item nav-level-3"><a class="nav-link" href="#Introduction"><span class="nav-number">1.1.1.</span> <span class="nav-text">Introduction</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Main-Component"><span class="nav-number">1.1.2.</span> <span class="nav-text">Main Component</span></a></li><li class="nav-item nav-level-3"><a class="nav-link" href="#Brief-Process-Introduction"><span class="nav-number">1.1.3.</span> <span class="nav-text">Brief Process Introduction</span></a><ol class="nav-child"><li class="nav-item nav-level-4"><a class="nav-link" href="#Introduction-To-Each-Component"><span class="nav-number">1.1.3.1.</span> <span class="nav-text">Introduction To Each Component</span></a><ol class="nav-child"><li class="nav-item nav-level-5"><a class="nav-link" href="#1-NAOFastTools-Core-Toolset"><span class="nav-number">1.1.3.1.1.</span> <span class="nav-text">1. NAOFastTools Core Toolset</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#2-NFTGUI-Debugging-Interface"><span class="nav-number">1.1.3.1.2.</span> <span class="nav-text">2. NFTGUI Debugging Interface</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#3-NFTTest-Opencv-Docking-Toolset"><span class="nav-number">1.1.3.1.3.</span> <span class="nav-text">3.NFTTest Opencv Docking Toolset</span></a></li><li class="nav-item nav-level-5"><a class="nav-link" href="#4-UnitTest"><span class="nav-number">1.1.3.1.4.</span> <span class="nav-text">4.UnitTest</span></a></li></ol></li></ol></li></ol></li></ol></li></ol></div>
</div>
<!--/noindex-->
<div class="site-overview-wrap sidebar-panel">
<div class="site-author motion-element" itemprop="author" itemscope itemtype="http://schema.org/Person">
<p class="site-author-name" itemprop="name">Hu Yu</p>
<div class="site-description" itemprop="description"></div>
</div>
<div class="site-state-wrap motion-element">
<nav class="site-state">
<div class="site-state-item site-state-posts">
<a href="/archives/">
<span class="site-state-item-count">1</span>
<span class="site-state-item-name">posts</span>
</a>
</div>
</nav>
</div>
</div>
</div>
</aside>
<div id="sidebar-dimmer"></div>
</div>
</main>
<footer id="footer" class="footer">
<div class="footer-inner">
<div class="copyright">&copy; <span itemprop="copyrightYear">2019</span>
<span class="with-love" id="animate">
<i class="fa fa-user"></i>
</span>
<span class="author" itemprop="copyrightHolder">Hu Yu</span>
</div>
<div class="powered-by">Powered by <a href="https://hexo.io/" class="theme-link" rel="noopener" target="_blank">Hexo</a> v3.9.0</div>
<span class="post-meta-divider">|</span>
<div class="theme-info">Theme <a href="https://theme-next.org/" class="theme-link" rel="noopener" target="_blank">NexT.Muse</a> v7.4.1</div>
</div>
</footer>
</div>
<script src="/lib/anime.min.js?v=3.1.0"></script>
<script src="/lib/velocity/velocity.min.js?v=1.2.1"></script>
<script src="/lib/velocity/velocity.ui.min.js?v=1.2.1"></script>
<script src="/js/utils.js?v=7.4.1"></script><script src="/js/motion.js?v=7.4.1"></script>
<script src="/js/schemes/muse.js?v=7.4.1"></script>
<script src="/js/next-boot.js?v=7.4.1"></script>
</body>
</html>