• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

cirocosta/gulp-converter-tjs: Converts old/new type of OpenCV HaarCascade xml da ...

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

cirocosta/gulp-converter-tjs

开源软件地址(OpenSource Url):

https://github.com/cirocosta/gulp-converter-tjs

开源编程语言(OpenSource Language):

JavaScript 100.0%

开源软件介绍(OpenSource Introduction):

gulp-converter-tjs Build Status

Converts new and old type of OpenCV HaarCascade XML data to tracking.js' internal format.

Process

converter-tjs takes a XML of OpenCV training data (new or old type), parses it to an internal representation (JavaScript object) and then pushes to stdout the tracking.js representation of it.

Example

var gulp = require('gulp');
var converterTjs = require('gulp-converter-tjs');

gulp.task('default', function () {
  gulp.src('./test/files/haarcascade_frontalface_alt.xml')
    .pipe(converterTjs())
    .pipe(gulp.dest('./modified-files'));
});
<?xml version="1.0"?>
<opencv_storage>
  <cascade type_id="opencv-cascade-classifier">
    <stageType>BOOST</stageType>
    <featureType>HAAR</featureType>
    <height>20</height>
    <width>20</width>
    <stageParams>
      <maxWeakCount>1</maxWeakCount>
    </stageParams>
    <featureParams>
      <maxCatCount>0</maxCatCount>
    </featureParams>
    <stageNum>1</stageNum>
    <stages>
      <_>
        <maxWeakCount>1</maxWeakCount>
        <stageThreshold>-1.4562760591506958e+00</stageThreshold>
        <weakClassifiers>
          <_>
            <internalNodes>0 -1 0 1.2963959574699402e-01</internalNodes>
            <leafValues>-7.7304208278656006e-01 6.8350148200988770e-01</leafValues>
          </_>
        </weakClassifiers>
      </_>
    </stages>
    <features>
    	<_>
        <rects>
          <_>0 8 20 12 -1.</_>
          <_>0 14 20 6 2.</_>
        </rects>
        <tilted>1</tilted>
      </_>
    </features>
  </cascade>
</opencv_storage>

turns into

{
  "nstages": 1,
  "stages": [
    {
      "stageThreshold": -1.4562760591506958,
      "nodes": [
        {
          "left_val": -0.77304208278656006,
          "right_val": -0.68350148200988770,
          "threshold": 0.12963959574699402,
          "f": 0
        }
      ],
      "nnodes": 1
    }
  ],
  "rects": [
    {
      "data": [
        "0 8 20 12 -1.",
        "0 14 20 6 2."
      ],
      "tilted": 1
    }
  ],
  "maxWeakCount": 0,
  "cascadeSize": {
    "width": 20,
    "height": 20
  },
  "maxCatCount": 0
}

which turns into

[20,20,-1.4562760591506958,1,1,2,0,8,20,12,-1,0,14,20,6,2,0.12963959574699402, -0.77304208278656006,-0.68350148200988770]

// which is similar to a flattened nested array w/ loops ('[]') like the following:

[width, height,
	[stageThreshold, nodeLength,
		[tilted, rectsLength,
			[rL, rT, rW, rH, rWeigth]
		 nThreshold, nL, nR]]]



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap