pam-diff:测量pam图像像素阵列之间的像素差异。 Pam是类似于ppm,pbm和pgm的图像类型。 它具有一个小的标头,

  • I6_532608
    了解作者
  • 7MB
    文件大小
  • zip
    文件格式
  • 0
    收藏次数
  • VIP专享
    资源类型
  • 0
    下载次数
  • 2022-06-14 08:14
    上传日期
潘迪夫 测量从pam图像提取的像素阵列之间的差异。 与节点模块可以从ffmpeg管道中提取出pam图像。 支持的tupltypes是rgb , rgb_alpha和grayscale 。 当前,它正在用于视频运动检测项目。 安装: npm install pam-diff@latest --save 重要说明:仅js版本将不再接收任何更新。 将来所有的工作都将致力于n-api版本,因为它的效率要高得多。 新功能:异步在0.13.6中成为默认设置。 从版本0.13.0开始,可以通过将{async: true}传递给pam-diff构造函数来启用使用工作线程的选项。 新功能:从版本0.13.2开始,可以通过将{response: "bounds"}传递给pam-diff构造函数来设置获取xy边界框坐标的选项。 新功能:从版本0.13.5开始,可以通过将{draw: true}传递给pam
pam-diff-master.zip
内容介绍
# pam-diff ###### [![Dependencies Status](https://david-dm.org/kevinGodell/pam-diff/master/status.svg)](https://david-dm.org/kevinGodell/pam-diff/master) [![Build Status](https://github.com/kevinGodell/pam-diff/workflows/build/badge.svg)](https://github.com/kevinGodell/pam-diff/actions?query=workflow%3Abuild) [![Build Status](https://travis-ci.org/kevinGodell/pam-diff.svg?branch=master)](https://travis-ci.org/kevinGodell/pam-diff) [![Build Status](https://ci.appveyor.com/api/projects/status/hu6qw285sm6vfwtd/branch/master?svg=true)](https://ci.appveyor.com/project/kevinGodell/pam-diff/branch/master) [![GitHub Issues](https://img.shields.io/github/issues/kevinGodell/pam-diff.svg)](https://github.com/kevinGodell/pam-diff/issues) [![GitHub License](https://img.shields.io/badge/license-MIT-blue.svg)](https://raw.githubusercontent.com/kevinGodell/pam-diff/master/LICENSE) [![npm](https://img.shields.io/npm/dt/pam-diff.svg?style=flat-square)](https://www.npmjs.com/package/pam-diff) Measure differences between pixel arrays extracted from pam images. Works well with node module [pipe2pam](https://www.npmjs.com/package/pipe2pam) to extract pam images from an ffmpeg pipe. Supported **_tupltypes_** are **_rgb_**, **_rgb_alpha_**, and **_grayscale_**. It is currently being used for a video motion detection project. ### Installation: ``` npm install pam-diff@latest --save ``` #### _Important Note:_ The js-only version will no longer receive any updates. All future work will be dedicated to the n-api version because it is much more efficient. #### _New Feature:_ Async made default in 0.13.6. ~~Starting with version 0.13.0, the option to use worker threads can be enabled by passing `{async: true}` to the pam-diff constructor.~~ #### _New Feature:_ Starting with version 0.13.2, the option to get x y bounding box coordinates can be set by passing `{response: "bounds"}` to the pam-diff constructor. #### _New Feature:_ Starting with version 0.13.5, the option to get the pixel buffer containing the drawn x y bounding box can be set by passing `{draw: true}` to the pam-diff constructor. #### _New Feature:_ Starting with version 0.13.6, the option to filter results by connected component labelling can be set by passing `{response: "blobs"}` to the pam-diff constructor. #### _New Feature:_ Starting with version 0.13.6, async behavior will now be default. If you need the pixel difference measurements to block the event loop, use `{sync: true}`. #### _New Feature:_ Starting with version 1.0.0, pre-built binaries will be used. If binaries are not available, installation will fall back to node-gyp. ## Usage Options: ###### When comparing 2 equally sized buffers of grayscale, rgb, or rgba pixels, there are several options: ### all (default) - All pixels will be targeted when checking for differences. - To use this option, set the configuration object without creating any regions. ```javascript const pamDiff = new PamDiff({ difference: 5, percent: 5 }); ``` ### regions - Specific regions of pixels will be targeted when checking for differences and the rest will be ignored. - To use this option, create a regions array and pass it to the constructor. ```javascript const region1 = { name: 'region1', difference: 12, percent: 22, polygon: [ { x: 0, y: 0 }, { x: 0, y: 225 }, { x: 100, y: 225 }, { x: 100, y: 0 }, ], }; const region2 = { name: 'region2', difference: 14, percent: 10, polygon: [ { x: 100, y: 0 }, { x: 100, y: 225 }, { x: 200, y: 225 }, { x: 200, y: 0 }, ], }; const regions = [region1, region2]; const pamDiff = new PamDiff({ regions: regions }); ``` ### mask - Specific regions of pixels will be ignored when checking for differences. - To use this option, create a regions array and set the mask option to true. - `difference` and `percent` of the individual region is ignored. Set a global value. ```javascript const region1 = { name: 'region1', polygon: [ { x: 0, y: 0 }, { x: 0, y: 225 }, { x: 100, y: 225 }, { x: 100, y: 0 }, ], }; const region2 = { name: 'region2', polygon: [ { x: 100, y: 0 }, { x: 100, y: 225 }, { x: 200, y: 225 }, { x: 200, y: 0 }, ], }; const regions = [region1, region2]; const pamDiff = new PamDiff({ difference: 12, percent: 10, mask: true, regions: regions }); ``` ##### Getting results back from the pixel difference detection: 1. event - A _diff_ event will be emitted with a data object passed as the only argument. ```javascript pamDiff.on('diff', data => { console.log(data); }); ``` 2. callback - A _callback_ function will be called with a data object passed as the only argument. - The callback can be passed as the 2nd argument to the constructor or it can be added later. ```javascript /* callback function */ function myCallback(data) { console.log(data); } /* via the constructor */ const pamDiff = new pamDiff({ difference: 10, percent: 20 }, myCallback); /* via the setter */ pamDiff.callback = myCallback; /* via the chain-able setter */ pamDiff.setCallback(myCallback).setDifference(10).setPercent(20); /* remove the callback */ pamDiff.callback = null; ``` ##### Expected results: 1. When targeting all pixels: ``` { trigger: [ { name: 'all', percent: 13 } ], pam: <Buffer>, headers: <Buffer>, pixels: <Buffer> } ``` 2. When targeting regions of pixels: ``` { trigger: [ { name: 'region1', percent: 13 }, { name: 'region2', percent: 22 } ], pam: <Buffer>, headers: <Buffer>, pixels: <Buffer> } ``` 3. When targeting all pixels ignored by mask: ``` { trigger: [ { name: 'mask', percent: 13 } ], pam: <Buffer>, headers: <Buffer>, pixels: <Buffer> } ``` 4. When targeting all pixels and setting {response: "bounds"}: ``` { trigger: [ { name: 'all', percent: 13, minX: 42, maxX: 399, minY: 113, maxY: 198 } ], pam: <Buffer>, headers: <Buffer>, pixels: <Buffer> } ``` 5. When targeting all pixels and setting {response: "blobs"}: ``` { trigger: [ { name: "all", percent: 9, minX: 137, maxX: 1782, minY: 392, maxY: 695, blobs: [ { label: 0, percent: 3, minX: 1192, maxX: 1486, minY: 392, maxY: 695 }, { label: 1, percent: 3, minX: 1488, maxX: 1782, minY: 392, maxY: 695 } ] } ], pam: <Buffer>, headers: <Buffer>, pixels: <Buffer> } ``` ### Other Resources: View the [docs](https://kevingodell.github.io/pam-diff/PamDiff.html), [tests](https://github.com/kevinGodell/pam-diff/tree/master/tests), or [examples](https://github.com/kevinGodell/pam-diff/tree/master/examples) for more implementations. ### Future Plans: - [x] Make pre-built binaries available when using node-gyp is not an option. - [x] Include option to return coordinates for bounding box of changed pixels. - [x] Include option to return pixel buffer containing bounding boxes. - [x] Introduce blob filtering to group changed pixels with their neighbors. - [x] Include option to return pixel buffer containing bounding boxes around blobs. - [x] Make async worker threads the default. Can be overridden with {sync: true}.
评论
    相关推荐
    • npm
      npm install 编译和热重装以进行开发 npm run serve 编译并最小化生产 npm run build 运行测试 npm run test 整理和修复文件 npm run lint 运行单元测试 npm run test:unit 自定义配置 请参阅。
    • npm-max:NPM软件包
      最大NPM 该函数返回最大值 npm install
    • npm-exercises
      npm-exercises
    • npmTest:测试npm
      npmTest 测试npm
    • npm-lifecycle:npm生命周期脚本运行器
      npm v7发布后,将不建议使用此模块。 请不要绝对依赖它。 npm v7中使用的生命周期脚本运行程序是 。 请继续使用该模块。 npm-lifecycle 是一个独立的库,用于执行软件包的生命周期脚本。 它是从npm本身提取的,...
    • TSProjectDemo:npm ts
      TSProjectDemo:npm ts
    • npmd-install
      npmd 安装 从 npmd-resolve 树安装节点模块。 npm install - g npmd - resolve npmd - install npmd - resolve browserify | npmd - install 另外, 一个关键部分 执照 麻省理工学院
    • npm-cli-login
      npm-cli-login 允许您不使用STDIN,STDOUT登录到NPM。 在CI构建系统等地方使用。 还可以在〜/ .npmrc文件中创建/修改条目以进行身份​​验证。 安装 npm install -g npm-cli-login 使用-g标志通过CLI使用npm-cli-...
    • npm-practice
      npm-practice
    • npm:测试
      npm 测试