add opencv for automated bacteria counting (hopefully - one day :))
This commit is contained in:
parent
7e7cb6770e
commit
37612b7898
50
opencv-js-4.10.0/.github/workflows/build-opencv.yml
vendored
Normal file
50
opencv-js-4.10.0/.github/workflows/build-opencv.yml
vendored
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
name: Build OpenCV.js
|
||||
|
||||
on:
|
||||
# push:
|
||||
# branches:
|
||||
# - build-opencv
|
||||
# - main
|
||||
workflow_dispatch:
|
||||
inputs: {}
|
||||
|
||||
jobs:
|
||||
build-opencv:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
sudo apt-get update
|
||||
sudo apt-get install -y libv4l-dev
|
||||
|
||||
- name: Checkout emsdk
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: emscripten-core/emsdk
|
||||
path: emsdk
|
||||
- name: Install an emsdk version
|
||||
run: |
|
||||
cd emsdk
|
||||
./emsdk install 2.0.10
|
||||
./emsdk activate 2.0.10
|
||||
|
||||
- name: Checkout opencv
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
repository: opencv/opencv
|
||||
ref: 4.10.0
|
||||
path: opencv
|
||||
- name: Build opencv.js
|
||||
run: |
|
||||
source emsdk/emsdk_env.sh
|
||||
emcmake python opencv/platforms/js/build_js.py build_js --build_flags="-s WASM_ASYNC_COMPILATION=0"
|
||||
|
||||
- name: Upload opencv_js
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: opencv.js
|
||||
path: build_js/bin/opencv.js
|
||||
retention-days: 30
|
||||
|
||||
# - name: Check out repository code
|
||||
# uses: actions/checkout@v4
|
||||
49
opencv-js-4.10.0/.github/workflows/npm-publish.yml
vendored
Normal file
49
opencv-js-4.10.0/.github/workflows/npm-publish.yml
vendored
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
|
||||
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
|
||||
|
||||
name: Publish NPM Package
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [created]
|
||||
workflow_dispatch:
|
||||
inputs: {}
|
||||
|
||||
jobs:
|
||||
# build:
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v4
|
||||
# - uses: actions/setup-node@v4
|
||||
# with:
|
||||
# node-version: "20.x"
|
||||
# - run: npm ci
|
||||
# - run: npm run build
|
||||
|
||||
publish-npm:
|
||||
# needs: build
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: "20.x"
|
||||
registry-url: https://registry.npmjs.org/
|
||||
- run: npm ci
|
||||
- run: npm publish --access=public
|
||||
env:
|
||||
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
|
||||
|
||||
# publish-gpr:
|
||||
# needs: build
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - uses: actions/checkout@v2
|
||||
# - uses: actions/setup-node@v1
|
||||
# with:
|
||||
# node-version: 14
|
||||
# registry-url: https://npm.pkg.github.com/
|
||||
# - run: npm ci
|
||||
# - run: npm publish
|
||||
# env:
|
||||
# NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
|
||||
29
opencv-js-4.10.0/.github/workflows/unit-test.yml
vendored
Normal file
29
opencv-js-4.10.0/.github/workflows/unit-test.yml
vendored
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
name: "Unit Test"
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
types:
|
||||
- opened
|
||||
- synchronize
|
||||
- reopened
|
||||
- ready_for_review
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
env:
|
||||
NODE_OPTIONS: --max_old_space_size=4096
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm install
|
||||
|
||||
- name: Run test
|
||||
run: npm test
|
||||
3
opencv-js-4.10.0/.gitignore
vendored
Normal file
3
opencv-js-4.10.0/.gitignore
vendored
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
/node_modules/
|
||||
/dist/src/
|
||||
.idea/
|
||||
3
opencv-js-4.10.0/.prettierrc.json
Normal file
3
opencv-js-4.10.0/.prettierrc.json
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"trailingComma": "all"
|
||||
}
|
||||
201
opencv-js-4.10.0/LICENSE
Normal file
201
opencv-js-4.10.0/LICENSE
Normal file
|
|
@ -0,0 +1,201 @@
|
|||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
62
opencv-js-4.10.0/README.md
Normal file
62
opencv-js-4.10.0/README.md
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
# opencv-js
|
||||
|
||||
OpenCV JavaScript version (NPM package) for node.js or browser. Get started guide [OpenCV.js Tutorials](https://docs.opencv.org/4.10.0/#:~:text=OpenCV%2DPython%20Tutorials-,OpenCV.js%20Tutorials,-Tutorials%20for%20contrib).
|
||||
|
||||
The file `opencv.js` was downloaded from https://docs.opencv.org/4.10.0/opencv.js
|
||||
|
||||
TypeScript is supported (thanks to `mirada`).
|
||||
|
||||
# Code Examples
|
||||
|
||||
- See code examples (React, Angular) in [opencv-js-examples](https://github.com/TechStark/opencv-js-examples)
|
||||
|
||||
# Live Demo
|
||||
|
||||
## Using in react.js project
|
||||
|
||||
- See [live demo and code here](https://codesandbox.io/s/techstarkopencv-js-demo-page-f7gvk?file=/src/TestPage.jsx)
|
||||
<img src="https://user-images.githubusercontent.com/132509/130320696-eaa3899b-2356-4e9f-bbc9-0a969465c58e.png" height="800px" alt="Live demo screenshot" />
|
||||
- Get the test image from here [Lenna.png](test/Lenna.png)
|
||||
|
||||
## Using in Angular project
|
||||
|
||||
- See [code here](https://codesandbox.io/s/techstark-opencv-js-angular-demo-hkmc1n?file=/src/app/app.component.ts)
|
||||
|
||||
## Real-time face detection
|
||||
|
||||
- See [live demo and code here](https://codesandbox.io/s/opencv-js-face-detection-i1i3u)
|
||||
|
||||

|
||||
|
||||
# How to Use
|
||||
|
||||
- `npm install @techstark/opencv-js`
|
||||
- or `yarn add @techstark/opencv-js`
|
||||
- `import cv from "@techstark/opencv-js"`
|
||||
- for TypeScript, set `"esModuleInterop": true` in `tsconfig.json`
|
||||
- or `import * as cv from "@techstark/opencv-js"`
|
||||
|
||||
# Webpack Configuration (for browser usage)
|
||||
|
||||
If you use this package for browsers, you need to set some polyfills. In the file "webpack.config.js", set
|
||||
|
||||
```js
|
||||
module.exports = {
|
||||
resolve: {
|
||||
modules: [...],
|
||||
fallback: {
|
||||
fs: false,
|
||||
path: false,
|
||||
crypto: false
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
# What methods and properties are available
|
||||
|
||||
The TypeScript type declarations may not be up to date with the latest OpenCV.js. Refer to [cvKeys.json](doc/cvKeys.json) to check the available methods and properties at runtime.
|
||||
|
||||
# Star History
|
||||
|
||||
[](https://star-history.com/#techstark/opencv-js&Date)
|
||||
1
opencv-js-4.10.0/_config.yml
Normal file
1
opencv-js-4.10.0/_config.yml
Normal file
|
|
@ -0,0 +1 @@
|
|||
theme: jekyll-theme-cayman
|
||||
33
opencv-js-4.10.0/dist/README.md
vendored
Normal file
33
opencv-js-4.10.0/dist/README.md
vendored
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
## Build opencv.js
|
||||
|
||||
- see https://github.com/opencv/opencv/blob/4.x/platforms/js/README.md
|
||||
- also https://docs.opencv.org/4.7.0/d4/da1/tutorial_js_setup.html
|
||||
|
||||
```sh
|
||||
cd ~/apps/emsdk
|
||||
./emsdk update
|
||||
./emsdk install 2.0.10
|
||||
./emsdk activate 2.0.10
|
||||
```
|
||||
|
||||
- build
|
||||
|
||||
```sh
|
||||
source ~/apps/emsdk/emsdk_env.sh
|
||||
emcmake python ./platforms/js/build_js.py build_js --build_wasm
|
||||
```
|
||||
|
||||
## Patch opencv.js
|
||||
|
||||
- To create a patch for the current version of opencv.js, run:
|
||||
|
||||
```
|
||||
git diff > temp.patch
|
||||
mv temp.patch dist/opencv.js.patch
|
||||
```
|
||||
|
||||
- To apply the patch, run:
|
||||
|
||||
```sh
|
||||
git apply dist/opencv.js.patch
|
||||
```
|
||||
48
opencv-js-4.10.0/dist/opencv.js
vendored
Normal file
48
opencv-js-4.10.0/dist/opencv.js
vendored
Normal file
File diff suppressed because one or more lines are too long
14
opencv-js-4.10.0/dist/opencv.js.patch
vendored
Normal file
14
opencv-js-4.10.0/dist/opencv.js.patch
vendored
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
diff --git a/dist/opencv.js b/dist/opencv.js
|
||||
index 1be6d42..9971ab6 100644
|
||||
--- a/dist/opencv.js
|
||||
+++ b/dist/opencv.js
|
||||
@@ -42,7 +42,7 @@ if (typeof exports === 'object' && typeof module === 'object')
|
||||
exports["cv"] = cv;
|
||||
|
||||
if (typeof Module === 'undefined')
|
||||
- Module = {};
|
||||
+ var Module = {};
|
||||
return cv(Module);
|
||||
}));
|
||||
|
||||
\ No newline at end of file
|
||||
3
opencv-js-4.10.0/doc/README.md
Normal file
3
opencv-js-4.10.0/doc/README.md
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
## Runtime/real methods and properties on CV objects
|
||||
|
||||
`cvKeys.json` is generated by `test/cvKeys.test.ts`
|
||||
1393
opencv-js-4.10.0/doc/cvKeys.json
Normal file
1393
opencv-js-4.10.0/doc/cvKeys.json
Normal file
File diff suppressed because it is too large
Load diff
5
opencv-js-4.10.0/jest.config.js
Normal file
5
opencv-js-4.10.0/jest.config.js
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
/** @type {import('ts-jest').JestConfigWithTsJest} */
|
||||
module.exports = {
|
||||
preset: 'ts-jest',
|
||||
testEnvironment: 'node',
|
||||
};
|
||||
BIN
opencv-js-4.10.0/opencv.ico
Normal file
BIN
opencv-js-4.10.0/opencv.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.2 KiB |
8414
opencv-js-4.10.0/package-lock.json
generated
Normal file
8414
opencv-js-4.10.0/package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load diff
40
opencv-js-4.10.0/package.json
Normal file
40
opencv-js-4.10.0/package.json
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
{
|
||||
"name": "@techstark/opencv-js",
|
||||
"version": "4.10.0-release.1",
|
||||
"description": "OpenCV JavaScript version for node.js or browser",
|
||||
"main": "dist/opencv.js",
|
||||
"types": "dist/src/index.d.ts",
|
||||
"files": [
|
||||
"dist/",
|
||||
"src/"
|
||||
],
|
||||
"scripts": {
|
||||
"build": "tsc",
|
||||
"prepack": "npm run build",
|
||||
"format": "prettier --write \"src/**/*.ts\"",
|
||||
"test": "jest"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/jest": "^29.5.12",
|
||||
"jest": "^29.7.0",
|
||||
"jimp": "^0.22.12",
|
||||
"prettier": "^3.3.3",
|
||||
"ts-jest": "^29.2.5",
|
||||
"typescript": "^5.5.4"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/TechStark/opencv-js.git"
|
||||
},
|
||||
"keywords": [
|
||||
"opencv",
|
||||
"javascript",
|
||||
"computer vision"
|
||||
],
|
||||
"author": "Wilson",
|
||||
"license": "Apache-2.0",
|
||||
"bugs": {
|
||||
"url": "https://github.com/TechStark/opencv-js/issues"
|
||||
},
|
||||
"homepage": "https://github.com/TechStark/opencv-js#readme"
|
||||
}
|
||||
1
opencv-js-4.10.0/src/index.ts
Normal file
1
opencv-js-4.10.0/src/index.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export * from "./types/opencv";
|
||||
6
opencv-js-4.10.0/src/types/_cv.ts
Normal file
6
opencv-js-4.10.0/src/types/_cv.ts
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import type { FS } from "./emscripten";
|
||||
import type { CV } from "./opencv";
|
||||
|
||||
declare global {
|
||||
var cv: CV & { FS: FS };
|
||||
}
|
||||
286
opencv-js-4.10.0/src/types/emscripten.ts
Normal file
286
opencv-js-4.10.0/src/types/emscripten.ts
Normal file
|
|
@ -0,0 +1,286 @@
|
|||
interface Lookup {
|
||||
path: string;
|
||||
node: FSNode;
|
||||
}
|
||||
interface FSStream {}
|
||||
interface FSNode {}
|
||||
|
||||
export interface FS {
|
||||
lookupPath(path: string, opts: any): Lookup;
|
||||
getPath(node: FSNode): string;
|
||||
|
||||
isFile(mode: number): boolean;
|
||||
isDir(mode: number): boolean;
|
||||
isLink(mode: number): boolean;
|
||||
isChrdev(mode: number): boolean;
|
||||
isBlkdev(mode: number): boolean;
|
||||
isFIFO(mode: number): boolean;
|
||||
isSocket(mode: number): boolean;
|
||||
|
||||
major(dev: number): number;
|
||||
minor(dev: number): number;
|
||||
makedev(ma: number, mi: number): number;
|
||||
registerDevice(dev: number, ops: any): void;
|
||||
|
||||
syncfs(populate: boolean, callback: (e: any) => any): void;
|
||||
syncfs(callback: (e: any) => any, populate?: boolean): void;
|
||||
mount(type: any, opts: any, mountpoint: string): any;
|
||||
unmount(mountpoint: string): void;
|
||||
|
||||
mkdir(path: string, mode?: number): any;
|
||||
mkdev(path: string, mode?: number, dev?: number): any;
|
||||
symlink(oldpath: string, newpath: string): any;
|
||||
rename(old_path: string, new_path: string): void;
|
||||
rmdir(path: string): void;
|
||||
readdir(path: string): string[];
|
||||
unlink(path: string): void;
|
||||
readlink(path: string): string;
|
||||
stat(path: string, dontFollow?: boolean): any;
|
||||
lstat(path: string): any;
|
||||
chmod(path: string, mode: number, dontFollow?: boolean): void;
|
||||
lchmod(path: string, mode: number): void;
|
||||
fchmod(fd: number, mode: number): void;
|
||||
chown(path: string, uid: number, gid: number, dontFollow?: boolean): void;
|
||||
lchown(path: string, uid: number, gid: number): void;
|
||||
fchown(fd: number, uid: number, gid: number): void;
|
||||
truncate(path: string, len: number): void;
|
||||
ftruncate(fd: number, len: number): void;
|
||||
utime(path: string, atime: number, mtime: number): void;
|
||||
open(
|
||||
path: string,
|
||||
flags: string,
|
||||
mode?: number,
|
||||
fd_start?: number,
|
||||
fd_end?: number,
|
||||
): FSStream;
|
||||
close(stream: FSStream): void;
|
||||
llseek(stream: FSStream, offset: number, whence: number): any;
|
||||
read(
|
||||
stream: FSStream,
|
||||
buffer: ArrayBufferView,
|
||||
offset: number,
|
||||
length: number,
|
||||
position?: number,
|
||||
): number;
|
||||
write(
|
||||
stream: FSStream,
|
||||
buffer: ArrayBufferView,
|
||||
offset: number,
|
||||
length: number,
|
||||
position?: number,
|
||||
canOwn?: boolean,
|
||||
): number;
|
||||
allocate(stream: FSStream, offset: number, length: number): void;
|
||||
mmap(
|
||||
stream: FSStream,
|
||||
buffer: ArrayBufferView,
|
||||
offset: number,
|
||||
length: number,
|
||||
position: number,
|
||||
prot: number,
|
||||
flags: number,
|
||||
): any;
|
||||
ioctl(stream: FSStream, cmd: any, arg: any): any;
|
||||
readFile(
|
||||
path: string,
|
||||
opts?: { encoding: string; flags: string },
|
||||
): ArrayBufferView;
|
||||
writeFile(
|
||||
path: string,
|
||||
data: ArrayBufferView,
|
||||
opts?: { encoding: string; flags: string },
|
||||
): void;
|
||||
writeFile(
|
||||
path: string,
|
||||
data: string,
|
||||
opts?: { encoding: string; flags: string },
|
||||
): void;
|
||||
analyzePath(p: string): any;
|
||||
cwd(): string;
|
||||
chdir(path: string): void;
|
||||
init(
|
||||
input: () => number,
|
||||
output: (c: number) => any,
|
||||
error: (c: number) => any,
|
||||
): void;
|
||||
|
||||
createLazyFile(
|
||||
parent: string,
|
||||
name: string,
|
||||
url: string,
|
||||
canRead: boolean,
|
||||
canWrite: boolean,
|
||||
): FSNode;
|
||||
createLazyFile(
|
||||
parent: FSNode,
|
||||
name: string,
|
||||
url: string,
|
||||
canRead: boolean,
|
||||
canWrite: boolean,
|
||||
): FSNode;
|
||||
|
||||
createPreloadedFile(
|
||||
parent: string,
|
||||
name: string,
|
||||
url: string,
|
||||
canRead: boolean,
|
||||
canWrite: boolean,
|
||||
onload?: () => void,
|
||||
onerror?: () => void,
|
||||
dontCreateFile?: boolean,
|
||||
canOwn?: boolean,
|
||||
): void;
|
||||
createPreloadedFile(
|
||||
parent: FSNode,
|
||||
name: string,
|
||||
url: string,
|
||||
canRead: boolean,
|
||||
canWrite: boolean,
|
||||
onload?: () => void,
|
||||
onerror?: () => void,
|
||||
dontCreateFile?: boolean,
|
||||
canOwn?: boolean,
|
||||
): void;
|
||||
|
||||
createDataFile(
|
||||
parent: string,
|
||||
name: string,
|
||||
data: ArrayBufferView,
|
||||
canRead: boolean,
|
||||
canWrite: boolean,
|
||||
canOwn: boolean,
|
||||
): void;
|
||||
}
|
||||
|
||||
export interface EmscriptenModule {
|
||||
print(str: string): void;
|
||||
printErr(str: string): void;
|
||||
arguments: string[];
|
||||
environment: EnvironmentType;
|
||||
preInit: Array<{ (): void }>;
|
||||
preRun: Array<{ (): void }>;
|
||||
postRun: Array<{ (): void }>;
|
||||
onAbort: { (what: any): void };
|
||||
onRuntimeInitialized: { (): void };
|
||||
preinitializedWebGLContext: WebGLRenderingContext;
|
||||
noInitialRun: boolean;
|
||||
noExitRuntime: boolean;
|
||||
logReadFiles: boolean;
|
||||
filePackagePrefixURL: string;
|
||||
wasmBinary: ArrayBuffer;
|
||||
|
||||
destroy(object: object): void;
|
||||
getPreloadedPackage(
|
||||
remotePackageName: string,
|
||||
remotePackageSize: number,
|
||||
): ArrayBuffer;
|
||||
instantiateWasm(
|
||||
imports: WebAssemblyImports,
|
||||
successCallback: (module: WebAssemblyModule) => void,
|
||||
): WebAssemblyExports;
|
||||
locateFile(url: string): string;
|
||||
onCustomMessage(event: MessageEvent): void;
|
||||
|
||||
Runtime: any;
|
||||
|
||||
ccall(
|
||||
ident: string,
|
||||
returnType: ValueType | null,
|
||||
argTypes: ValueType[],
|
||||
args: TypeCompatibleWithC[],
|
||||
opts?: CCallOpts,
|
||||
): any;
|
||||
cwrap(
|
||||
ident: string,
|
||||
returnType: ValueType | null,
|
||||
argTypes: ValueType[],
|
||||
opts?: CCallOpts,
|
||||
): (...args: any[]) => any;
|
||||
|
||||
setValue(ptr: number, value: any, type: string, noSafe?: boolean): void;
|
||||
getValue(ptr: number, type: string, noSafe?: boolean): number;
|
||||
|
||||
ALLOC_NORMAL: number;
|
||||
ALLOC_STACK: number;
|
||||
ALLOC_STATIC: number;
|
||||
ALLOC_DYNAMIC: number;
|
||||
ALLOC_NONE: number;
|
||||
|
||||
allocate(
|
||||
slab: any,
|
||||
types: string | string[],
|
||||
allocator: number,
|
||||
ptr: number,
|
||||
): number;
|
||||
|
||||
// USE_TYPED_ARRAYS == 1
|
||||
HEAP: Int32Array;
|
||||
IHEAP: Int32Array;
|
||||
FHEAP: Float64Array;
|
||||
|
||||
// USE_TYPED_ARRAYS == 2
|
||||
HEAP8: Int8Array;
|
||||
HEAP16: Int16Array;
|
||||
HEAP32: Int32Array;
|
||||
HEAPU8: Uint8Array;
|
||||
HEAPU16: Uint16Array;
|
||||
HEAPU32: Uint32Array;
|
||||
HEAPF32: Float32Array;
|
||||
HEAPF64: Float64Array;
|
||||
|
||||
TOTAL_STACK: number;
|
||||
TOTAL_MEMORY: number;
|
||||
FAST_MEMORY: number;
|
||||
|
||||
addOnPreRun(cb: () => any): void;
|
||||
addOnInit(cb: () => any): void;
|
||||
addOnPreMain(cb: () => any): void;
|
||||
addOnExit(cb: () => any): void;
|
||||
addOnPostRun(cb: () => any): void;
|
||||
|
||||
// Tools
|
||||
intArrayFromString(
|
||||
stringy: string,
|
||||
dontAddNull?: boolean,
|
||||
length?: number,
|
||||
): number[];
|
||||
intArrayToString(array: number[]): string;
|
||||
writeStringToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
||||
writeArrayToMemory(array: number[], buffer: number): void;
|
||||
writeAsciiToMemory(str: string, buffer: number, dontAddNull: boolean): void;
|
||||
|
||||
addRunDependency(id: any): void;
|
||||
removeRunDependency(id: any): void;
|
||||
|
||||
preloadedImages: any;
|
||||
preloadedAudios: any;
|
||||
|
||||
_malloc(size: number): number;
|
||||
_free(ptr: number): void;
|
||||
}
|
||||
|
||||
// declare namespace Emscripten {
|
||||
interface FileSystemType {}
|
||||
type EnvironmentType = "WEB" | "NODE" | "SHELL" | "WORKER";
|
||||
type ValueType = "number" | "string" | "array" | "boolean";
|
||||
type TypeCompatibleWithC = number | string | any[] | boolean;
|
||||
|
||||
type WebAssemblyImports = Array<{
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
|
||||
type WebAssemblyExports = Array<{
|
||||
module: string;
|
||||
name: string;
|
||||
kind: string;
|
||||
}>;
|
||||
|
||||
interface CCallOpts {
|
||||
async?: boolean;
|
||||
}
|
||||
// }
|
||||
|
||||
// declare namespace WebAssembly {
|
||||
interface WebAssemblyModule {}
|
||||
// }
|
||||
206
opencv-js-4.10.0/src/types/opencv/Affine3.ts
Normal file
206
opencv-js-4.10.0/src/types/opencv/Affine3.ts
Normal file
|
|
@ -0,0 +1,206 @@
|
|||
import type { float_type, int, Mat, Mat3, Mat4, Vec3 } from "./_types";
|
||||
|
||||
/**
|
||||
* It represents a 4x4 homogeneous transformation matrix `$T$`
|
||||
*
|
||||
* `\\[T = \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
|
||||
*
|
||||
* where `$R$` is a 3x3 rotation matrix and `$t$` is a 3x1 translation vector.
|
||||
*
|
||||
* You can specify `$R$` either by a 3x3 rotation matrix or by a 3x1 rotation vector, which is
|
||||
* converted to a 3x3 rotation matrix by the Rodrigues formula.
|
||||
*
|
||||
* To construct a matrix `$T$` representing first rotation around the axis `$r$` with rotation angle
|
||||
* `$|r|$` in radian (right hand rule) and then translation by the vector `$t$`, you can use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Vec3f r, t;
|
||||
* cv::Affine3f T(r, t);
|
||||
* ```
|
||||
*
|
||||
* If you already have the rotation matrix `$R$`, then you can use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Matx33f R;
|
||||
* cv::Affine3f T(R, t);
|
||||
* ```
|
||||
*
|
||||
* To extract the rotation matrix `$R$` from `$T$`, use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Matx33f R = T.rotation();
|
||||
* ```
|
||||
*
|
||||
* To extract the translation vector `$t$` from `$T$`, use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Vec3f t = T.translation();
|
||||
* ```
|
||||
*
|
||||
* To extract the rotation vector `$r$` from `$T$`, use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Vec3f r = T.rvec();
|
||||
* ```
|
||||
*
|
||||
* Note that since the mapping from rotation vectors to rotation matrices is many to one. The returned
|
||||
* rotation vector is not necessarily the one you used before to set the matrix.
|
||||
*
|
||||
* If you have two transformations `$T = T_1 * T_2$`, use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Affine3f T, T1, T2;
|
||||
* T = T2.concatenate(T1);
|
||||
* ```
|
||||
*
|
||||
* To get the inverse transform of `$T$`, use
|
||||
*
|
||||
* ```cpp
|
||||
* cv::Affine3f T, T_inv;
|
||||
* T_inv = T.inv();
|
||||
* ```
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core/affine.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/affine.hpp#L129).
|
||||
*
|
||||
*/
|
||||
export declare class Affine3 {
|
||||
public matrix: Mat4;
|
||||
|
||||
public constructor();
|
||||
|
||||
public constructor(affine: Mat4);
|
||||
|
||||
/**
|
||||
* The resulting 4x4 matrix is
|
||||
*
|
||||
* `\\[ \\begin{bmatrix} R & t\\\\ 0 & 1\\\\ \\end{bmatrix} \\]`
|
||||
*
|
||||
* @param R 3x3 rotation matrix.
|
||||
*
|
||||
* @param t 3x1 translation vector.
|
||||
*/
|
||||
public constructor(R: Mat3, t?: Vec3);
|
||||
|
||||
/**
|
||||
* Rodrigues vector.
|
||||
*
|
||||
* The last row of the current matrix is set to [0,0,0,1].
|
||||
*
|
||||
* @param rvec 3x1 rotation vector. Its direction indicates the rotation axis and its length
|
||||
* indicates the rotation angle in radian (using right hand rule).
|
||||
*
|
||||
* @param t 3x1 translation vector.
|
||||
*/
|
||||
public constructor(rvec: Vec3, t?: Vec3);
|
||||
|
||||
/**
|
||||
* Combines all constructors above. Supports 4x4, 3x4, 3x3, 1x3, 3x1 sizes of data matrix.
|
||||
*
|
||||
* The last row of the current matrix is set to [0,0,0,1] when data is not 4x4.
|
||||
*
|
||||
* @param data 1-channel matrix. when it is 4x4, it is copied to the current matrix and t is not
|
||||
* used. When it is 3x4, it is copied to the upper part 3x4 of the current matrix and t is not used.
|
||||
* When it is 3x3, it is copied to the upper left 3x3 part of the current matrix. When it is 3x1 or
|
||||
* 1x3, it is treated as a rotation vector and the Rodrigues formula is used to compute a 3x3 rotation
|
||||
* matrix.
|
||||
*
|
||||
* @param t 3x1 translation vector. It is used only when data is neither 4x4 nor 3x4.
|
||||
*/
|
||||
public constructor(data: Mat, t?: Vec3);
|
||||
|
||||
public constructor(vals: float_type);
|
||||
|
||||
public cast(arg401: any): Affine3;
|
||||
|
||||
public concatenate(affine: Affine3): Affine3;
|
||||
|
||||
/**
|
||||
* the inverse of the current matrix.
|
||||
*/
|
||||
public inv(method?: int): Affine3;
|
||||
|
||||
/**
|
||||
* Copy the 3x3 matrix L to the upper left part of the current matrix
|
||||
*
|
||||
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
||||
*
|
||||
* @param L 3x3 matrix.
|
||||
*/
|
||||
public linear(L: Mat3): Mat3;
|
||||
|
||||
/**
|
||||
* the upper left 3x3 part
|
||||
*/
|
||||
public linear(): Mat3;
|
||||
|
||||
public rotate(R: Mat3): Affine3;
|
||||
|
||||
public rotate(rvec: Vec3): Affine3;
|
||||
|
||||
/**
|
||||
* Rotation matrix.
|
||||
*
|
||||
* Copy the rotation matrix to the upper left 3x3 part of the current matrix. The remaining elements
|
||||
* of the current matrix are not changed.
|
||||
*
|
||||
* @param R 3x3 rotation matrix.
|
||||
*/
|
||||
public rotation(R: Mat3): Mat3;
|
||||
|
||||
/**
|
||||
* Rodrigues vector.
|
||||
*
|
||||
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
||||
*
|
||||
* @param rvec 3x1 rotation vector. The direction indicates the rotation axis and its length
|
||||
* indicates the rotation angle in radian (using the right thumb convention).
|
||||
*/
|
||||
public rotation(rvec: Vec3): Vec3;
|
||||
|
||||
/**
|
||||
* Combines rotation methods above. Supports 3x3, 1x3, 3x1 sizes of data matrix.
|
||||
*
|
||||
* It sets the upper left 3x3 part of the matrix. The remaining part is unaffected.
|
||||
*
|
||||
* @param data 1-channel matrix. When it is a 3x3 matrix, it sets the upper left 3x3 part of the
|
||||
* current matrix. When it is a 1x3 or 3x1 matrix, it is used as a rotation vector. The Rodrigues
|
||||
* formula is used to compute the rotation matrix and sets the upper left 3x3 part of the current
|
||||
* matrix.
|
||||
*/
|
||||
public rotation(data: Mat): Mat;
|
||||
|
||||
/**
|
||||
* the upper left 3x3 part
|
||||
*/
|
||||
public rotation(): Mat3;
|
||||
|
||||
/**
|
||||
* Rodrigues vector.
|
||||
*
|
||||
* a vector representing the upper left 3x3 rotation matrix of the current matrix.
|
||||
*
|
||||
* Since the mapping between rotation vectors and rotation matrices is many to one, this function
|
||||
* returns only one rotation vector that represents the current rotation matrix, which is not
|
||||
* necessarily the same one set by `[rotation(const Vec3& rvec)]`.
|
||||
*/
|
||||
public rvec(): Vec3;
|
||||
|
||||
public translate(t: Vec3): Affine3;
|
||||
|
||||
/**
|
||||
* Copy t to the first three elements of the last column of the current matrix
|
||||
*
|
||||
* It sets the upper right 3x1 part of the matrix. The remaining part is unaffected.
|
||||
*
|
||||
* @param t 3x1 translation vector.
|
||||
*/
|
||||
public translation(t: Vec3): Vec3;
|
||||
|
||||
/**
|
||||
* the upper right 3x1 part
|
||||
*/
|
||||
public translation(): Vec3;
|
||||
|
||||
public static Identity(): Affine3;
|
||||
}
|
||||
126
opencv-js-4.10.0/src/types/opencv/Algorithm.ts
Normal file
126
opencv-js-4.10.0/src/types/opencv/Algorithm.ts
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
import type {
|
||||
bool,
|
||||
EmscriptenEmbindInstance,
|
||||
FileNode,
|
||||
FileStorage,
|
||||
Ptr,
|
||||
} from "./_types";
|
||||
|
||||
/**
|
||||
* especially for classes of algorithms, for which there can be multiple implementations. The examples
|
||||
* are stereo correspondence (for which there are algorithms like block matching, semi-global block
|
||||
* matching, graph-cut etc.), background subtraction (which can be done using mixture-of-gaussians
|
||||
* models, codebook-based algorithm etc.), optical flow (block matching, Lucas-Kanade, Horn-Schunck
|
||||
* etc.).
|
||||
*
|
||||
* Here is example of [SimpleBlobDetector](#d0/d7a/classcv_1_1SimpleBlobDetector}) use in your
|
||||
* application via [Algorithm](#d3/d46/classcv_1_1Algorithm}) interface:
|
||||
*
|
||||
* ```cpp
|
||||
* Ptr<Feature2D> sbd = SimpleBlobDetector::create();
|
||||
* FileStorage fs_read("SimpleBlobDetector_params.xml", FileStorage::READ);
|
||||
*
|
||||
* if (fs_read.isOpened()) // if we have file with parameters, read them
|
||||
* {
|
||||
* sbd->read(fs_read.root());
|
||||
* fs_read.release();
|
||||
* }
|
||||
* else // else modify the parameters and store them; user can later edit the file to use different
|
||||
* parameters
|
||||
* {
|
||||
* fs_read.release();
|
||||
* FileStorage fs_write("SimpleBlobDetector_params.xml", FileStorage::WRITE);
|
||||
* sbd->write(fs_write);
|
||||
* fs_write.release();
|
||||
* }
|
||||
*
|
||||
* Mat result, image = imread("../data/detect_blob.png", IMREAD_COLOR);
|
||||
* vector<KeyPoint> keypoints;
|
||||
* sbd->detect(image, keypoints, Mat());
|
||||
*
|
||||
* drawKeypoints(image, keypoints, result);
|
||||
* for (vector<KeyPoint>::iterator k = keypoints.begin(); k != keypoints.end(); ++k)
|
||||
* circle(result, k->pt, (int)k->size, Scalar(0, 0, 255), 2);
|
||||
*
|
||||
* imshow("result", result);
|
||||
* waitKey(0);
|
||||
* ```
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core.hpp#L3077).
|
||||
*
|
||||
*/
|
||||
export declare class Algorithm extends EmscriptenEmbindInstance {
|
||||
public constructor();
|
||||
|
||||
public clear(): void;
|
||||
|
||||
public empty(): bool;
|
||||
|
||||
/**
|
||||
* Returns the algorithm string identifier. This string is used as top level xml/yml node tag when
|
||||
* the object is saved to a file or string.
|
||||
*/
|
||||
public getDefaultName(): String;
|
||||
|
||||
public read(fn: FileNode): FileNode;
|
||||
|
||||
/**
|
||||
* Saves the algorithm to a file. In order to make this method work, the derived class must implement
|
||||
* Algorithm::write(FileStorage& fs).
|
||||
*/
|
||||
public save(filename: String): String;
|
||||
|
||||
public write(fs: FileStorage): FileStorage;
|
||||
|
||||
public write(fs: Ptr, name?: String): Ptr;
|
||||
|
||||
/**
|
||||
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
||||
*
|
||||
* ```cpp
|
||||
* Ptr<SVM> svm = Algorithm::load<SVM>("my_svm_model.xml");
|
||||
* ```
|
||||
*
|
||||
* In order to make this method work, the derived class must overwrite [Algorithm::read](const
|
||||
* [FileNode]& fn).
|
||||
*
|
||||
* @param filename Name of the file to read.
|
||||
*
|
||||
* @param objname The optional name of the node to read (if empty, the first top-level node will be
|
||||
* used)
|
||||
*/
|
||||
public static load(arg0: any, filename: String, objname?: String): Ptr;
|
||||
|
||||
/**
|
||||
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
||||
*
|
||||
* ```cpp
|
||||
* Ptr<SVM> svm = Algorithm::loadFromString<SVM>(myStringModel);
|
||||
* ```
|
||||
*
|
||||
* @param strModel The string variable containing the model you want to load.
|
||||
*
|
||||
* @param objname The optional name of the node to read (if empty, the first top-level node will be
|
||||
* used)
|
||||
*/
|
||||
public static loadFromString(
|
||||
arg1: any,
|
||||
strModel: String,
|
||||
objname?: String,
|
||||
): Ptr;
|
||||
|
||||
/**
|
||||
* This is static template method of [Algorithm]. It's usage is following (in the case of SVM):
|
||||
*
|
||||
* ```cpp
|
||||
* cv::FileStorage fsRead("example.xml", FileStorage::READ);
|
||||
* Ptr<SVM> svm = Algorithm::read<SVM>(fsRead.root());
|
||||
* ```
|
||||
*
|
||||
* In order to make this method work, the derived class must overwrite [Algorithm::read](const
|
||||
* [FileNode]& fn) and also have static create() method without parameters (or with all the optional
|
||||
* parameters)
|
||||
*/
|
||||
public static read(arg2: any, fn: FileNode): Ptr;
|
||||
}
|
||||
50
opencv-js-4.10.0/src/types/opencv/AutoBuffer.ts
Normal file
50
opencv-js-4.10.0/src/types/opencv/AutoBuffer.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type { size_t } from "./_types";
|
||||
|
||||
/**
|
||||
* The class is used for temporary buffers in functions and methods. If a temporary buffer is usually
|
||||
* small (a few K's of memory), but its size depends on the parameters, it makes sense to create a
|
||||
* small fixed-size array on stack and use it if it's large enough. If the required buffer size is
|
||||
* larger than the fixed size, another buffer of sufficient size is allocated dynamically and released
|
||||
* after the processing. Therefore, in typical cases, when the buffer size is small, there is no
|
||||
* overhead associated with malloc()/free(). At the same time, there is no limit on the size of
|
||||
* processed data.
|
||||
*
|
||||
* This is what [AutoBuffer](#d8/dd0/classcv_1_1AutoBuffer}) does. The template takes 2 parameters -
|
||||
* type of the buffer elements and the number of stack-allocated elements. Here is how the class is
|
||||
* used:
|
||||
*
|
||||
* ```cpp
|
||||
* void my_func(const cv::Mat& m)
|
||||
* {
|
||||
* cv::AutoBuffer<float> buf(1000); // create automatic buffer containing 1000 floats
|
||||
*
|
||||
* buf.allocate(m.rows); // if m.rows <= 1000, the pre-allocated buffer is used,
|
||||
* // otherwise the buffer of "m.rows" floats will be allocated
|
||||
* // dynamically and deallocated in cv::AutoBuffer destructor
|
||||
* ...
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core/utility.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/utility.hpp#L128).
|
||||
*
|
||||
*/
|
||||
export declare class AutoBuffer {
|
||||
public constructor();
|
||||
|
||||
public constructor(_size: size_t);
|
||||
|
||||
public constructor(buf: AutoBuffer);
|
||||
|
||||
public allocate(_size: size_t): void;
|
||||
|
||||
public data(): any;
|
||||
|
||||
public data(): any;
|
||||
|
||||
public deallocate(): void;
|
||||
|
||||
public resize(_size: size_t): void;
|
||||
|
||||
public size(): size_t;
|
||||
}
|
||||
37
opencv-js-4.10.0/src/types/opencv/BFMatcher.ts
Normal file
37
opencv-js-4.10.0/src/types/opencv/BFMatcher.ts
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
import type { bool, DescriptorMatcher, int, Ptr } from "./_types";
|
||||
|
||||
/**
|
||||
* For each descriptor in the first set, this matcher finds the closest descriptor in the second set by
|
||||
* trying each one. This descriptor matcher supports masking permissible matches of descriptor sets.
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L1140).
|
||||
*
|
||||
*/
|
||||
export declare class BFMatcher extends DescriptorMatcher {
|
||||
public constructor(normType?: int, crossCheck?: bool);
|
||||
|
||||
/**
|
||||
* @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
|
||||
* that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
|
||||
* object copy with the current parameters but with empty train data.
|
||||
*/
|
||||
public clone(emptyTrainData?: bool): Ptr;
|
||||
|
||||
public isMaskSupported(): bool;
|
||||
|
||||
/**
|
||||
* @param normType One of NORM_L1, NORM_L2, NORM_HAMMING, NORM_HAMMING2. L1 and L2 norms are
|
||||
* preferable choices for SIFT and SURF descriptors, NORM_HAMMING should be used with ORB, BRISK and
|
||||
* BRIEF, NORM_HAMMING2 should be used with ORB when WTA_K==3 or 4 (see ORB::ORB constructor
|
||||
* description).
|
||||
*
|
||||
* @param crossCheck If it is false, this is will be default BFMatcher behaviour when it finds the k
|
||||
* nearest neighbors for each query descriptor. If crossCheck==true, then the knnMatch() method with
|
||||
* k=1 will only return pairs (i,j) such that for i-th query descriptor the j-th descriptor in the
|
||||
* matcher's collection is the nearest and vice versa, i.e. the BFMatcher will only return consistent
|
||||
* pairs. Such technique usually produces best results with minimal number of outliers when there are
|
||||
* enough matches. This is alternative to the ratio test, used by D. Lowe in SIFT paper.
|
||||
*/
|
||||
public static create(normType?: int, crossCheck?: bool): Ptr;
|
||||
}
|
||||
43
opencv-js-4.10.0/src/types/opencv/BOWTrainer.ts
Normal file
43
opencv-js-4.10.0/src/types/opencv/BOWTrainer.ts
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
import type { int, Mat } from "./_types";
|
||||
|
||||
/**
|
||||
* For details, see, for example, *Visual Categorization with Bags of Keypoints* by Gabriella Csurka,
|
||||
* Christopher R. Dance, Lixin Fan, Jutta Willamowski, Cedric Bray, 2004. :
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L1339).
|
||||
*
|
||||
*/
|
||||
export declare class BOWTrainer {
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* The training set is clustered using clustermethod to construct the vocabulary.
|
||||
*
|
||||
* @param descriptors Descriptors to add to a training set. Each row of the descriptors matrix is a
|
||||
* descriptor.
|
||||
*/
|
||||
public add(descriptors: Mat): Mat;
|
||||
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*/
|
||||
public cluster(): Mat;
|
||||
|
||||
/**
|
||||
* The vocabulary consists of cluster centers. So, this method returns the vocabulary. In the first
|
||||
* variant of the method, train descriptors stored in the object are clustered. In the second variant,
|
||||
* input descriptors are clustered.
|
||||
*
|
||||
* @param descriptors Descriptors to cluster. Each row of the descriptors matrix is a descriptor.
|
||||
* Descriptors are not added to the inner train descriptor set.
|
||||
*/
|
||||
public cluster(descriptors: Mat): Mat;
|
||||
|
||||
public descriptorsCount(): int;
|
||||
|
||||
public getDescriptors(): Mat;
|
||||
}
|
||||
153
opencv-js-4.10.0/src/types/opencv/CascadeClassifier.ts
Normal file
153
opencv-js-4.10.0/src/types/opencv/CascadeClassifier.ts
Normal file
|
|
@ -0,0 +1,153 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
FileNode,
|
||||
InputArray,
|
||||
int,
|
||||
Mat,
|
||||
Ptr,
|
||||
Size,
|
||||
} from "./_types";
|
||||
|
||||
export declare class CascadeClassifier extends Mat {
|
||||
public cc: Ptr;
|
||||
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* @param filename Name of the file from which the classifier is loaded.
|
||||
*/
|
||||
public constructor(filename: String);
|
||||
|
||||
/**
|
||||
* The function is parallelized with the TBB library.
|
||||
*
|
||||
* (Python) A face detection example using cascade classifiers can be found at
|
||||
* opencv_source_code/samples/python/facedetect.py
|
||||
*
|
||||
* @param image Matrix of the type CV_8U containing an image where objects are detected.
|
||||
*
|
||||
* @param objects Vector of rectangles where each rectangle contains the detected object, the
|
||||
* rectangles may be partially outside the original image.
|
||||
*
|
||||
* @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
|
||||
*
|
||||
* @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
|
||||
* to retain it.
|
||||
*
|
||||
* @param flags Parameter with the same meaning for an old cascade as in the function
|
||||
* cvHaarDetectObjects. It is not used for a new cascade.
|
||||
*
|
||||
* @param minSize Minimum possible object size. Objects smaller than that are ignored.
|
||||
*
|
||||
* @param maxSize Maximum possible object size. Objects larger than that are ignored. If maxSize ==
|
||||
* minSize model is evaluated on single scale.
|
||||
*/
|
||||
public detectMultiScale(
|
||||
image: InputArray,
|
||||
objects: any,
|
||||
scaleFactor?: double,
|
||||
minNeighbors?: int,
|
||||
flags?: int,
|
||||
minSize?: Size,
|
||||
maxSize?: Size,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param image Matrix of the type CV_8U containing an image where objects are detected.
|
||||
*
|
||||
* @param objects Vector of rectangles where each rectangle contains the detected object, the
|
||||
* rectangles may be partially outside the original image.
|
||||
*
|
||||
* @param numDetections Vector of detection numbers for the corresponding objects. An object's number
|
||||
* of detections is the number of neighboring positively classified rectangles that were joined
|
||||
* together to form the object.
|
||||
*
|
||||
* @param scaleFactor Parameter specifying how much the image size is reduced at each image scale.
|
||||
*
|
||||
* @param minNeighbors Parameter specifying how many neighbors each candidate rectangle should have
|
||||
* to retain it.
|
||||
*
|
||||
* @param flags Parameter with the same meaning for an old cascade as in the function
|
||||
* cvHaarDetectObjects. It is not used for a new cascade.
|
||||
*
|
||||
* @param minSize Minimum possible object size. Objects smaller than that are ignored.
|
||||
*
|
||||
* @param maxSize Maximum possible object size. Objects larger than that are ignored. If maxSize ==
|
||||
* minSize model is evaluated on single scale.
|
||||
*/
|
||||
public detectMultiScale(
|
||||
image: InputArray,
|
||||
objects: any,
|
||||
numDetections: any,
|
||||
scaleFactor?: double,
|
||||
minNeighbors?: int,
|
||||
flags?: int,
|
||||
minSize?: Size,
|
||||
maxSize?: Size,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts. This function allows you to retrieve the final stage
|
||||
* decision certainty of classification. For this, one needs to set `outputRejectLevels` on true and
|
||||
* provide the `rejectLevels` and `levelWeights` parameter. For each resulting detection,
|
||||
* `levelWeights` will then contain the certainty of classification at the final stage. This value can
|
||||
* then be used to separate strong from weaker classifications.
|
||||
*
|
||||
* A code sample on how to use it efficiently can be found below:
|
||||
*
|
||||
* ```cpp
|
||||
* Mat img;
|
||||
* vector<double> weights;
|
||||
* vector<int> levels;
|
||||
* vector<Rect> detections;
|
||||
* CascadeClassifier model("/path/to/your/model.xml");
|
||||
* model.detectMultiScale(img, detections, levels, weights, 1.1, 3, 0, Size(), Size(), true);
|
||||
* cerr << "Detection " << detections[0] << " with weight " << weights[0] << endl;
|
||||
* ```
|
||||
*/
|
||||
public detectMultiScale(
|
||||
image: InputArray,
|
||||
objects: any,
|
||||
rejectLevels: any,
|
||||
levelWeights: any,
|
||||
scaleFactor?: double,
|
||||
minNeighbors?: int,
|
||||
flags?: int,
|
||||
minSize?: Size,
|
||||
maxSize?: Size,
|
||||
outputRejectLevels?: bool,
|
||||
): InputArray;
|
||||
|
||||
public empty(): bool;
|
||||
|
||||
public getFeatureType(): int;
|
||||
|
||||
public getMaskGenerator(): Ptr;
|
||||
|
||||
public getOldCascade(): any;
|
||||
|
||||
public getOriginalWindowSize(): Size;
|
||||
|
||||
public isOldFormatCascade(): bool;
|
||||
|
||||
/**
|
||||
* @param filename Name of the file from which the classifier is loaded. The file may contain an old
|
||||
* HAAR classifier trained by the haartraining application or a new cascade classifier trained by the
|
||||
* traincascade application.
|
||||
*/
|
||||
public load(filename: String): String;
|
||||
|
||||
/**
|
||||
* The file may contain a new cascade classifier (trained traincascade application) only.
|
||||
*/
|
||||
public read(node: FileNode): FileNode;
|
||||
|
||||
public setMaskGenerator(maskGenerator: Ptr): Ptr;
|
||||
|
||||
public static convert(oldcascade: String, newcascade: String): String;
|
||||
}
|
||||
236
opencv-js-4.10.0/src/types/opencv/DescriptorMatcher.ts
Normal file
236
opencv-js-4.10.0/src/types/opencv/DescriptorMatcher.ts
Normal file
|
|
@ -0,0 +1,236 @@
|
|||
import type {
|
||||
Algorithm,
|
||||
bool,
|
||||
FileNode,
|
||||
FileStorage,
|
||||
float,
|
||||
InputArray,
|
||||
InputArrayOfArrays,
|
||||
int,
|
||||
Mat,
|
||||
Ptr,
|
||||
} from "./_types";
|
||||
|
||||
/**
|
||||
* It has two groups of match methods: for matching descriptors of an image with another image or with
|
||||
* an image set.
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L860).
|
||||
*
|
||||
*/
|
||||
export declare class DescriptorMatcher extends Algorithm {
|
||||
/**
|
||||
* If the collection is not empty, the new descriptors are added to existing train descriptors.
|
||||
*
|
||||
* @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same
|
||||
* train image.
|
||||
*/
|
||||
public add(descriptors: InputArrayOfArrays): InputArrayOfArrays;
|
||||
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
|
||||
* that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
|
||||
* object copy with the current parameters but with empty train data.
|
||||
*/
|
||||
public clone(emptyTrainData?: bool): Ptr;
|
||||
|
||||
public empty(): bool;
|
||||
|
||||
public getTrainDescriptors(): Mat;
|
||||
|
||||
public isMaskSupported(): bool;
|
||||
|
||||
/**
|
||||
* These extended variants of [DescriptorMatcher::match] methods find several best matches for each
|
||||
* query descriptor. The matches are returned in the distance increasing order. See
|
||||
* [DescriptorMatcher::match] for the details about query and train descriptors.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
|
||||
* collection stored in the class object.
|
||||
*
|
||||
* @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
|
||||
*
|
||||
* @param k Count of best matches found per each query descriptor or less if a query descriptor has
|
||||
* less than k possible matches in total.
|
||||
*
|
||||
* @param mask Mask specifying permissible matches between an input query and train matrices of
|
||||
* descriptors.
|
||||
*
|
||||
* @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
|
||||
* false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the
|
||||
* matches vector does not contain matches for fully masked-out query descriptors.
|
||||
*/
|
||||
public knnMatch(
|
||||
queryDescriptors: InputArray,
|
||||
trainDescriptors: InputArray,
|
||||
matches: any,
|
||||
k: int,
|
||||
mask?: InputArray,
|
||||
compactResult?: bool,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param matches Matches. Each matches[i] is k or less matches for the same query descriptor.
|
||||
*
|
||||
* @param k Count of best matches found per each query descriptor or less if a query descriptor has
|
||||
* less than k possible matches in total.
|
||||
*
|
||||
* @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
|
||||
* descriptors and stored train descriptors from the i-th image trainDescCollection[i].
|
||||
*
|
||||
* @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
|
||||
* false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the
|
||||
* matches vector does not contain matches for fully masked-out query descriptors.
|
||||
*/
|
||||
public knnMatch(
|
||||
queryDescriptors: InputArray,
|
||||
matches: any,
|
||||
k: int,
|
||||
masks?: InputArrayOfArrays,
|
||||
compactResult?: bool,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* In the first variant of this method, the train descriptors are passed as an input argument. In the
|
||||
* second variant of the method, train descriptors collection that was set by [DescriptorMatcher::add]
|
||||
* is used. Optional mask (or masks) can be passed to specify which query and training descriptors can
|
||||
* be matched. Namely, queryDescriptors[i] can be matched with trainDescriptors[j] only if
|
||||
* mask.at<uchar>(i,j) is non-zero.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
|
||||
* collection stored in the class object.
|
||||
*
|
||||
* @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
|
||||
* descriptor. So, matches size may be smaller than the query descriptors count.
|
||||
*
|
||||
* @param mask Mask specifying permissible matches between an input query and train matrices of
|
||||
* descriptors.
|
||||
*/
|
||||
public match(
|
||||
queryDescriptors: InputArray,
|
||||
trainDescriptors: InputArray,
|
||||
matches: any,
|
||||
mask?: InputArray,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param matches Matches. If a query descriptor is masked out in mask , no match is added for this
|
||||
* descriptor. So, matches size may be smaller than the query descriptors count.
|
||||
*
|
||||
* @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
|
||||
* descriptors and stored train descriptors from the i-th image trainDescCollection[i].
|
||||
*/
|
||||
public match(
|
||||
queryDescriptors: InputArray,
|
||||
matches: any,
|
||||
masks?: InputArrayOfArrays,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* For each query descriptor, the methods find such training descriptors that the distance between
|
||||
* the query descriptor and the training descriptor is equal or smaller than maxDistance. Found matches
|
||||
* are returned in the distance increasing order.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param trainDescriptors Train set of descriptors. This set is not added to the train descriptors
|
||||
* collection stored in the class object.
|
||||
*
|
||||
* @param matches Found matches.
|
||||
*
|
||||
* @param maxDistance Threshold for the distance between matched descriptors. Distance means here
|
||||
* metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in
|
||||
* Pixels)!
|
||||
*
|
||||
* @param mask Mask specifying permissible matches between an input query and train matrices of
|
||||
* descriptors.
|
||||
*
|
||||
* @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
|
||||
* false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the
|
||||
* matches vector does not contain matches for fully masked-out query descriptors.
|
||||
*/
|
||||
public radiusMatch(
|
||||
queryDescriptors: InputArray,
|
||||
trainDescriptors: InputArray,
|
||||
matches: any,
|
||||
maxDistance: float,
|
||||
mask?: InputArray,
|
||||
compactResult?: bool,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param queryDescriptors Query set of descriptors.
|
||||
*
|
||||
* @param matches Found matches.
|
||||
*
|
||||
* @param maxDistance Threshold for the distance between matched descriptors. Distance means here
|
||||
* metric distance (e.g. Hamming distance), not the distance between coordinates (which is measured in
|
||||
* Pixels)!
|
||||
*
|
||||
* @param masks Set of masks. Each masks[i] specifies permissible matches between the input query
|
||||
* descriptors and stored train descriptors from the i-th image trainDescCollection[i].
|
||||
*
|
||||
* @param compactResult Parameter used when the mask (or masks) is not empty. If compactResult is
|
||||
* false, the matches vector has the same size as queryDescriptors rows. If compactResult is true, the
|
||||
* matches vector does not contain matches for fully masked-out query descriptors.
|
||||
*/
|
||||
public radiusMatch(
|
||||
queryDescriptors: InputArray,
|
||||
matches: any,
|
||||
maxDistance: float,
|
||||
masks?: InputArrayOfArrays,
|
||||
compactResult?: bool,
|
||||
): InputArray;
|
||||
|
||||
public read(fileName: String): String;
|
||||
|
||||
public read(fn: FileNode): FileNode;
|
||||
|
||||
/**
|
||||
* Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
|
||||
* [train()] is run every time before matching. Some descriptor matchers (for example,
|
||||
* BruteForceMatcher) have an empty implementation of this method. Other matchers really train their
|
||||
* inner structures (for example, [FlannBasedMatcher] trains [flann::Index] ).
|
||||
*/
|
||||
public train(): void;
|
||||
|
||||
public write(fileName: String): String;
|
||||
|
||||
public write(fs: FileStorage): FileStorage;
|
||||
|
||||
public write(fs: Ptr, name?: String): Ptr;
|
||||
}
|
||||
|
||||
export declare const FLANNBASED: MatcherType; // initializer: = 1
|
||||
|
||||
export declare const BRUTEFORCE: MatcherType; // initializer: = 2
|
||||
|
||||
export declare const BRUTEFORCE_L1: MatcherType; // initializer: = 3
|
||||
|
||||
export declare const BRUTEFORCE_HAMMING: MatcherType; // initializer: = 4
|
||||
|
||||
export declare const BRUTEFORCE_HAMMINGLUT: MatcherType; // initializer: = 5
|
||||
|
||||
export declare const BRUTEFORCE_SL2: MatcherType; // initializer: = 6
|
||||
|
||||
export type MatcherType = any;
|
||||
68
opencv-js-4.10.0/src/types/opencv/DynamicBitset.ts
Normal file
68
opencv-js-4.10.0/src/types/opencv/DynamicBitset.ts
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
import type { bool, size_t } from "./_types";
|
||||
|
||||
/**
|
||||
* Class re-implementing the boost version of it This helps not depending on boost, it also does not do
|
||||
* the bound checks and has a way to reset a block for speed
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/flann/dynamic_bitset.h](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/flann/dynamic_bitset.h#L150).
|
||||
*
|
||||
*/
|
||||
export declare class DynamicBitset {
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* only constructor we use in our code
|
||||
*
|
||||
* @param sz the size of the bitset (in bits)
|
||||
*/
|
||||
public constructor(sz: size_t);
|
||||
|
||||
/**
|
||||
* Sets all the bits to 0
|
||||
*/
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* true if the bitset is empty
|
||||
*/
|
||||
public empty(): bool;
|
||||
|
||||
/**
|
||||
* set all the bits to 0
|
||||
*/
|
||||
public reset(): void;
|
||||
|
||||
public reset(index: size_t): void;
|
||||
|
||||
public reset_block(index: size_t): void;
|
||||
|
||||
/**
|
||||
* resize the bitset so that it contains at least sz bits
|
||||
*/
|
||||
public resize(sz: size_t): void;
|
||||
|
||||
/**
|
||||
* set a bit to true
|
||||
*
|
||||
* @param index the index of the bit to set to 1
|
||||
*/
|
||||
public set(index: size_t): void;
|
||||
|
||||
/**
|
||||
* gives the number of contained bits
|
||||
*/
|
||||
public size(): size_t;
|
||||
|
||||
/**
|
||||
* check if a bit is set
|
||||
*
|
||||
* true if the bit is set
|
||||
*
|
||||
* @param index the index of the bit to check
|
||||
*/
|
||||
public test(index: size_t): bool;
|
||||
}
|
||||
54
opencv-js-4.10.0/src/types/opencv/Exception.ts
Normal file
54
opencv-js-4.10.0/src/types/opencv/Exception.ts
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
import type { int } from "./_types";
|
||||
|
||||
/**
|
||||
* This class encapsulates all or almost all necessary information about the error happened in the
|
||||
* program. The exception is usually constructed and thrown implicitly via CV_Error and CV_Error_
|
||||
* macros.
|
||||
*
|
||||
* [error](#db/de0/group__core__utils_1gacbd081fdb20423a63cf731569ba70b2b})
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core.hpp#L135).
|
||||
*
|
||||
*/
|
||||
export declare class Exception {
|
||||
/**
|
||||
* CVStatus
|
||||
*
|
||||
*/
|
||||
public code: int;
|
||||
|
||||
public err: String;
|
||||
|
||||
public file: String;
|
||||
|
||||
public func: String;
|
||||
|
||||
public line: int;
|
||||
|
||||
public msg: String;
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* Full constructor. Normally the constructor is not called explicitly. Instead, the macros
|
||||
* [CV_Error()], [CV_Error_()] and [CV_Assert()] are used.
|
||||
*/
|
||||
public constructor(
|
||||
_code: int,
|
||||
_err: String,
|
||||
_func: String,
|
||||
_file: String,
|
||||
_line: int,
|
||||
);
|
||||
|
||||
public formatMessage(): void;
|
||||
|
||||
/**
|
||||
* the error description and the context as a text string.
|
||||
*/
|
||||
public what(): any;
|
||||
}
|
||||
20
opencv-js-4.10.0/src/types/opencv/Feature2D.ts
Normal file
20
opencv-js-4.10.0/src/types/opencv/Feature2D.ts
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
import type { Algorithm, KeyPointVector, Mat, OutputArray } from "./_types";
|
||||
|
||||
/**
|
||||
* https://docs.opencv.org/4.10.0/d0/d13/classcv_1_1Feature2D.html
|
||||
*/
|
||||
export declare class Feature2D extends Algorithm {
|
||||
/**
|
||||
* Detects keypoints and computes the descriptors
|
||||
* @param img
|
||||
* @param mask
|
||||
* @param keypoints
|
||||
* @param descriptors
|
||||
*/
|
||||
public detectAndCompute(
|
||||
img: Mat,
|
||||
mask: Mat,
|
||||
keypoints: KeyPointVector,
|
||||
descriptors: OutputArray,
|
||||
): void;
|
||||
}
|
||||
50
opencv-js-4.10.0/src/types/opencv/FlannBasedMatcher.ts
Normal file
50
opencv-js-4.10.0/src/types/opencv/FlannBasedMatcher.ts
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
import type { bool, DescriptorMatcher, FileNode, FileStorage, InputArrayOfArrays, Ptr } from "./_types";
|
||||
|
||||
/**
|
||||
* This matcher trains [cv::flann::Index](#d1/db2/classcv_1_1flann_1_1Index}) on a train descriptor
|
||||
* collection and calls its nearest search methods to find the best matches. So, this matcher may be
|
||||
* faster when matching a large train collection than the brute force matcher.
|
||||
* [FlannBasedMatcher](#dc/de2/classcv_1_1FlannBasedMatcher}) does not support masking permissible
|
||||
* matches of descriptor sets because [flann::Index](#d1/db2/classcv_1_1flann_1_1Index}) does not
|
||||
* support this. :
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/features2d.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/features2d.hpp#L1187).
|
||||
*
|
||||
*/
|
||||
export declare class FlannBasedMatcher extends DescriptorMatcher {
|
||||
public constructor(indexParams?: Ptr, searchParams?: Ptr);
|
||||
|
||||
/**
|
||||
* If the collection is not empty, the new descriptors are added to existing train descriptors.
|
||||
*
|
||||
* @param descriptors Descriptors to add. Each descriptors[i] is a set of descriptors from the same
|
||||
* train image.
|
||||
*/
|
||||
public add(descriptors: InputArrayOfArrays): InputArrayOfArrays;
|
||||
|
||||
public clear(): void;
|
||||
|
||||
/**
|
||||
* @param emptyTrainData If emptyTrainData is false, the method creates a deep copy of the object,
|
||||
* that is, copies both parameters and train data. If emptyTrainData is true, the method creates an
|
||||
* object copy with the current parameters but with empty train data.
|
||||
*/
|
||||
public clone(emptyTrainData?: bool): Ptr;
|
||||
|
||||
public isMaskSupported(): bool;
|
||||
|
||||
public read(fn: FileNode): FileNode;
|
||||
|
||||
/**
|
||||
* Trains a descriptor matcher (for example, the flann index). In all methods to match, the method
|
||||
* [train()] is run every time before matching. Some descriptor matchers (for example,
|
||||
* BruteForceMatcher) have an empty implementation of this method. Other matchers really train their
|
||||
* inner structures (for example, [FlannBasedMatcher] trains [flann::Index] ).
|
||||
*/
|
||||
public train(): void;
|
||||
|
||||
public write(fs: FileStorage): FileStorage;
|
||||
|
||||
public static create(): Ptr;
|
||||
}
|
||||
401
opencv-js-4.10.0/src/types/opencv/HOGDescriptor.ts
Normal file
401
opencv-js-4.10.0/src/types/opencv/HOGDescriptor.ts
Normal file
|
|
@ -0,0 +1,401 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
FileNode,
|
||||
FileStorage,
|
||||
float,
|
||||
InputArray,
|
||||
InputOutputArray,
|
||||
int,
|
||||
Point,
|
||||
Size,
|
||||
size_t,
|
||||
UMat,
|
||||
} from "./_types";
|
||||
|
||||
/**
|
||||
* the HOG descriptor algorithm introduced by Navneet Dalal and Bill Triggs Dalal2005 .
|
||||
*
|
||||
* useful links:
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/objdetect.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/objdetect.hpp#L377).
|
||||
*
|
||||
*/
|
||||
export declare class HOGDescriptor {
|
||||
public blockSize: Size;
|
||||
|
||||
public blockStride: Size;
|
||||
|
||||
public cellSize: Size;
|
||||
|
||||
public derivAperture: int;
|
||||
|
||||
public free_coef: float;
|
||||
|
||||
public gammaCorrection: bool;
|
||||
|
||||
public histogramNormType: any;
|
||||
|
||||
public L2HysThreshold: double;
|
||||
|
||||
public nbins: int;
|
||||
|
||||
public nlevels: int;
|
||||
|
||||
public oclSvmDetector: UMat;
|
||||
|
||||
public signedGradient: bool;
|
||||
|
||||
public svmDetector: any;
|
||||
|
||||
public winSigma: double;
|
||||
|
||||
public winSize: Size;
|
||||
|
||||
/**
|
||||
* aqual to [HOGDescriptor](Size(64,128), Size(16,16), Size(8,8), Size(8,8), 9 )
|
||||
*/
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param _winSize sets winSize with given value.
|
||||
*
|
||||
* @param _blockSize sets blockSize with given value.
|
||||
*
|
||||
* @param _blockStride sets blockStride with given value.
|
||||
*
|
||||
* @param _cellSize sets cellSize with given value.
|
||||
*
|
||||
* @param _nbins sets nbins with given value.
|
||||
*
|
||||
* @param _derivAperture sets derivAperture with given value.
|
||||
*
|
||||
* @param _winSigma sets winSigma with given value.
|
||||
*
|
||||
* @param _histogramNormType sets histogramNormType with given value.
|
||||
*
|
||||
* @param _L2HysThreshold sets L2HysThreshold with given value.
|
||||
*
|
||||
* @param _gammaCorrection sets gammaCorrection with given value.
|
||||
*
|
||||
* @param _nlevels sets nlevels with given value.
|
||||
*
|
||||
* @param _signedGradient sets signedGradient with given value.
|
||||
*/
|
||||
public constructor(
|
||||
_winSize: Size,
|
||||
_blockSize: Size,
|
||||
_blockStride: Size,
|
||||
_cellSize: Size,
|
||||
_nbins: int,
|
||||
_derivAperture?: int,
|
||||
_winSigma?: double,
|
||||
_histogramNormType?: any,
|
||||
_L2HysThreshold?: double,
|
||||
_gammaCorrection?: bool,
|
||||
_nlevels?: int,
|
||||
_signedGradient?: bool,
|
||||
);
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param filename The file name containing HOGDescriptor properties and coefficients for the linear
|
||||
* SVM classifier.
|
||||
*/
|
||||
public constructor(filename: String);
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param d the HOGDescriptor which cloned to create a new one.
|
||||
*/
|
||||
public constructor(d: HOGDescriptor);
|
||||
|
||||
public checkDetectorSize(): bool;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U containing an image where HOG features will be calculated.
|
||||
*
|
||||
* @param descriptors Matrix of the type CV_32F
|
||||
*
|
||||
* @param winStride Window stride. It must be a multiple of block stride.
|
||||
*
|
||||
* @param padding Padding
|
||||
*
|
||||
* @param locations Vector of Point
|
||||
*/
|
||||
public compute(
|
||||
img: InputArray,
|
||||
descriptors: any,
|
||||
winStride?: Size,
|
||||
padding?: Size,
|
||||
locations?: Point,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix contains the image to be computed
|
||||
*
|
||||
* @param grad Matrix of type CV_32FC2 contains computed gradients
|
||||
*
|
||||
* @param angleOfs Matrix of type CV_8UC2 contains quantized gradient orientations
|
||||
*
|
||||
* @param paddingTL Padding from top-left
|
||||
*
|
||||
* @param paddingBR Padding from bottom-right
|
||||
*/
|
||||
public computeGradient(
|
||||
img: InputArray,
|
||||
grad: InputOutputArray,
|
||||
angleOfs: InputOutputArray,
|
||||
paddingTL?: Size,
|
||||
paddingBR?: Size,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param c cloned HOGDescriptor
|
||||
*/
|
||||
public copyTo(c: HOGDescriptor): HOGDescriptor;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param foundLocations Vector of point where each point contains left-top corner point of detected
|
||||
* object boundaries.
|
||||
*
|
||||
* @param weights Vector that will contain confidence values for each detected object.
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
*
|
||||
* @param winStride Window stride. It must be a multiple of block stride.
|
||||
*
|
||||
* @param padding Padding
|
||||
*
|
||||
* @param searchLocations Vector of Point includes set of requested locations to be evaluated.
|
||||
*/
|
||||
public detect(
|
||||
img: InputArray,
|
||||
foundLocations: any,
|
||||
weights: any,
|
||||
hitThreshold?: double,
|
||||
winStride?: Size,
|
||||
padding?: Size,
|
||||
searchLocations?: Point,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param foundLocations Vector of point where each point contains left-top corner point of detected
|
||||
* object boundaries.
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
*
|
||||
* @param winStride Window stride. It must be a multiple of block stride.
|
||||
*
|
||||
* @param padding Padding
|
||||
*
|
||||
* @param searchLocations Vector of Point includes locations to search.
|
||||
*/
|
||||
public detect(
|
||||
img: InputArray,
|
||||
foundLocations: any,
|
||||
hitThreshold?: double,
|
||||
winStride?: Size,
|
||||
padding?: Size,
|
||||
searchLocations?: Point,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param foundLocations Vector of rectangles where each rectangle contains the detected object.
|
||||
*
|
||||
* @param foundWeights Vector that will contain confidence values for each detected object.
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
*
|
||||
* @param winStride Window stride. It must be a multiple of block stride.
|
||||
*
|
||||
* @param padding Padding
|
||||
*
|
||||
* @param scale Coefficient of the detection window increase.
|
||||
*
|
||||
* @param finalThreshold Final threshold
|
||||
*
|
||||
* @param useMeanshiftGrouping indicates grouping algorithm
|
||||
*/
|
||||
public detectMultiScale(
|
||||
img: InputArray,
|
||||
foundLocations: any,
|
||||
foundWeights: any,
|
||||
hitThreshold?: double,
|
||||
winStride?: Size,
|
||||
padding?: Size,
|
||||
scale?: double,
|
||||
finalThreshold?: double,
|
||||
useMeanshiftGrouping?: bool,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param foundLocations Vector of rectangles where each rectangle contains the detected object.
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
*
|
||||
* @param winStride Window stride. It must be a multiple of block stride.
|
||||
*
|
||||
* @param padding Padding
|
||||
*
|
||||
* @param scale Coefficient of the detection window increase.
|
||||
*
|
||||
* @param finalThreshold Final threshold
|
||||
*
|
||||
* @param useMeanshiftGrouping indicates grouping algorithm
|
||||
*/
|
||||
public detectMultiScale(
|
||||
img: InputArray,
|
||||
foundLocations: any,
|
||||
hitThreshold?: double,
|
||||
winStride?: Size,
|
||||
padding?: Size,
|
||||
scale?: double,
|
||||
finalThreshold?: double,
|
||||
useMeanshiftGrouping?: bool,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param foundLocations Vector of rectangles where each rectangle contains the detected object.
|
||||
*
|
||||
* @param locations Vector of DetectionROI
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here.
|
||||
*
|
||||
* @param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a
|
||||
* group of rectangles to retain it.
|
||||
*/
|
||||
public detectMultiScaleROI(
|
||||
img: InputArray,
|
||||
foundLocations: any,
|
||||
locations: any,
|
||||
hitThreshold?: double,
|
||||
groupThreshold?: int,
|
||||
): InputArray;
|
||||
|
||||
/**
|
||||
* @param img Matrix of the type CV_8U or CV_8UC3 containing an image where objects are detected.
|
||||
*
|
||||
* @param locations Vector of Point
|
||||
*
|
||||
* @param foundLocations Vector of Point where each Point is detected object's top-left point.
|
||||
*
|
||||
* @param confidences confidences
|
||||
*
|
||||
* @param hitThreshold Threshold for the distance between features and SVM classifying plane. Usually
|
||||
* it is 0 and should be specified in the detector coefficients (as the last free coefficient). But if
|
||||
* the free coefficient is omitted (which is allowed), you can specify it manually here
|
||||
*
|
||||
* @param winStride winStride
|
||||
*
|
||||
* @param padding padding
|
||||
*/
|
||||
public detectROI(
|
||||
img: InputArray,
|
||||
locations: any,
|
||||
foundLocations: any,
|
||||
confidences: any,
|
||||
hitThreshold?: double,
|
||||
winStride?: any,
|
||||
padding?: any,
|
||||
): InputArray;
|
||||
|
||||
public getDescriptorSize(): size_t;
|
||||
|
||||
public getWinSigma(): double;
|
||||
|
||||
/**
|
||||
* @param rectList Input/output vector of rectangles. Output vector includes retained and grouped
|
||||
* rectangles. (The Python list is not modified in place.)
|
||||
*
|
||||
* @param weights Input/output vector of weights of rectangles. Output vector includes weights of
|
||||
* retained and grouped rectangles. (The Python list is not modified in place.)
|
||||
*
|
||||
* @param groupThreshold Minimum possible number of rectangles minus 1. The threshold is used in a
|
||||
* group of rectangles to retain it.
|
||||
*
|
||||
* @param eps Relative difference between sides of the rectangles to merge them into a group.
|
||||
*/
|
||||
public groupRectangles(
|
||||
rectList: any,
|
||||
weights: any,
|
||||
groupThreshold: int,
|
||||
eps: double,
|
||||
): any;
|
||||
|
||||
/**
|
||||
* @param filename Path of the file to read.
|
||||
*
|
||||
* @param objname The optional name of the node to read (if empty, the first top-level node will be
|
||||
* used).
|
||||
*/
|
||||
public load(filename: String, objname?: String): String;
|
||||
|
||||
/**
|
||||
* @param fn File node
|
||||
*/
|
||||
public read(fn: FileNode): FileNode;
|
||||
|
||||
/**
|
||||
* @param filename File name
|
||||
*
|
||||
* @param objname Object name
|
||||
*/
|
||||
public save(filename: String, objname?: String): String;
|
||||
|
||||
/**
|
||||
* @param svmdetector coefficients for the linear SVM classifier.
|
||||
*/
|
||||
public setSVMDetector(svmdetector: InputArray): InputArray;
|
||||
|
||||
/**
|
||||
* @param fs File storage
|
||||
*
|
||||
* @param objname Object name
|
||||
*/
|
||||
public write(fs: FileStorage, objname: String): FileStorage;
|
||||
|
||||
public static getDaimlerPeopleDetector(): any;
|
||||
|
||||
public static getDefaultPeopleDetector(): any;
|
||||
}
|
||||
|
||||
export declare const DEFAULT_NLEVELS: any; // initializer: = 64
|
||||
|
||||
export declare const DESCR_FORMAT_COL_BY_COL: DescriptorStorageFormat; // initializer:
|
||||
|
||||
export declare const DESCR_FORMAT_ROW_BY_ROW: DescriptorStorageFormat; // initializer:
|
||||
|
||||
export declare const L2Hys: HistogramNormType; // initializer: = 0
|
||||
|
||||
export type DescriptorStorageFormat = any;
|
||||
|
||||
export type HistogramNormType = any;
|
||||
34
opencv-js-4.10.0/src/types/opencv/Logger.ts
Normal file
34
opencv-js-4.10.0/src/types/opencv/Logger.ts
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
import type { int } from "./_types";
|
||||
|
||||
export declare class Logger {
|
||||
public static error(fmt: any, arg121: any): int;
|
||||
|
||||
public static fatal(fmt: any, arg122: any): int;
|
||||
|
||||
public static info(fmt: any, arg123: any): int;
|
||||
|
||||
/**
|
||||
* Print log message
|
||||
*
|
||||
* @param level Log level
|
||||
*
|
||||
* @param fmt Message format
|
||||
*/
|
||||
public static log(level: int, fmt: any, arg124: any): int;
|
||||
|
||||
/**
|
||||
* Sets the logging destination
|
||||
*
|
||||
* @param name Filename or NULL for console
|
||||
*/
|
||||
public static setDestination(name: any): void;
|
||||
|
||||
/**
|
||||
* Sets the logging level. All messages with lower priority will be ignored.
|
||||
*
|
||||
* @param level Logging level
|
||||
*/
|
||||
public static setLevel(level: int): void;
|
||||
|
||||
public static warn(fmt: any, arg125: any): int;
|
||||
}
|
||||
81
opencv-js-4.10.0/src/types/opencv/LshTable.ts
Normal file
81
opencv-js-4.10.0/src/types/opencv/LshTable.ts
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import type { Bucket, BucketKey, LshStats, Matrix, size_t } from "./_types";
|
||||
|
||||
/**
|
||||
* Lsh hash table. As its key is a sub-feature, and as usually the size of it is pretty small, we keep
|
||||
* it as a continuous memory array. The value is an index in the corpus of features (we keep it as an
|
||||
* unsigned int for pure memory reasons, it could be a size_t)
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/flann/lsh_table.h](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/flann/lsh_table.h#L261).
|
||||
*
|
||||
*/
|
||||
export declare class LshTable {
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* Default constructor Create the mask and allocate the memory
|
||||
*
|
||||
* @param feature_size is the size of the feature (considered as a ElementType[])
|
||||
*
|
||||
* @param key_size is the number of bits that are turned on in the feature
|
||||
*/
|
||||
public constructor(feature_size: any, key_size: any);
|
||||
|
||||
public constructor(feature_size: any, subsignature_size: any);
|
||||
|
||||
/**
|
||||
* Add a feature to the table
|
||||
*
|
||||
* @param value the value to store for that feature
|
||||
*
|
||||
* @param feature the feature itself
|
||||
*/
|
||||
public add(value: any, feature: any): void;
|
||||
|
||||
/**
|
||||
* Add a set of features to the table
|
||||
*
|
||||
* @param dataset the values to store
|
||||
*/
|
||||
public add(dataset: Matrix): Matrix;
|
||||
|
||||
/**
|
||||
* Get a bucket given the key
|
||||
*/
|
||||
public getBucketFromKey(key: BucketKey): Bucket;
|
||||
|
||||
/**
|
||||
* Compute the sub-signature of a feature
|
||||
*/
|
||||
public getKey(arg50: any): size_t;
|
||||
|
||||
/**
|
||||
* Return the Subsignature of a feature
|
||||
*
|
||||
* @param feature the feature to analyze
|
||||
*/
|
||||
public getKey(feature: any): size_t;
|
||||
|
||||
/**
|
||||
* Get statistics about the table
|
||||
*/
|
||||
public getStats(): LshStats;
|
||||
|
||||
public getStats(): LshStats;
|
||||
}
|
||||
|
||||
export declare const kArray: SpeedLevel; // initializer:
|
||||
|
||||
export declare const kBitsetHash: SpeedLevel; // initializer:
|
||||
|
||||
export declare const kHash: SpeedLevel; // initializer:
|
||||
|
||||
/**
|
||||
* defines the speed fo the implementation kArray uses a vector for storing data kBitsetHash uses a
|
||||
* hash map but checks for the validity of a key with a bitset kHash uses a hash map only
|
||||
*
|
||||
*/
|
||||
export type SpeedLevel = any;
|
||||
1791
opencv-js-4.10.0/src/types/opencv/Mat.ts
Normal file
1791
opencv-js-4.10.0/src/types/opencv/Mat.ts
Normal file
File diff suppressed because it is too large
Load diff
107
opencv-js-4.10.0/src/types/opencv/MatExpr.ts
Normal file
107
opencv-js-4.10.0/src/types/opencv/MatExpr.ts
Normal file
|
|
@ -0,0 +1,107 @@
|
|||
import type { double, int, Mat, MatOp, Scalar } from "./_types";
|
||||
|
||||
/**
|
||||
* <a name="d1/d10/classcv_1_1MatExpr_1MatrixExpressions"></a>This is a list of implemented matrix
|
||||
* operations that can be combined in arbitrary complex expressions (here A, B stand for matrices (
|
||||
* [Mat](#d3/d63/classcv_1_1Mat}) ), s for a scalar ( Scalar ), alpha for a real-valued scalar ( double
|
||||
* )):
|
||||
*
|
||||
* Addition, subtraction, negation: `A+B`, `A-B`, `A+s`, `A-s`, `s+A`, `s-A`, `-A`
|
||||
* Scaling: `A*alpha`
|
||||
* Per-element multiplication and division: `A.mul(B)`, `A/B`, `alpha/A`
|
||||
* Matrix multiplication: `A*B`
|
||||
* Transposition: `A.t()` (means A)
|
||||
* Matrix inversion and pseudo-inversion, solving linear systems and least-squares problems:
|
||||
* `A.inv([method]) (~ A<sup>-1</sup>)`, `A.inv([method])*B (~ X: AX=B)`
|
||||
* Comparison: `A cmpop B`, `A cmpop alpha`, `alpha cmpop A`, where *cmpop* is one of `>`, `>=`, `==`,
|
||||
* `!=`, `<=`, `<`. The result of comparison is an 8-bit single channel mask whose elements are set to
|
||||
* 255 (if the particular element or pair of elements satisfy the condition) or 0.
|
||||
* Bitwise logical operations: `A logicop B`, `A logicop s`, `s logicop A`, `~A`, where *logicop* is
|
||||
* one of `&`, `|`, `^`.
|
||||
* Element-wise minimum and maximum: `min(A, B)`, `min(A, alpha)`, `max(A, B)`, `max(A, alpha)`
|
||||
* Element-wise absolute value: `abs(A)`
|
||||
* Cross-product, dot-product: `A.cross(B)`, `A.dot(B)`
|
||||
* Any function of matrix or matrices and scalars that returns a matrix or a scalar, such as norm,
|
||||
* mean, sum, countNonZero, trace, determinant, repeat, and others.
|
||||
* Matrix initializers ( [Mat::eye()](#d3/d63/classcv_1_1Mat_1a2cf9b9acde7a9852542bbc20ef851ed2}),
|
||||
* [Mat::zeros()](#d3/d63/classcv_1_1Mat_1a0b57b6a326c8876d944d188a46e0f556}),
|
||||
* [Mat::ones()](#d3/d63/classcv_1_1Mat_1a69ae0402d116fc9c71908d8508dc2f09}) ), matrix comma-separated
|
||||
* initializers, matrix constructors and operators that extract sub-matrices (see
|
||||
* [Mat](#d3/d63/classcv_1_1Mat}) description).
|
||||
* Mat_<destination_type>() constructors to cast the result to the proper type.
|
||||
*
|
||||
* Comma-separated initializers and probably some other operations may require additional explicit
|
||||
* Mat() or Mat_<T>() constructor calls to resolve a possible ambiguity.
|
||||
* Here are examples of matrix expressions:
|
||||
*
|
||||
* ```cpp
|
||||
* // compute pseudo-inverse of A, equivalent to A.inv(DECOMP_SVD)
|
||||
* SVD svd(A);
|
||||
* Mat pinvA = svd.vt.t()*Mat::diag(1./svd.w)*svd.u.t();
|
||||
*
|
||||
* // compute the new vector of parameters in the Levenberg-Marquardt algorithm
|
||||
* x -= (A.t()*A + lambda*Mat::eye(A.cols,A.cols,A.type())).inv(DECOMP_CHOLESKY)*(A.t()*err);
|
||||
*
|
||||
* // sharpen image using "unsharp mask" algorithm
|
||||
* Mat blurred; double sigma = 1, threshold = 5, amount = 1;
|
||||
* GaussianBlur(img, blurred, Size(), sigma, sigma);
|
||||
* Mat lowContrastMask = abs(img - blurred) < threshold;
|
||||
* Mat sharpened = img*(1+amount) + blurred*(-amount);
|
||||
* img.copyTo(sharpened, lowContrastMask);
|
||||
* ```
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core/mat.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/mat.hpp#L3557).
|
||||
*
|
||||
*/
|
||||
export declare class MatExpr extends Mat {
|
||||
public a: Mat;
|
||||
|
||||
public alpha: double;
|
||||
|
||||
public b: Mat;
|
||||
|
||||
public beta: double;
|
||||
|
||||
public c: Mat;
|
||||
|
||||
public flags: int;
|
||||
|
||||
public op: MatOp;
|
||||
|
||||
public s: Scalar;
|
||||
|
||||
public constructor();
|
||||
|
||||
public constructor(m: Mat);
|
||||
|
||||
public constructor(
|
||||
_op: MatOp,
|
||||
_flags: int,
|
||||
_a?: Mat,
|
||||
_b?: Mat,
|
||||
_c?: Mat,
|
||||
_alpha?: double,
|
||||
_beta?: double,
|
||||
_s?: Scalar,
|
||||
);
|
||||
|
||||
public col(x: int): MatExpr;
|
||||
|
||||
public cross(m: Mat): Mat;
|
||||
|
||||
public diag(d?: int): MatExpr;
|
||||
|
||||
public dot(m: Mat): Mat;
|
||||
|
||||
public inv(method?: int): MatExpr;
|
||||
|
||||
public mul(e: MatExpr, scale?: double): MatExpr;
|
||||
|
||||
public mul(m: Mat, scale?: double): MatExpr;
|
||||
|
||||
public row(y: int): MatExpr;
|
||||
public t(): MatExpr;
|
||||
|
||||
public type(): int;
|
||||
}
|
||||
70
opencv-js-4.10.0/src/types/opencv/MatOp.ts
Normal file
70
opencv-js-4.10.0/src/types/opencv/MatOp.ts
Normal file
|
|
@ -0,0 +1,70 @@
|
|||
import type { double, int, Mat, MatExpr, Scalar, Size } from "./_types";
|
||||
|
||||
export declare class MatOp {
|
||||
public constructor();
|
||||
|
||||
public abs(expr: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public add(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public add(expr1: MatExpr, s: Scalar, res: MatExpr): MatExpr;
|
||||
|
||||
public assign(expr: MatExpr, m: Mat, type?: int): MatExpr;
|
||||
|
||||
public augAssignAdd(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignAnd(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignDivide(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignMultiply(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignOr(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignSubtract(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public augAssignXor(expr: MatExpr, m: Mat): MatExpr;
|
||||
|
||||
public diag(expr: MatExpr, d: int, res: MatExpr): MatExpr;
|
||||
|
||||
public divide(
|
||||
expr1: MatExpr,
|
||||
expr2: MatExpr,
|
||||
res: MatExpr,
|
||||
scale?: double,
|
||||
): MatExpr;
|
||||
|
||||
public divide(s: double, expr: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public elementWise(expr: MatExpr): MatExpr;
|
||||
|
||||
public invert(expr: MatExpr, method: int, res: MatExpr): MatExpr;
|
||||
|
||||
public matmul(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public multiply(
|
||||
expr1: MatExpr,
|
||||
expr2: MatExpr,
|
||||
res: MatExpr,
|
||||
scale?: double,
|
||||
): MatExpr;
|
||||
|
||||
public multiply(expr1: MatExpr, s: double, res: MatExpr): MatExpr;
|
||||
|
||||
public roi(
|
||||
expr: MatExpr,
|
||||
rowRange: Range,
|
||||
colRange: Range,
|
||||
res: MatExpr,
|
||||
): MatExpr;
|
||||
|
||||
public size(expr: MatExpr): Size;
|
||||
|
||||
public subtract(expr1: MatExpr, expr2: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public subtract(s: Scalar, expr: MatExpr, res: MatExpr): Scalar;
|
||||
|
||||
public transpose(expr: MatExpr, res: MatExpr): MatExpr;
|
||||
|
||||
public type(expr: MatExpr): MatExpr;
|
||||
}
|
||||
228
opencv-js-4.10.0/src/types/opencv/Matx.ts
Normal file
228
opencv-js-4.10.0/src/types/opencv/Matx.ts
Normal file
|
|
@ -0,0 +1,228 @@
|
|||
import type {
|
||||
diag_type,
|
||||
int,
|
||||
Matx_AddOp,
|
||||
Matx_DivOp,
|
||||
Matx_MatMulOp,
|
||||
Matx_MulOp,
|
||||
Matx_ScaleOp,
|
||||
Matx_SubOp,
|
||||
Matx_TOp,
|
||||
Vec,
|
||||
_T2,
|
||||
_Tp,
|
||||
} from "./_types";
|
||||
|
||||
/**
|
||||
* If you need a more flexible type, use [Mat](#d3/d63/classcv_1_1Mat}) . The elements of the matrix M
|
||||
* are accessible using the M(i,j) notation. Most of the common matrix operations (see also
|
||||
* [MatrixExpressions](#d1/d10/classcv_1_1MatExpr_1MatrixExpressions}) ) are available. To do an
|
||||
* operation on [Matx](#de/de1/classcv_1_1Matx}) that is not implemented, you can easily convert the
|
||||
* matrix to [Mat](#d3/d63/classcv_1_1Mat}) and backwards:
|
||||
*
|
||||
* ```cpp
|
||||
* Matx33f m(1, 2, 3,
|
||||
* 4, 5, 6,
|
||||
* 7, 8, 9);
|
||||
* cout << sum(Mat(m*m.t())) << endl;
|
||||
* ```
|
||||
*
|
||||
* Except of the plain constructor which takes a list of elements, [Matx](#de/de1/classcv_1_1Matx})
|
||||
* can be initialized from a C-array:
|
||||
*
|
||||
* ```cpp
|
||||
* float values[] = { 1, 2, 3};
|
||||
* Matx31f m(values);
|
||||
* ```
|
||||
*
|
||||
* In case if C++11 features are available, std::initializer_list can be also used to initialize
|
||||
* [Matx](#de/de1/classcv_1_1Matx}):
|
||||
*
|
||||
* ```cpp
|
||||
* Matx31f m = { 1, 2, 3};
|
||||
* ```
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core/matx.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/matx.hpp#L1185).
|
||||
*
|
||||
*/
|
||||
export declare class Matx {
|
||||
public val: _Tp;
|
||||
|
||||
public constructor();
|
||||
|
||||
public constructor(v0: _Tp);
|
||||
|
||||
public constructor(v0: _Tp, v1: _Tp);
|
||||
|
||||
public constructor(v0: _Tp, v1: _Tp, v2: _Tp);
|
||||
|
||||
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp);
|
||||
|
||||
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp, v4: _Tp);
|
||||
|
||||
public constructor(v0: _Tp, v1: _Tp, v2: _Tp, v3: _Tp, v4: _Tp, v5: _Tp);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
v8: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
v8: _Tp,
|
||||
v9: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
v8: _Tp,
|
||||
v9: _Tp,
|
||||
v10: _Tp,
|
||||
v11: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
v8: _Tp,
|
||||
v9: _Tp,
|
||||
v10: _Tp,
|
||||
v11: _Tp,
|
||||
v12: _Tp,
|
||||
v13: _Tp,
|
||||
);
|
||||
|
||||
public constructor(
|
||||
v0: _Tp,
|
||||
v1: _Tp,
|
||||
v2: _Tp,
|
||||
v3: _Tp,
|
||||
v4: _Tp,
|
||||
v5: _Tp,
|
||||
v6: _Tp,
|
||||
v7: _Tp,
|
||||
v8: _Tp,
|
||||
v9: _Tp,
|
||||
v10: _Tp,
|
||||
v11: _Tp,
|
||||
v12: _Tp,
|
||||
v13: _Tp,
|
||||
v14: _Tp,
|
||||
v15: _Tp,
|
||||
);
|
||||
|
||||
public constructor(vals: any);
|
||||
|
||||
public constructor(arg334: any);
|
||||
|
||||
public constructor(a: Matx, b: Matx, arg335: Matx_AddOp);
|
||||
|
||||
public constructor(a: Matx, b: Matx, arg336: Matx_SubOp);
|
||||
|
||||
public constructor(arg337: any, a: Matx, alpha: _T2, arg338: Matx_ScaleOp);
|
||||
|
||||
public constructor(a: Matx, b: Matx, arg339: Matx_MulOp);
|
||||
|
||||
public constructor(a: Matx, b: Matx, arg340: Matx_DivOp);
|
||||
|
||||
public constructor(l: int, a: Matx, b: Matx, arg341: Matx_MatMulOp);
|
||||
|
||||
public constructor(a: Matx, arg342: Matx_TOp);
|
||||
|
||||
public col(i: int): Matx;
|
||||
|
||||
public ddot(v: Matx): Matx;
|
||||
|
||||
public diag(): diag_type;
|
||||
|
||||
public div(a: Matx): Matx;
|
||||
|
||||
public dot(v: Matx): Matx;
|
||||
|
||||
public get_minor(m1: int, n1: int, base_row: int, base_col: int): Matx;
|
||||
|
||||
public inv(method?: int, p_is_ok?: any): Matx;
|
||||
|
||||
public mul(a: Matx): Matx;
|
||||
|
||||
public reshape(m1: int, n1: int): Matx;
|
||||
|
||||
public row(i: int): Matx;
|
||||
|
||||
public solve(l: int, rhs: Matx, flags?: int): Matx;
|
||||
|
||||
public solve(rhs: Vec, method: int): Vec;
|
||||
|
||||
public t(): Matx;
|
||||
|
||||
public static all(alpha: _Tp): Matx;
|
||||
|
||||
public static diag(d: diag_type): Matx;
|
||||
|
||||
public static eye(): Matx;
|
||||
|
||||
public static ones(): Matx;
|
||||
|
||||
public static randn(a: _Tp, b: _Tp): Matx;
|
||||
|
||||
public static randu(a: _Tp, b: _Tp): Matx;
|
||||
|
||||
public static zeros(): Matx;
|
||||
}
|
||||
|
||||
export declare const rows: any; // initializer: = m
|
||||
|
||||
export declare const cols: any; // initializer: = n
|
||||
|
||||
export declare const channels: any; // initializer: = rows*cols
|
||||
|
||||
export declare const shortdim: any; // initializer: = (m < n ? m : n)
|
||||
33
opencv-js-4.10.0/src/types/opencv/Node.ts
Normal file
33
opencv-js-4.10.0/src/types/opencv/Node.ts
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
import type { double, int } from "./_types";
|
||||
|
||||
export declare class Node {
|
||||
/**
|
||||
* Class index normalized to 0..class_count-1 range and assigned to the node. It is used internally
|
||||
* in classification trees and tree ensembles.
|
||||
*
|
||||
*/
|
||||
public classIdx: int;
|
||||
|
||||
/**
|
||||
* Default direction where to go (-1: left or +1: right). It helps in the case of missing values.
|
||||
*
|
||||
*/
|
||||
public defaultDir: int;
|
||||
|
||||
public left: int;
|
||||
|
||||
public parent: int;
|
||||
|
||||
public right: int;
|
||||
|
||||
public split: int;
|
||||
|
||||
/**
|
||||
* Value at the node: a class label in case of classification or estimated function value in case of
|
||||
* regression.
|
||||
*
|
||||
*/
|
||||
public value: double;
|
||||
|
||||
public constructor();
|
||||
}
|
||||
22
opencv-js-4.10.0/src/types/opencv/ORB.ts
Normal file
22
opencv-js-4.10.0/src/types/opencv/ORB.ts
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
import type { Feature2D, float, int } from "./_types";
|
||||
|
||||
/**
|
||||
* https://docs.opencv.org/4.10.0/db/d95/classcv_1_1ORB.html
|
||||
*/
|
||||
export declare class ORB extends Feature2D {
|
||||
public constructor(
|
||||
nfeatures?: int,
|
||||
scaleFactor?: float,
|
||||
nlevels?: int,
|
||||
edgeThreshold?: int,
|
||||
firstLevel?: int,
|
||||
WTA_K?: int,
|
||||
scoreType?: ORBScoreType,
|
||||
patchSize?: int,
|
||||
fastThreshold?: int,
|
||||
);
|
||||
}
|
||||
|
||||
type ORBScoreType = int;
|
||||
export declare const ORB_HARRIS_SCORE: ORBScoreType;
|
||||
export declare const ORB_FAST_SCORE: ORBScoreType;
|
||||
204
opencv-js-4.10.0/src/types/opencv/PCA.ts
Normal file
204
opencv-js-4.10.0/src/types/opencv/PCA.ts
Normal file
|
|
@ -0,0 +1,204 @@
|
|||
import type {
|
||||
double,
|
||||
FileNode,
|
||||
FileStorage,
|
||||
InputArray,
|
||||
int,
|
||||
Mat,
|
||||
OutputArray,
|
||||
} from "./_types";
|
||||
|
||||
/**
|
||||
* The class is used to calculate a special basis for a set of vectors. The basis will consist of
|
||||
* eigenvectors of the covariance matrix calculated from the input set of vectors. The class PCA can
|
||||
* also transform vectors to/from the new coordinate space defined by the basis. Usually, in this new
|
||||
* coordinate system, each vector from the original set (and any linear combination of such vectors)
|
||||
* can be quite accurately approximated by taking its first few components, corresponding to the
|
||||
* eigenvectors of the largest eigenvalues of the covariance matrix. Geometrically it means that you
|
||||
* calculate a projection of the vector to a subspace formed by a few eigenvectors corresponding to the
|
||||
* dominant eigenvalues of the covariance matrix. And usually such a projection is very close to the
|
||||
* original vector. So, you can represent the original vector from a high-dimensional space with a much
|
||||
* shorter vector consisting of the projected vector's coordinates in the subspace. Such a
|
||||
* transformation is also known as Karhunen-Loeve Transform, or KLT. See
|
||||
*
|
||||
* The sample below is the function that takes two matrices. The first function stores a set of vectors
|
||||
* (a row per vector) that is used to calculate [PCA](#d3/d8d/classcv_1_1PCA}). The second function
|
||||
* stores another "test" set of vectors (a row per vector). First, these vectors are compressed with
|
||||
* [PCA](#d3/d8d/classcv_1_1PCA}), then reconstructed back, and then the reconstruction error norm is
|
||||
* computed and printed for each vector. :
|
||||
*
|
||||
* ```cpp
|
||||
* using namespace cv;
|
||||
*
|
||||
* PCA compressPCA(const Mat& pcaset, int maxComponents,
|
||||
* const Mat& testset, Mat& compressed)
|
||||
* {
|
||||
* PCA pca(pcaset, // pass the data
|
||||
* Mat(), // we do not have a pre-computed mean vector,
|
||||
* // so let the PCA engine to compute it
|
||||
* PCA::DATA_AS_ROW, // indicate that the vectors
|
||||
* // are stored as matrix rows
|
||||
* // (use PCA::DATA_AS_COL if the vectors are
|
||||
* // the matrix columns)
|
||||
* maxComponents // specify, how many principal components to retain
|
||||
* );
|
||||
* // if there is no test data, just return the computed basis, ready-to-use
|
||||
* if( !testset.data )
|
||||
* return pca;
|
||||
* CV_Assert( testset.cols == pcaset.cols );
|
||||
*
|
||||
* compressed.create(testset.rows, maxComponents, testset.type());
|
||||
*
|
||||
* Mat reconstructed;
|
||||
* for( int i = 0; i < testset.rows; i++ )
|
||||
* {
|
||||
* Mat vec = testset.row(i), coeffs = compressed.row(i), reconstructed;
|
||||
* // compress the vector, the result will be stored
|
||||
* // in the i-th row of the output matrix
|
||||
* pca.project(vec, coeffs);
|
||||
* // and then reconstruct it
|
||||
* pca.backProject(coeffs, reconstructed);
|
||||
* // and measure the error
|
||||
* printf("%d. diff = %g\\n", i, norm(vec, reconstructed, NORM_L2));
|
||||
* }
|
||||
* return pca;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* [calcCovarMatrix](#d2/de8/group__core__array_1gae6ffa9354633f984246945d52823165d}),
|
||||
* [mulTransposed](#d2/de8/group__core__array_1gadc4e49f8f7a155044e3be1b9e3b270ab}),
|
||||
* [SVD](#df/df7/classcv_1_1SVD}),
|
||||
* [dft](#d2/de8/group__core__array_1gadd6cf9baf2b8b704a11b5f04aaf4f39d}),
|
||||
* [dct](#d2/de8/group__core__array_1ga85aad4d668c01fbd64825f589e3696d4})
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core.hpp#L2393).
|
||||
*
|
||||
*/
|
||||
export declare class PCA {
|
||||
public eigenvalues: Mat;
|
||||
|
||||
public eigenvectors: Mat;
|
||||
|
||||
public mean: Mat;
|
||||
|
||||
/**
|
||||
* The default constructor initializes an empty PCA structure. The other constructors initialize the
|
||||
* structure and call [PCA::operator()()].
|
||||
*/
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param data input samples stored as matrix rows or matrix columns.
|
||||
*
|
||||
* @param mean optional mean value; if the matrix is empty (noArray()), the mean is computed from the
|
||||
* data.
|
||||
*
|
||||
* @param flags operation flags; currently the parameter is only used to specify the data layout
|
||||
* (PCA::Flags)
|
||||
*
|
||||
* @param maxComponents maximum number of components that PCA should retain; by default, all the
|
||||
* components are retained.
|
||||
*/
|
||||
public constructor(
|
||||
data: InputArray,
|
||||
mean: InputArray,
|
||||
flags: int,
|
||||
maxComponents?: int,
|
||||
);
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param data input samples stored as matrix rows or matrix columns.
|
||||
*
|
||||
* @param mean optional mean value; if the matrix is empty (noArray()), the mean is computed from the
|
||||
* data.
|
||||
*
|
||||
* @param flags operation flags; currently the parameter is only used to specify the data layout
|
||||
* (PCA::Flags)
|
||||
*
|
||||
* @param retainedVariance Percentage of variance that PCA should retain. Using this parameter will
|
||||
* let the PCA decided how many components to retain but it will always keep at least 2.
|
||||
*/
|
||||
public constructor(
|
||||
data: InputArray,
|
||||
mean: InputArray,
|
||||
flags: int,
|
||||
retainedVariance: double,
|
||||
);
|
||||
|
||||
/**
|
||||
* The methods are inverse operations to [PCA::project]. They take PC coordinates of projected
|
||||
* vectors and reconstruct the original vectors. Unless all the principal components have been
|
||||
* retained, the reconstructed vectors are different from the originals. But typically, the difference
|
||||
* is small if the number of components is large enough (but still much smaller than the original
|
||||
* vector dimensionality). As a result, [PCA] is used.
|
||||
*
|
||||
* @param vec coordinates of the vectors in the principal component subspace, the layout and size are
|
||||
* the same as of PCA::project output vectors.
|
||||
*/
|
||||
public backProject(vec: InputArray): Mat;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param vec coordinates of the vectors in the principal component subspace, the layout and size are
|
||||
* the same as of PCA::project output vectors.
|
||||
*
|
||||
* @param result reconstructed vectors; the layout and size are the same as of PCA::project input
|
||||
* vectors.
|
||||
*/
|
||||
public backProject(vec: InputArray, result: OutputArray): InputArray;
|
||||
|
||||
/**
|
||||
* The methods project one or more vectors to the principal component subspace, where each vector
|
||||
* projection is represented by coefficients in the principal component basis. The first form of the
|
||||
* method returns the matrix that the second form writes to the result. So the first form can be used
|
||||
* as a part of expression while the second form can be more efficient in a processing loop.
|
||||
*
|
||||
* @param vec input vector(s); must have the same dimensionality and the same layout as the input
|
||||
* data used at PCA phase, that is, if DATA_AS_ROW are specified, then vec.cols==data.cols (vector
|
||||
* dimensionality) and vec.rows is the number of vectors to project, and the same is true for the
|
||||
* PCA::DATA_AS_COL case.
|
||||
*/
|
||||
public project(vec: InputArray): Mat;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above
|
||||
* function only in what argument(s) it accepts.
|
||||
*
|
||||
* @param vec input vector(s); must have the same dimensionality and the same layout as the input
|
||||
* data used at PCA phase, that is, if DATA_AS_ROW are specified, then vec.cols==data.cols (vector
|
||||
* dimensionality) and vec.rows is the number of vectors to project, and the same is true for the
|
||||
* PCA::DATA_AS_COL case.
|
||||
*
|
||||
* @param result output vectors; in case of PCA::DATA_AS_COL, the output matrix has as many columns
|
||||
* as the number of input vectors, this means that result.cols==vec.cols and the number of rows match
|
||||
* the number of principal components (for example, maxComponents parameter passed to the constructor).
|
||||
*/
|
||||
public project(vec: InputArray, result: OutputArray): InputArray;
|
||||
|
||||
/**
|
||||
* Loads [eigenvalues] [eigenvectors] and [mean] from specified [FileNode]
|
||||
*/
|
||||
public read(fn: FileNode): FileNode;
|
||||
|
||||
/**
|
||||
* Writes [eigenvalues] [eigenvectors] and [mean] to specified [FileStorage]
|
||||
*/
|
||||
public write(fs: FileStorage): FileStorage;
|
||||
}
|
||||
|
||||
export declare const DATA_AS_ROW: Flags; // initializer: = 0
|
||||
|
||||
export declare const DATA_AS_COL: Flags; // initializer: = 1
|
||||
|
||||
export declare const USE_AVG: Flags; // initializer: = 2
|
||||
|
||||
export type Flags = any;
|
||||
72
opencv-js-4.10.0/src/types/opencv/RotatedRect.ts
Normal file
72
opencv-js-4.10.0/src/types/opencv/RotatedRect.ts
Normal file
|
|
@ -0,0 +1,72 @@
|
|||
import type { float, Point2f, Rect, Rect_, Size2f } from "./_types";
|
||||
|
||||
/**
|
||||
* Each rectangle is specified by the center point (mass center), length of each side (represented by
|
||||
* [Size2f](#dc/d84/group__core__basic_1gab34496d2466b5f69930ab74c70f117d4}) structure) and the
|
||||
* rotation angle in degrees.
|
||||
*
|
||||
* The sample below demonstrates how to use [RotatedRect](#db/dd6/classcv_1_1RotatedRect}):
|
||||
*
|
||||
* ```cpp
|
||||
* Mat test_image(200, 200, CV_8UC3, Scalar(0));
|
||||
* RotatedRect rRect = RotatedRect(Point2f(100,100), Size2f(100,50), 30);
|
||||
*
|
||||
* Point2f vertices[4];
|
||||
* rRect.points(vertices);
|
||||
* for (int i = 0; i < 4; i++)
|
||||
* line(test_image, vertices[i], vertices[(i+1)%4], Scalar(0,255,0), 2);
|
||||
*
|
||||
* Rect brect = rRect.boundingRect();
|
||||
* rectangle(test_image, brect, Scalar(255,0,0), 2);
|
||||
*
|
||||
* imshow("rectangles", test_image);
|
||||
* waitKey(0);
|
||||
* ```
|
||||
*
|
||||
* [CamShift](#dc/d6b/group__video__track_1gaef2bd39c8356f423124f1fe7c44d54a1}),
|
||||
* [fitEllipse](#d3/dc0/group__imgproc__shape_1gaf259efaad93098103d6c27b9e4900ffa}),
|
||||
* [minAreaRect](#d3/dc0/group__imgproc__shape_1ga3d476a3417130ae5154aea421ca7ead9}), CvBox2D
|
||||
*
|
||||
* Source:
|
||||
* [opencv2/core/types.hpp](https://github.com/opencv/opencv/tree/master/modules/core/include/opencv2/core/types.hpp#L534).
|
||||
*
|
||||
*/
|
||||
export declare class RotatedRect {
|
||||
public angle: float;
|
||||
|
||||
public center: Point2f;
|
||||
|
||||
public size: Size2f;
|
||||
|
||||
public constructor();
|
||||
|
||||
/**
|
||||
* full constructor
|
||||
*
|
||||
* @param center The rectangle mass center.
|
||||
*
|
||||
* @param size Width and height of the rectangle.
|
||||
*
|
||||
* @param angle The rotation angle in a clockwise direction. When the angle is 0, 90, 180, 270 etc.,
|
||||
* the rectangle becomes an up-right rectangle.
|
||||
*/
|
||||
public constructor(center: Point2f, size: Size2f, angle: float);
|
||||
|
||||
/**
|
||||
* Any 3 end points of the [RotatedRect]. They must be given in order (either clockwise or
|
||||
* anticlockwise).
|
||||
*/
|
||||
public constructor(point1: Point2f, point2: Point2f, point3: Point2f);
|
||||
|
||||
public boundingRect(): Rect;
|
||||
|
||||
public boundingRect2f(): Rect_;
|
||||
|
||||
/**
|
||||
* returns 4 vertices of the rectangle
|
||||
*
|
||||
* @param pts The points array for storing rectangle vertices. The order is bottomLeft, topLeft,
|
||||
* topRight, bottomRight.
|
||||
*/
|
||||
public points(pts: Point2f): Point2f;
|
||||
}
|
||||
1
opencv-js-4.10.0/src/types/opencv/Tracker.ts
Normal file
1
opencv-js-4.10.0/src/types/opencv/Tracker.ts
Normal file
|
|
@ -0,0 +1 @@
|
|||
export declare class Tracker {}
|
||||
3
opencv-js-4.10.0/src/types/opencv/TrackerMIL.ts
Normal file
3
opencv-js-4.10.0/src/types/opencv/TrackerMIL.ts
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
import type { Tracker } from "./_types";
|
||||
|
||||
export declare class TrackerMIL extends Tracker {}
|
||||
327
opencv-js-4.10.0/src/types/opencv/_hacks.ts
Normal file
327
opencv-js-4.10.0/src/types/opencv/_hacks.ts
Normal file
|
|
@ -0,0 +1,327 @@
|
|||
// Scalar, Point, Rect, etc are defined by opencv.js (helpers.js) and we need to declare them manually:
|
||||
|
||||
export declare class Range {
|
||||
public start: number;
|
||||
public end: number;
|
||||
public constructor(start: number, end: number);
|
||||
}
|
||||
|
||||
export declare class Scalar extends Array<number> {
|
||||
public static all(...v: number[]): Scalar;
|
||||
}
|
||||
// Hack: expose Mat super classes like Mat_, InputArray, Vector, OutputArray we make them alias of Mat to simplify and make it work
|
||||
export { Mat as InputArray };
|
||||
export { Mat as InputOutputArray };
|
||||
export { Mat as OutputArray };
|
||||
export { MatVector as InputArrayOfArrays };
|
||||
export { MatVector as InputOutputArrayOfArrays };
|
||||
export { MatVector as OutputArrayOfArrays };
|
||||
export { Scalar as GScalar };
|
||||
export { Point as Point2f };
|
||||
export { Point as KeyPoint };
|
||||
export { Point as Point2l };
|
||||
export { Size as Point2d };
|
||||
export { Size as Size2d };
|
||||
export { Size as Size2f };
|
||||
export { Size as Size2l };
|
||||
export { Rect as Rect_ };
|
||||
|
||||
export declare class Point {
|
||||
public constructor(x: number, y: number);
|
||||
public x: number;
|
||||
public y: number;
|
||||
}
|
||||
|
||||
export declare class Circle {
|
||||
public constructor(center: Point, radius: number);
|
||||
public center: Point;
|
||||
public radius: number;
|
||||
}
|
||||
|
||||
export declare class Size {
|
||||
public constructor(width: number, height: number);
|
||||
public width: number;
|
||||
public height: number;
|
||||
}
|
||||
|
||||
export declare class Rect {
|
||||
public constructor();
|
||||
public constructor(point: Point, size: Size);
|
||||
public constructor(x: number, y: number, width: number, height: number);
|
||||
public x: number;
|
||||
public y: number;
|
||||
public width: number;
|
||||
public height: number;
|
||||
}
|
||||
|
||||
export declare class TermCriteria {
|
||||
public type: number;
|
||||
public maxCount: number;
|
||||
public epsilon: number;
|
||||
public constructor();
|
||||
public constructor(type: number, maxCount: number, epsilon: number);
|
||||
}
|
||||
export declare const TermCriteria_EPS: any;
|
||||
export declare const TermCriteria_COUNT: any;
|
||||
export declare const TermCriteria_MAX_ITER: any;
|
||||
|
||||
export declare class MinMaxLoc {
|
||||
public minVal: number;
|
||||
public maxVal: number;
|
||||
public minLoc: Point;
|
||||
public maxLoc: Point;
|
||||
public constructor();
|
||||
public constructor(
|
||||
minVal: number,
|
||||
maxVal: number,
|
||||
minLoc: Point,
|
||||
maxLoc: Point,
|
||||
);
|
||||
}
|
||||
|
||||
// expose emscripten / opencv.js specifics
|
||||
|
||||
export declare function exceptionFromPtr(err: number): any;
|
||||
export declare function onRuntimeInitialized(): any;
|
||||
export declare function FS_createDataFile(
|
||||
arg0: string,
|
||||
path: string,
|
||||
data: Uint8Array,
|
||||
arg3: boolean,
|
||||
arg4: boolean,
|
||||
arg5: boolean,
|
||||
): any;
|
||||
|
||||
import { Algorithm, type LineTypes, Mat, type NormTypes, RotatedRect } from ".";
|
||||
import "../_cv";
|
||||
|
||||
/**
|
||||
* Base class for Contrast Limited Adaptive Histogram Equalization.
|
||||
*/
|
||||
export declare class CLAHE extends Algorithm {
|
||||
/**
|
||||
* @param clipLimit Threshold for contrast limiting. Default. 40.0,
|
||||
* @param totalGridSize Size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles. tileGridSize defines the number of tiles in row and column. Default: Size(8, 8)
|
||||
*/
|
||||
constructor(clipLimit?: double, totalGridSize?: Size);
|
||||
/**
|
||||
* Equalizes the histogram of a grayscale image using Contrast Limited Adaptive Histogram Equalization.
|
||||
* @param src Source image of type CV_8UC1 or CV_16UC1.
|
||||
* @param dst Destination image.
|
||||
*/
|
||||
apply(src: Mat, dst: Mat): void;
|
||||
collectGarbage(): void;
|
||||
/**
|
||||
* Returns threshold value for contrast limiting.
|
||||
*/
|
||||
getClipLimit(): double;
|
||||
/**
|
||||
* Returns Size defines the number of tiles in row and column.
|
||||
*/
|
||||
getTilesGridSize(): Size;
|
||||
/**
|
||||
* Sets threshold for contrast limiting.
|
||||
*/
|
||||
setClipLimit(clipLimit: double): void;
|
||||
/**
|
||||
* Sets size of grid for histogram equalization. Input image will be divided into equally sized rectangular tiles.
|
||||
* @param tileGridSize defines the number of tiles in row and column.
|
||||
*/
|
||||
setTilesGridSize(tileGridSize: Size): void;
|
||||
}
|
||||
|
||||
// emscripten embind internals
|
||||
export declare function getInheritedInstanceCount(...a: any[]): any;
|
||||
export declare function getLiveInheritedInstances(...a: any[]): any;
|
||||
export declare function flushPendingDeletes(...a: any[]): any;
|
||||
export declare function setDelayFunction(...a: any[]): any;
|
||||
|
||||
export declare class EmscriptenEmbindInstance {
|
||||
isAliasOf(other: any): bool;
|
||||
clone(): any;
|
||||
delete(): any;
|
||||
isDeleted(): boolean;
|
||||
deleteLater(): any;
|
||||
}
|
||||
|
||||
export declare class InternalError extends Error {}
|
||||
export declare class BindingError extends Error {}
|
||||
export declare class UnboundTypeError extends Error {}
|
||||
export declare class PureVirtualError extends Error {}
|
||||
|
||||
export declare class Vector<T> extends EmscriptenEmbindInstance {
|
||||
get(i: number): T;
|
||||
get(i: number, j: number, data: any): T;
|
||||
set(i: number, t: T): void;
|
||||
put(i: number, j: number, data: any): any;
|
||||
size(): number;
|
||||
push_back(n: T): any;
|
||||
resize(count: number, value?: T): void;
|
||||
}
|
||||
|
||||
export declare class Vec3d extends Vector<any> {}
|
||||
export declare class IntVector extends Vector<number> {}
|
||||
export declare class FloatVector extends Vector<number> {}
|
||||
export declare class DoubleVector extends Vector<number> {}
|
||||
export declare class PointVector extends Vector<Point> {}
|
||||
export declare class KeyPointVector extends Vector<any> {}
|
||||
export declare class DMatchVector extends Vector<any> {}
|
||||
export declare class DMatchVectorVector extends Vector<Vector<any>> {}
|
||||
export declare class MatVector extends Vector<Mat> {}
|
||||
|
||||
export declare class RectVector extends Rect implements Vector<Rect> {
|
||||
get(i: number): Rect;
|
||||
isAliasOf(...a: any[]): any;
|
||||
clone(...a: any[]): any;
|
||||
delete(...a: any[]): any;
|
||||
isDeleted(...a: any[]): any;
|
||||
deleteLater(...a: any[]): any;
|
||||
set(i: number, t: Rect): void;
|
||||
put(i: number, j: number, data: any): any;
|
||||
size(): number;
|
||||
push_back(n: Rect): void;
|
||||
resize(count: number, value?: Rect | undefined): void;
|
||||
delete(): void;
|
||||
}
|
||||
|
||||
export declare class VideoCapture {
|
||||
public constructor(videoSource: HTMLVideoElement | string);
|
||||
public read(m: Mat): any;
|
||||
public video: HTMLVideoElement;
|
||||
}
|
||||
|
||||
export type MatSize = () => Size;
|
||||
|
||||
export declare function matFromImageData(imageData: ImageData): Mat;
|
||||
export declare function matFromArray(
|
||||
rows: number,
|
||||
cols: number,
|
||||
type: any,
|
||||
array: number[] | ArrayBufferView,
|
||||
): Mat;
|
||||
|
||||
export declare class ImageData {
|
||||
data: ArrayBufferView;
|
||||
width: number;
|
||||
height: number;
|
||||
}
|
||||
|
||||
// TODO this types should be exposed by the tool - want to make it work:
|
||||
export declare const CV_8U: CVDataType;
|
||||
export declare const CV_8UC1: CVDataType;
|
||||
export declare const CV_8UC2: CVDataType;
|
||||
export declare const CV_8UC3: CVDataType;
|
||||
export declare const CV_8UC4: CVDataType;
|
||||
export declare const CV_8S: CVDataType;
|
||||
export declare const CV_8SC1: CVDataType;
|
||||
export declare const CV_8SC2: CVDataType;
|
||||
export declare const CV_8SC3: CVDataType;
|
||||
export declare const CV_8SC4: CVDataType;
|
||||
export declare const CV_16U: CVDataType;
|
||||
export declare const CV_16UC1: CVDataType;
|
||||
export declare const CV_16UC2: CVDataType;
|
||||
export declare const CV_16UC3: CVDataType;
|
||||
export declare const CV_16UC4: CVDataType;
|
||||
export declare const CV_16S: CVDataType;
|
||||
export declare const CV_16SC1: CVDataType;
|
||||
export declare const CV_16SC2: CVDataType;
|
||||
export declare const CV_16SC3: CVDataType;
|
||||
export declare const CV_16SC4: CVDataType;
|
||||
export declare const CV_32S: CVDataType;
|
||||
export declare const CV_32SC1: CVDataType;
|
||||
export declare const CV_32SC2: CVDataType;
|
||||
export declare const CV_32SC3: CVDataType;
|
||||
export declare const CV_32SC4: CVDataType;
|
||||
export declare const CV_32F: CVDataType;
|
||||
export declare const CV_32FC1: CVDataType;
|
||||
export declare const CV_32FC2: CVDataType;
|
||||
export declare const CV_32FC3: CVDataType;
|
||||
export declare const CV_32FC4: CVDataType;
|
||||
export declare const CV_64F: CVDataType;
|
||||
export declare const CV_64FC1: CVDataType;
|
||||
export declare const CV_64FC2: CVDataType;
|
||||
export declare const CV_64FC3: CVDataType;
|
||||
export declare const CV_64FC4: CVDataType;
|
||||
|
||||
export type CVDataType = any;
|
||||
|
||||
export declare function ellipse1(
|
||||
dst: Mat,
|
||||
rotatedRect: RotatedRect,
|
||||
ellipseColor: Scalar,
|
||||
arg0: number,
|
||||
line: LineTypes,
|
||||
): void;
|
||||
export declare function imread(
|
||||
canvasOrImageHtmlElement: HTMLElement | string,
|
||||
): Mat;
|
||||
export declare function norm1(a: Mat, b: Mat, type: NormTypes): number;
|
||||
export declare function imshow(
|
||||
canvasSource: HTMLElement | string,
|
||||
mat: Mat,
|
||||
): void;
|
||||
export declare function matFromArray(
|
||||
rows: number,
|
||||
cols: number,
|
||||
type: any,
|
||||
array: any,
|
||||
): Mat;
|
||||
|
||||
// Missing imports:
|
||||
export type Mat4 = any;
|
||||
export type Mat3 = any;
|
||||
export type Vec3 = any;
|
||||
export type float_type = any;
|
||||
export type int = number;
|
||||
export type bool = boolean;
|
||||
export type FileNode = any;
|
||||
export type FileStorage = any;
|
||||
export type Ptr = any;
|
||||
export type size_t = any;
|
||||
export type double = number;
|
||||
export type float = number;
|
||||
export type UMat = any;
|
||||
export type Matrix = any;
|
||||
export type BucketKey = any;
|
||||
export type Bucket = any;
|
||||
export type LshStats = any;
|
||||
export type MatAllocator = any;
|
||||
export type uchar = any;
|
||||
export type MatStep = any;
|
||||
export type UMatData = any;
|
||||
export type typename = any;
|
||||
export type Vec = any;
|
||||
export type Point_ = any;
|
||||
export type Point3_ = any;
|
||||
export type MatCommaInitializer_ = any;
|
||||
export type MatIterator_ = any;
|
||||
export type MatConstIterator_ = any;
|
||||
export type AccessFlag = any;
|
||||
export type UMatUsageFlags = any;
|
||||
export type _Tp = any;
|
||||
export type Matx_AddOp = any;
|
||||
export type Matx_SubOp = any;
|
||||
export type _T2 = any;
|
||||
export type Matx_ScaleOp = any;
|
||||
export type Matx_MulOp = any;
|
||||
export type Matx_DivOp = any;
|
||||
export type Matx_MatMulOp = any;
|
||||
export type Matx_TOp = any;
|
||||
export type diag_type = any;
|
||||
export type _EqPredicate = any;
|
||||
export type cvhalDFT = any;
|
||||
export type schar = any;
|
||||
export type ushort = any;
|
||||
export type short = any;
|
||||
export type int64 = any;
|
||||
export type ErrorCallback = any;
|
||||
export type unsigned = any;
|
||||
export type uint64 = any;
|
||||
export type float16_t = any;
|
||||
export type AsyncArray = any;
|
||||
export type Net = any;
|
||||
export type Moments = any;
|
||||
export type uint64_t = any;
|
||||
export type uint32_t = any;
|
||||
export type int32_t = any;
|
||||
export type int64_t = any;
|
||||
47
opencv-js-4.10.0/src/types/opencv/_types.ts
Normal file
47
opencv-js-4.10.0/src/types/opencv/_types.ts
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
export * from "./Affine3";
|
||||
export * from "./Algorithm";
|
||||
export * from "./AutoBuffer";
|
||||
export * from "./BFMatcher";
|
||||
export * from "./BOWTrainer";
|
||||
export * from "./calib3d";
|
||||
export * from "./CascadeClassifier";
|
||||
export * from "./core_array";
|
||||
export * from "./core_cluster";
|
||||
export * from "./core_hal_interface";
|
||||
export * from "./core_utils";
|
||||
export * from "./DescriptorMatcher";
|
||||
export * from "./dnn";
|
||||
export * from "./DynamicBitset";
|
||||
export * from "./Exception";
|
||||
export * from "./Feature2D";
|
||||
export * from "./features2d_draw";
|
||||
export * from "./fisheye";
|
||||
export * from "./FlannBasedMatcher";
|
||||
export * from "./HOGDescriptor";
|
||||
export * from "./imgproc_color_conversions";
|
||||
export * from "./imgproc_draw";
|
||||
export * from "./imgproc_feature";
|
||||
export * from "./imgproc_filter";
|
||||
export * from "./imgproc_hist";
|
||||
export * from "./imgproc_misc";
|
||||
export * from "./imgproc_object";
|
||||
export * from "./imgproc_shape";
|
||||
export * from "./imgproc_transform";
|
||||
export * from "./Logger";
|
||||
export * from "./LshTable";
|
||||
export * from "./Mat";
|
||||
export * from "./MatExpr";
|
||||
export * from "./MatOp";
|
||||
export * from "./Matx";
|
||||
export * from "./Node";
|
||||
export * from "./objdetect";
|
||||
export * from "./ORB";
|
||||
export * from "./PCA";
|
||||
export * from "./photo_inpaint";
|
||||
export * from "./RotatedRect";
|
||||
export * from "./softdouble";
|
||||
export * from "./softfloat";
|
||||
export * from "./video_track";
|
||||
export * from "./_hacks";
|
||||
export * from "./Tracker";
|
||||
export * from "./TrackerMIL";
|
||||
2937
opencv-js-4.10.0/src/types/opencv/calib3d.ts
Normal file
2937
opencv-js-4.10.0/src/types/opencv/calib3d.ts
Normal file
File diff suppressed because it is too large
Load diff
3102
opencv-js-4.10.0/src/types/opencv/core_array.ts
Normal file
3102
opencv-js-4.10.0/src/types/opencv/core_array.ts
Normal file
File diff suppressed because it is too large
Load diff
81
opencv-js-4.10.0/src/types/opencv/core_cluster.ts
Normal file
81
opencv-js-4.10.0/src/types/opencv/core_cluster.ts
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
import type {
|
||||
double,
|
||||
InputArray,
|
||||
InputOutputArray,
|
||||
int,
|
||||
OutputArray,
|
||||
TermCriteria,
|
||||
_EqPredicate,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Clustering
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* The function kmeans implements a k-means algorithm that finds the centers of cluster_count clusters
|
||||
* and groups the input samples around the clusters. As an output, `$\\texttt{bestLabels}_i$` contains
|
||||
* a 0-based cluster index for the sample stored in the `$i^{th}$` row of the samples matrix.
|
||||
*
|
||||
* (Python) An example on K-means clustering can be found at
|
||||
* opencv_source_code/samples/python/kmeans.py
|
||||
*
|
||||
* The function returns the compactness measure that is computed as `\\[\\sum _i \\| \\texttt{samples}
|
||||
* _i - \\texttt{centers} _{ \\texttt{labels} _i} \\| ^2\\]` after every attempt. The best (minimum)
|
||||
* value is chosen and the corresponding labels and the compactness value are returned by the function.
|
||||
* Basically, you can use only the core of the function, set the number of attempts to 1, initialize
|
||||
* labels each time using a custom algorithm, pass them with the ( flags = [KMEANS_USE_INITIAL_LABELS]
|
||||
* ) flag, and then choose the best (most-compact) clustering.
|
||||
*
|
||||
* @param data Data for clustering. An array of N-Dimensional points with float coordinates is needed.
|
||||
* Examples of this array can be:
|
||||
* Mat points(count, 2, CV_32F);Mat points(count, 1, CV_32FC2);Mat points(1, count,
|
||||
* CV_32FC2);std::vector<cv::Point2f> points(sampleCount);
|
||||
*
|
||||
* @param K Number of clusters to split the set by.
|
||||
*
|
||||
* @param bestLabels Input/output integer array that stores the cluster indices for every sample.
|
||||
*
|
||||
* @param criteria The algorithm termination criteria, that is, the maximum number of iterations and/or
|
||||
* the desired accuracy. The accuracy is specified as criteria.epsilon. As soon as each of the cluster
|
||||
* centers moves by less than criteria.epsilon on some iteration, the algorithm stops.
|
||||
*
|
||||
* @param attempts Flag to specify the number of times the algorithm is executed using different
|
||||
* initial labellings. The algorithm returns the labels that yield the best compactness (see the last
|
||||
* function parameter).
|
||||
*
|
||||
* @param flags Flag that can take values of cv::KmeansFlags
|
||||
*
|
||||
* @param centers Output matrix of the cluster centers, one row per each cluster center.
|
||||
*/
|
||||
export declare function kmeans(
|
||||
data: InputArray,
|
||||
K: int,
|
||||
bestLabels: InputOutputArray,
|
||||
criteria: TermCriteria,
|
||||
attempts: int,
|
||||
flags: int,
|
||||
centers?: OutputArray,
|
||||
): double;
|
||||
|
||||
/**
|
||||
* The generic function partition implements an `$O(N^2)$` algorithm for splitting a set of `$N$`
|
||||
* elements into one or more equivalency classes, as described in . The function returns the number of
|
||||
* equivalency classes.
|
||||
*
|
||||
* @param _vec Set of elements stored as a vector.
|
||||
*
|
||||
* @param labels Output vector of labels. It contains as many elements as vec. Each label labels[i] is
|
||||
* a 0-based cluster index of vec[i].
|
||||
*
|
||||
* @param predicate Equivalence predicate (pointer to a boolean function of two arguments or an
|
||||
* instance of the class that has the method bool operator()(const _Tp& a, const _Tp& b) ). The
|
||||
* predicate returns true when the elements are certainly in the same class, and returns false if they
|
||||
* may or may not be in the same class.
|
||||
*/
|
||||
export declare function partition(
|
||||
arg119: any,
|
||||
arg120: any,
|
||||
_vec: any,
|
||||
labels: any,
|
||||
predicate?: _EqPredicate,
|
||||
): any;
|
||||
159
opencv-js-4.10.0/src/types/opencv/core_hal_interface.ts
Normal file
159
opencv-js-4.10.0/src/types/opencv/core_hal_interface.ts
Normal file
|
|
@ -0,0 +1,159 @@
|
|||
import type { cvhalDFT, int, size_t, uchar } from "./_types";
|
||||
/*
|
||||
* # Interface
|
||||
* Define your functions to override default implementations:
|
||||
*
|
||||
* ```cpp
|
||||
* #undef hal_add8u
|
||||
* #define hal_add8u my_add8u
|
||||
* ```
|
||||
*/
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*
|
||||
* @param src_data source image data and step
|
||||
*
|
||||
* @param dst_data destination image data and step
|
||||
*/
|
||||
export declare function hal_ni_dct2D(
|
||||
context: cvhalDFT,
|
||||
src_data: uchar,
|
||||
src_step: size_t,
|
||||
dst_data: uchar,
|
||||
dst_step: size_t,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*/
|
||||
export declare function hal_ni_dctFree2D(context: cvhalDFT): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context double pointer to context storing all necessary data
|
||||
*
|
||||
* @param width image dimensions
|
||||
*
|
||||
* @param depth image type (CV_32F or CV64F)
|
||||
*
|
||||
* @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, ...)
|
||||
*/
|
||||
export declare function hal_ni_dctInit2D(
|
||||
context: cvhalDFT,
|
||||
width: int,
|
||||
height: int,
|
||||
depth: int,
|
||||
flags: int,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*
|
||||
* @param src source data
|
||||
*
|
||||
* @param dst destination data
|
||||
*/
|
||||
export declare function hal_ni_dft1D(
|
||||
context: cvhalDFT,
|
||||
src: uchar,
|
||||
dst: uchar,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*
|
||||
* @param src_data source image data and step
|
||||
*
|
||||
* @param dst_data destination image data and step
|
||||
*/
|
||||
export declare function hal_ni_dft2D(
|
||||
context: cvhalDFT,
|
||||
src_data: uchar,
|
||||
src_step: size_t,
|
||||
dst_data: uchar,
|
||||
dst_step: size_t,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*/
|
||||
export declare function hal_ni_dftFree1D(context: cvhalDFT): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context pointer to context storing all necessary data
|
||||
*/
|
||||
export declare function hal_ni_dftFree2D(context: cvhalDFT): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context double pointer to context storing all necessary data
|
||||
*
|
||||
* @param len transformed array length
|
||||
*
|
||||
* @param count estimated transformation count
|
||||
*
|
||||
* @param depth array type (CV_32F or CV_64F)
|
||||
*
|
||||
* @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, CV_HAL_DFT_SCALE, ...)
|
||||
*
|
||||
* @param needBuffer pointer to boolean variable, if valid pointer provided, then variable value should
|
||||
* be set to true to signal that additional memory buffer is needed for operations
|
||||
*/
|
||||
export declare function hal_ni_dftInit1D(
|
||||
context: cvhalDFT,
|
||||
len: int,
|
||||
count: int,
|
||||
depth: int,
|
||||
flags: int,
|
||||
needBuffer: any,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param context double pointer to context storing all necessary data
|
||||
*
|
||||
* @param width image dimensions
|
||||
*
|
||||
* @param depth image type (CV_32F or CV64F)
|
||||
*
|
||||
* @param src_channels number of channels in input image
|
||||
*
|
||||
* @param dst_channels number of channels in output image
|
||||
*
|
||||
* @param flags algorithm options (combination of CV_HAL_DFT_INVERSE, ...)
|
||||
*
|
||||
* @param nonzero_rows number of nonzero rows in image, can be used for optimization
|
||||
*/
|
||||
export declare function hal_ni_dftInit2D(
|
||||
context: cvhalDFT,
|
||||
width: int,
|
||||
height: int,
|
||||
depth: int,
|
||||
src_channels: int,
|
||||
dst_channels: int,
|
||||
flags: int,
|
||||
nonzero_rows: int,
|
||||
): cvhalDFT;
|
||||
|
||||
/**
|
||||
* @param src_data Source image
|
||||
*
|
||||
* @param width Source image dimensions
|
||||
*
|
||||
* @param depth Depth of source image
|
||||
*
|
||||
* @param minVal Pointer to the returned global minimum and maximum in an array.
|
||||
*
|
||||
* @param minIdx Pointer to the returned minimum and maximum location.
|
||||
*
|
||||
* @param mask Specified array region.
|
||||
*/
|
||||
export declare function hal_ni_minMaxIdx(
|
||||
src_data: uchar,
|
||||
src_step: size_t,
|
||||
width: int,
|
||||
height: int,
|
||||
depth: int,
|
||||
minVal: any,
|
||||
maxVal: any,
|
||||
minIdx: any,
|
||||
maxIdx: any,
|
||||
mask: uchar,
|
||||
): uchar;
|
||||
748
opencv-js-4.10.0/src/types/opencv/core_utils.ts
Normal file
748
opencv-js-4.10.0/src/types/opencv/core_utils.ts
Normal file
|
|
@ -0,0 +1,748 @@
|
|||
import type {
|
||||
AsyncArray,
|
||||
bool,
|
||||
double,
|
||||
ErrorCallback,
|
||||
float,
|
||||
float16_t,
|
||||
InputArray,
|
||||
InputArrayOfArrays,
|
||||
InputOutputArray,
|
||||
InputOutputArrayOfArrays,
|
||||
int,
|
||||
int64,
|
||||
schar,
|
||||
short,
|
||||
size_t,
|
||||
uchar,
|
||||
uint64,
|
||||
unsigned,
|
||||
ushort,
|
||||
_Tp,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Utility and system functions and macros
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* The function returns the aligned pointer of the same type as the input pointer:
|
||||
* `\\[\\texttt{(_Tp*)(((size_t)ptr + n-1) & -n)}\\]`
|
||||
*
|
||||
* @param ptr Aligned pointer.
|
||||
*
|
||||
* @param n Alignment size that must be a power of two.
|
||||
*/
|
||||
export declare function alignPtr(arg92: any, ptr: any, n?: int): any;
|
||||
|
||||
/**
|
||||
* The function returns the minimum number that is greater than or equal to sz and is divisible by n :
|
||||
* `\\[\\texttt{(sz + n-1) & -n}\\]`
|
||||
*
|
||||
* @param sz Buffer size to align.
|
||||
*
|
||||
* @param n Alignment size that must be a power of two.
|
||||
*/
|
||||
export declare function alignSize(sz: size_t, n: int): size_t;
|
||||
|
||||
/**
|
||||
* The function returns true if the host hardware supports the specified feature. When user calls
|
||||
* setUseOptimized(false), the subsequent calls to [checkHardwareSupport()] will return false until
|
||||
* setUseOptimized(true) is called. This way user can dynamically switch on and off the optimized code
|
||||
* in OpenCV.
|
||||
*
|
||||
* @param feature The feature of interest, one of cv::CpuFeatures
|
||||
*/
|
||||
export declare function checkHardwareSupport(feature: int): bool;
|
||||
|
||||
/**
|
||||
* proxy for hal::Cholesky
|
||||
*/
|
||||
export declare function Cholesky(
|
||||
A: any,
|
||||
astep: size_t,
|
||||
m: int,
|
||||
b: any,
|
||||
bstep: size_t,
|
||||
n: int,
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* proxy for hal::Cholesky
|
||||
*/
|
||||
export declare function Cholesky(
|
||||
A: any,
|
||||
astep: size_t,
|
||||
m: int,
|
||||
b: any,
|
||||
bstep: size_t,
|
||||
n: int,
|
||||
): bool;
|
||||
|
||||
/**
|
||||
* The function cubeRoot computes `$\\sqrt[3]{\\texttt{val}}$`. Negative arguments are handled
|
||||
* correctly. NaN and Inf are not handled. The accuracy approaches the maximum possible accuracy for
|
||||
* single-precision data.
|
||||
*
|
||||
* @param val A function argument.
|
||||
*/
|
||||
export declare function cubeRoot(val: float): float;
|
||||
|
||||
export declare function cv_abs(arg93: any, x: _Tp): any;
|
||||
|
||||
export declare function cv_abs(x: uchar): uchar;
|
||||
|
||||
export declare function cv_abs(x: schar): schar;
|
||||
|
||||
export declare function cv_abs(x: ushort): ushort;
|
||||
|
||||
export declare function cv_abs(x: short): int;
|
||||
|
||||
export declare function CV_XADD(addr: any, delta: int): any;
|
||||
|
||||
/**
|
||||
* The function computes an integer i such that: `\\[i \\le \\texttt{value} < i+1\\]`
|
||||
*
|
||||
* @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the result
|
||||
* is not defined.
|
||||
*/
|
||||
export declare function cvCeil(value: double): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvCeil(value: float): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvCeil(value: int): int;
|
||||
|
||||
/**
|
||||
* The function computes an integer i such that: `\\[i \\le \\texttt{value} < i+1\\]`
|
||||
*
|
||||
* @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the result
|
||||
* is not defined.
|
||||
*/
|
||||
export declare function cvFloor(value: double): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvFloor(value: float): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvFloor(value: int): int;
|
||||
|
||||
/**
|
||||
* The function returns 1 if the argument is a plus or minus infinity (as defined by IEEE754 standard)
|
||||
* and 0 otherwise.
|
||||
*
|
||||
* @param value The input floating-point value
|
||||
*/
|
||||
export declare function cvIsInf(value: double): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvIsInf(value: float): int;
|
||||
|
||||
/**
|
||||
* The function returns 1 if the argument is Not A Number (as defined by IEEE754 standard), 0
|
||||
* otherwise.
|
||||
*
|
||||
* @param value The input floating-point value
|
||||
*/
|
||||
export declare function cvIsNaN(value: double): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvIsNaN(value: float): int;
|
||||
|
||||
/**
|
||||
* @param value floating-point number. If the value is outside of INT_MIN ... INT_MAX range, the result
|
||||
* is not defined.
|
||||
*/
|
||||
export declare function cvRound(value: double): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvRound(value: float): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function cvRound(value: int): int;
|
||||
|
||||
/**
|
||||
* Use this function instead of `ceil((float)a / b)` expressions.
|
||||
*
|
||||
* [alignSize]
|
||||
*/
|
||||
export declare function divUp(a: int, b: any): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function divUp(a: size_t, b: any): size_t;
|
||||
|
||||
export declare function dumpInputArray(argument: InputArray): String;
|
||||
|
||||
export declare function dumpInputArrayOfArrays(
|
||||
argument: InputArrayOfArrays,
|
||||
): String;
|
||||
|
||||
export declare function dumpInputOutputArray(
|
||||
argument: InputOutputArray,
|
||||
): String;
|
||||
|
||||
export declare function dumpInputOutputArrayOfArrays(
|
||||
argument: InputOutputArrayOfArrays,
|
||||
): String;
|
||||
|
||||
/**
|
||||
* By default the function prints information about the error to stderr, then it either stops if
|
||||
* [cv::setBreakOnError()] had been called before or raises the exception. It is possible to alternate
|
||||
* error processing by using [redirectError()].
|
||||
*
|
||||
* @param exc the exception raisen.
|
||||
*/
|
||||
export declare function error(exc: any): void;
|
||||
|
||||
/**
|
||||
* By default the function prints information about the error to stderr, then it either stops if
|
||||
* [setBreakOnError()] had been called before or raises the exception. It is possible to alternate
|
||||
* error processing by using [redirectError()].
|
||||
*
|
||||
* [CV_Error], [CV_Error_], [CV_Assert], [CV_DbgAssert]
|
||||
*
|
||||
* @param _code - error code (Error::Code)
|
||||
*
|
||||
* @param _err - error description
|
||||
*
|
||||
* @param _func - function name. Available only when the compiler supports getting it
|
||||
*
|
||||
* @param _file - source file name where the error has occurred
|
||||
*
|
||||
* @param _line - line number in the source file where the error has occurred
|
||||
*/
|
||||
export declare function error(
|
||||
_code: int,
|
||||
_err: any,
|
||||
_func: any,
|
||||
_file: any,
|
||||
_line: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function fastAtan2 calculates the full-range angle of an input 2D vector. The angle is measured
|
||||
* in degrees and varies from 0 to 360 degrees. The accuracy is about 0.3 degrees.
|
||||
*
|
||||
* @param y y-coordinate of the vector.
|
||||
*
|
||||
* @param x x-coordinate of the vector.
|
||||
*/
|
||||
export declare function fastAtan2(y: float, x: float): float;
|
||||
|
||||
/**
|
||||
* The function deallocates the buffer allocated with fastMalloc . If NULL pointer is passed, the
|
||||
* function does nothing. C version of the function clears the pointer *pptr* to avoid problems with
|
||||
* double memory deallocation.
|
||||
*
|
||||
* @param ptr Pointer to the allocated buffer.
|
||||
*/
|
||||
export declare function fastFree(ptr: any): void;
|
||||
|
||||
/**
|
||||
* The function allocates the buffer of the specified size and returns it. When the buffer size is 16
|
||||
* bytes or more, the returned buffer is aligned to 16 bytes.
|
||||
*
|
||||
* @param bufSize Allocated buffer size.
|
||||
*/
|
||||
export declare function fastMalloc(bufSize: size_t): any;
|
||||
|
||||
export declare function forEach_impl(
|
||||
arg94: any,
|
||||
arg95: any,
|
||||
operation: any,
|
||||
): any;
|
||||
|
||||
/**
|
||||
* Returned value is raw cmake output including version control system revision, compiler version,
|
||||
* compiler flags, enabled modules and third party libraries, etc. Output format depends on target
|
||||
* architecture.
|
||||
*/
|
||||
export declare function getBuildInformation(): any;
|
||||
|
||||
/**
|
||||
* Returned value is a string containing space separated list of CPU features with following markers:
|
||||
*
|
||||
* no markers - baseline features
|
||||
* prefix `*` - features enabled in dispatcher
|
||||
* suffix `?` - features enabled but not available in HW
|
||||
*
|
||||
* Example: `SSE SSE2 SSE3 *SSE4.1 *SSE4.2 *FP16 *AVX *AVX2 *AVX512-SKX?`
|
||||
*/
|
||||
export declare function getCPUFeaturesLine(): any;
|
||||
|
||||
/**
|
||||
* The function returns the current number of CPU ticks on some architectures (such as x86, x64,
|
||||
* PowerPC). On other platforms the function is equivalent to getTickCount. It can also be used for
|
||||
* very accurate time measurements, as well as for [RNG] initialization. Note that in case of multi-CPU
|
||||
* systems a thread, from which getCPUTickCount is called, can be suspended and resumed at another CPU
|
||||
* with its own counter. So, theoretically (and practically) the subsequent calls to the function do
|
||||
* not necessary return the monotonously increasing values. Also, since a modern CPU varies the CPU
|
||||
* frequency depending on the load, the number of CPU clocks spent in some code cannot be directly
|
||||
* converted to time units. Therefore, getTickCount is generally a preferable solution for measuring
|
||||
* execution time.
|
||||
*/
|
||||
export declare function getCPUTickCount(): int64;
|
||||
|
||||
export declare function getElemSize(type: int): size_t;
|
||||
|
||||
/**
|
||||
* Returns empty string if feature is not defined
|
||||
*/
|
||||
export declare function getHardwareFeatureName(feature: int): String;
|
||||
|
||||
export declare function getNumberOfCPUs(): int;
|
||||
|
||||
/**
|
||||
* Always returns 1 if OpenCV is built without threading support.
|
||||
*
|
||||
* The exact meaning of return value depends on the threading framework used by OpenCV library:
|
||||
*
|
||||
* `TBB` - The number of threads, that OpenCV will try to use for parallel regions. If there is any
|
||||
* tbb::thread_scheduler_init in user code conflicting with OpenCV, then function returns default
|
||||
* number of threads used by TBB library.
|
||||
* `OpenMP` - An upper bound on the number of threads that could be used to form a new team.
|
||||
* `Concurrency` - The number of threads, that OpenCV will try to use for parallel regions.
|
||||
* `GCD` - Unsupported; returns the GCD thread pool limit (512) for compatibility.
|
||||
* `C=` - The number of threads, that OpenCV will try to use for parallel regions, if before called
|
||||
* setNumThreads with threads > 0, otherwise returns the number of logical CPUs, available for the
|
||||
* process.
|
||||
*
|
||||
* [setNumThreads], [getThreadNum]
|
||||
*/
|
||||
export declare function getNumThreads(): int;
|
||||
|
||||
/**
|
||||
* The exact meaning of the return value depends on the threading framework used by OpenCV library:
|
||||
*
|
||||
* `TBB` - Unsupported with current 4.1 TBB release. Maybe will be supported in future.
|
||||
* `OpenMP` - The thread number, within the current team, of the calling thread.
|
||||
* `Concurrency` - An ID for the virtual processor that the current context is executing on (0 for
|
||||
* master thread and unique number for others, but not necessary 1,2,3,...).
|
||||
* `GCD` - System calling thread's ID. Never returns 0 inside parallel region.
|
||||
* `C=` - The index of the current parallel task.
|
||||
*
|
||||
* [setNumThreads], [getNumThreads]
|
||||
*/
|
||||
export declare function getThreadNum(): int;
|
||||
|
||||
/**
|
||||
* The function returns the number of ticks after the certain event (for example, when the machine was
|
||||
* turned on). It can be used to initialize [RNG] or to measure a function execution time by reading
|
||||
* the tick count before and after the function call.
|
||||
*
|
||||
* [getTickFrequency], [TickMeter]
|
||||
*/
|
||||
export declare function getTickCount(): int64;
|
||||
|
||||
/**
|
||||
* The function returns the number of ticks per second. That is, the following code computes the
|
||||
* execution time in seconds:
|
||||
*
|
||||
* ```cpp
|
||||
* double t = (double)getTickCount();
|
||||
* // do something ...
|
||||
* t = ((double)getTickCount() - t)/getTickFrequency();
|
||||
* ```
|
||||
*
|
||||
* [getTickCount], [TickMeter]
|
||||
*/
|
||||
export declare function getTickFrequency(): double;
|
||||
|
||||
export declare function getVersionMajor(): int;
|
||||
|
||||
export declare function getVersionMinor(): int;
|
||||
|
||||
export declare function getVersionRevision(): int;
|
||||
|
||||
/**
|
||||
* For example "3.4.1-dev".
|
||||
*
|
||||
* getMajorVersion, getMinorVersion, getRevisionVersion
|
||||
*/
|
||||
export declare function getVersionString(): String;
|
||||
|
||||
export declare function glob(
|
||||
pattern: String,
|
||||
result: any,
|
||||
recursive?: bool,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* proxy for hal::LU
|
||||
*/
|
||||
export declare function LU(
|
||||
A: any,
|
||||
astep: size_t,
|
||||
m: int,
|
||||
b: any,
|
||||
bstep: size_t,
|
||||
n: int,
|
||||
): int;
|
||||
|
||||
/**
|
||||
* proxy for hal::LU
|
||||
*/
|
||||
export declare function LU(
|
||||
A: any,
|
||||
astep: size_t,
|
||||
m: int,
|
||||
b: any,
|
||||
bstep: size_t,
|
||||
n: int,
|
||||
): int;
|
||||
|
||||
export declare function normInf(arg96: any, arg97: any, a: any, n: int): any;
|
||||
|
||||
export declare function normInf(
|
||||
arg98: any,
|
||||
arg99: any,
|
||||
a: any,
|
||||
b: any,
|
||||
n: int,
|
||||
): any;
|
||||
|
||||
export declare function normL1(arg100: any, arg101: any, a: any, n: int): any;
|
||||
|
||||
export declare function normL1(
|
||||
arg102: any,
|
||||
arg103: any,
|
||||
a: any,
|
||||
b: any,
|
||||
n: int,
|
||||
): any;
|
||||
|
||||
export declare function normL1(a: any, b: any, n: int): float;
|
||||
|
||||
export declare function normL1(a: uchar, b: uchar, n: int): uchar;
|
||||
|
||||
export declare function normL2Sqr(
|
||||
arg104: any,
|
||||
arg105: any,
|
||||
a: any,
|
||||
n: int,
|
||||
): any;
|
||||
|
||||
export declare function normL2Sqr(
|
||||
arg106: any,
|
||||
arg107: any,
|
||||
a: any,
|
||||
b: any,
|
||||
n: int,
|
||||
): any;
|
||||
|
||||
export declare function normL2Sqr(a: any, b: any, n: int): float;
|
||||
|
||||
export declare function parallel_for_(
|
||||
range: any,
|
||||
body: any,
|
||||
nstripes?: double,
|
||||
): void;
|
||||
|
||||
export declare function parallel_for_(
|
||||
range: any,
|
||||
functor: any,
|
||||
nstripes?: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function sets the new error handler, called from [cv::error()].
|
||||
*
|
||||
* the previous error handler
|
||||
*
|
||||
* @param errCallback the new error handler. If NULL, the default error handler is used.
|
||||
*
|
||||
* @param userdata the optional user data pointer, passed to the callback.
|
||||
*
|
||||
* @param prevUserdata the optional output parameter where the previous user data pointer is stored
|
||||
*/
|
||||
export declare function redirectError(
|
||||
errCallback: ErrorCallback,
|
||||
userdata?: any,
|
||||
prevUserdata?: any,
|
||||
): ErrorCallback;
|
||||
|
||||
/**
|
||||
* Use this function instead of `ceil((float)a / b) * b` expressions.
|
||||
*
|
||||
* [divUp]
|
||||
*/
|
||||
export declare function roundUp(a: int, b: any): int;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function roundUp(a: size_t, b: any): size_t;
|
||||
|
||||
/**
|
||||
* The function saturate_cast resembles the standard C++ cast operations, such as static_cast<T>() and
|
||||
* others. It perform an efficient and accurate conversion from one primitive type to another (see the
|
||||
* introduction chapter). saturate in the name means that when the input value v is out of the range of
|
||||
* the target type, the result is not formed just by taking low bits of the input, but instead the
|
||||
* value is clipped. For example:
|
||||
*
|
||||
* ```cpp
|
||||
* uchar a = saturate_cast<uchar>(-100); // a = 0 (UCHAR_MIN)
|
||||
* short b = saturate_cast<short>(33333.33333); // b = 32767 (SHRT_MAX)
|
||||
* ```
|
||||
*
|
||||
* Such clipping is done when the target type is unsigned char , signed char , unsigned short or
|
||||
* signed short . For 32-bit integers, no clipping is done.
|
||||
*
|
||||
* When the parameter is a floating-point value and the target type is an integer (8-, 16- or 32-bit),
|
||||
* the floating-point value is first rounded to the nearest integer and then clipped if needed (when
|
||||
* the target type is 8- or 16-bit).
|
||||
*
|
||||
* This operation is used in the simplest or most complex image processing functions in OpenCV.
|
||||
*
|
||||
* [add], [subtract], [multiply], [divide], [Mat::convertTo]
|
||||
*
|
||||
* @param v Function parameter.
|
||||
*/
|
||||
export declare function saturate_cast(arg108: any, v: uchar): uchar;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg109: any, v: schar): schar;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg110: any, v: ushort): ushort;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg111: any, v: short): any;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg112: any, v: unsigned): any;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg113: any, v: int): any;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg114: any, v: float): any;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg115: any, v: double): any;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg116: any, v: int64): int64;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg117: any, v: uint64): uint64;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function saturate_cast(arg118: any, v: float16_t): any;
|
||||
|
||||
/**
|
||||
* When the break-on-error mode is set, the default error handler issues a hardware exception, which
|
||||
* can make debugging more convenient.
|
||||
*
|
||||
* the previous state
|
||||
*/
|
||||
export declare function setBreakOnError(flag: bool): bool;
|
||||
|
||||
/**
|
||||
* If threads == 0, OpenCV will disable threading optimizations and run all it's functions
|
||||
* sequentially. Passing threads < 0 will reset threads number to system default. This function must be
|
||||
* called outside of parallel region.
|
||||
*
|
||||
* OpenCV will try to run its functions with specified threads number, but some behaviour differs from
|
||||
* framework:
|
||||
*
|
||||
* `TBB` - User-defined parallel constructions will run with the same threads number, if another is not
|
||||
* specified. If later on user creates his own scheduler, OpenCV will use it.
|
||||
* `OpenMP` - No special defined behaviour.
|
||||
* `Concurrency` - If threads == 1, OpenCV will disable threading optimizations and run its functions
|
||||
* sequentially.
|
||||
* `GCD` - Supports only values <= 0.
|
||||
* `C=` - No special defined behaviour.
|
||||
*
|
||||
* [getNumThreads], [getThreadNum]
|
||||
*
|
||||
* @param nthreads Number of threads used by OpenCV.
|
||||
*/
|
||||
export declare function setNumThreads(nthreads: int): void;
|
||||
|
||||
/**
|
||||
* The function can be used to dynamically turn on and off optimized dispatched code (code that uses
|
||||
* SSE4.2, AVX/AVX2, and other instructions on the platforms that support it). It sets a global flag
|
||||
* that is further checked by OpenCV functions. Since the flag is not checked in the inner OpenCV
|
||||
* loops, it is only safe to call the function on the very top level in your application where you can
|
||||
* be sure that no other OpenCV function is currently executed.
|
||||
*
|
||||
* By default, the optimized code is enabled unless you disable it in CMake. The current status can be
|
||||
* retrieved using useOptimized.
|
||||
*
|
||||
* @param onoff The boolean flag specifying whether the optimized code should be used (onoff=true) or
|
||||
* not (onoff=false).
|
||||
*/
|
||||
export declare function setUseOptimized(onoff: bool): void;
|
||||
|
||||
export declare function tempfile(suffix?: any): String;
|
||||
|
||||
export declare function testAsyncArray(argument: InputArray): AsyncArray;
|
||||
|
||||
export declare function testAsyncException(): AsyncArray;
|
||||
|
||||
/**
|
||||
* The function returns true if the optimized code is enabled. Otherwise, it returns false.
|
||||
*/
|
||||
export declare function useOptimized(): bool;
|
||||
|
||||
export declare const CPU_MMX: CpuFeatures; // initializer: = 1
|
||||
|
||||
export declare const CPU_SSE: CpuFeatures; // initializer: = 2
|
||||
|
||||
export declare const CPU_SSE2: CpuFeatures; // initializer: = 3
|
||||
|
||||
export declare const CPU_SSE3: CpuFeatures; // initializer: = 4
|
||||
|
||||
export declare const CPU_SSSE3: CpuFeatures; // initializer: = 5
|
||||
|
||||
export declare const CPU_SSE4_1: CpuFeatures; // initializer: = 6
|
||||
|
||||
export declare const CPU_SSE4_2: CpuFeatures; // initializer: = 7
|
||||
|
||||
export declare const CPU_POPCNT: CpuFeatures; // initializer: = 8
|
||||
|
||||
export declare const CPU_FP16: CpuFeatures; // initializer: = 9
|
||||
|
||||
export declare const CPU_AVX: CpuFeatures; // initializer: = 10
|
||||
|
||||
export declare const CPU_AVX2: CpuFeatures; // initializer: = 11
|
||||
|
||||
export declare const CPU_FMA3: CpuFeatures; // initializer: = 12
|
||||
|
||||
export declare const CPU_AVX_512F: CpuFeatures; // initializer: = 13
|
||||
|
||||
export declare const CPU_AVX_512BW: CpuFeatures; // initializer: = 14
|
||||
|
||||
export declare const CPU_AVX_512CD: CpuFeatures; // initializer: = 15
|
||||
|
||||
export declare const CPU_AVX_512DQ: CpuFeatures; // initializer: = 16
|
||||
|
||||
export declare const CPU_AVX_512ER: CpuFeatures; // initializer: = 17
|
||||
|
||||
export declare const CPU_AVX_512IFMA512: CpuFeatures; // initializer: = 18
|
||||
|
||||
export declare const CPU_AVX_512IFMA: CpuFeatures; // initializer: = 18
|
||||
|
||||
export declare const CPU_AVX_512PF: CpuFeatures; // initializer: = 19
|
||||
|
||||
export declare const CPU_AVX_512VBMI: CpuFeatures; // initializer: = 20
|
||||
|
||||
export declare const CPU_AVX_512VL: CpuFeatures; // initializer: = 21
|
||||
|
||||
export declare const CPU_AVX_512VBMI2: CpuFeatures; // initializer: = 22
|
||||
|
||||
export declare const CPU_AVX_512VNNI: CpuFeatures; // initializer: = 23
|
||||
|
||||
export declare const CPU_AVX_512BITALG: CpuFeatures; // initializer: = 24
|
||||
|
||||
export declare const CPU_AVX_512VPOPCNTDQ: CpuFeatures; // initializer: = 25
|
||||
|
||||
export declare const CPU_AVX_5124VNNIW: CpuFeatures; // initializer: = 26
|
||||
|
||||
export declare const CPU_AVX_5124FMAPS: CpuFeatures; // initializer: = 27
|
||||
|
||||
export declare const CPU_NEON: CpuFeatures; // initializer: = 100
|
||||
|
||||
export declare const CPU_VSX: CpuFeatures; // initializer: = 200
|
||||
|
||||
export declare const CPU_VSX3: CpuFeatures; // initializer: = 201
|
||||
|
||||
export declare const CPU_AVX512_SKX: CpuFeatures; // initializer: = 256
|
||||
|
||||
export declare const CPU_AVX512_COMMON: CpuFeatures; // initializer: = 257
|
||||
|
||||
export declare const CPU_AVX512_KNL: CpuFeatures; // initializer: = 258
|
||||
|
||||
export declare const CPU_AVX512_KNM: CpuFeatures; // initializer: = 259
|
||||
|
||||
export declare const CPU_AVX512_CNL: CpuFeatures; // initializer: = 260
|
||||
|
||||
export declare const CPU_AVX512_CEL: CpuFeatures; // initializer: = 261
|
||||
|
||||
export declare const CPU_AVX512_ICL: CpuFeatures; // initializer: = 262
|
||||
|
||||
export declare const CPU_MAX_FEATURE: CpuFeatures; // initializer: = 512
|
||||
|
||||
export declare const SORT_EVERY_ROW: SortFlags; // initializer: = 0
|
||||
|
||||
/**
|
||||
* each matrix column is sorted independently; this flag and the previous one are mutually exclusive.
|
||||
*
|
||||
*/
|
||||
export declare const SORT_EVERY_COLUMN: SortFlags; // initializer: = 1
|
||||
|
||||
/**
|
||||
* each matrix row is sorted in the ascending order.
|
||||
*
|
||||
*/
|
||||
export declare const SORT_ASCENDING: SortFlags; // initializer: = 0
|
||||
|
||||
/**
|
||||
* each matrix row is sorted in the descending order; this flag and the previous one are also mutually
|
||||
* exclusive.
|
||||
*
|
||||
*/
|
||||
export declare const SORT_DESCENDING: SortFlags; // initializer: = 16
|
||||
|
||||
export type CpuFeatures = any;
|
||||
|
||||
export type SortFlags = any;
|
||||
505
opencv-js-4.10.0/src/types/opencv/dnn.ts
Normal file
505
opencv-js-4.10.0/src/types/opencv/dnn.ts
Normal file
|
|
@ -0,0 +1,505 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
InputArray,
|
||||
InputArrayOfArrays,
|
||||
int,
|
||||
Mat,
|
||||
Net,
|
||||
OutputArray,
|
||||
OutputArrayOfArrays,
|
||||
Size,
|
||||
size_t,
|
||||
uchar,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Deep Neural Network module
|
||||
* This module contains:
|
||||
*
|
||||
*
|
||||
*
|
||||
* * API for new layers creation, layers are building bricks of neural networks;
|
||||
* * set of built-in most-useful Layers;
|
||||
* * API to construct and modify comprehensive neural networks from layers;
|
||||
* * functionality for loading serialized networks models from different frameworks.
|
||||
*
|
||||
*
|
||||
* Functionality of this module is designed only for forward pass computations (i.e. network testing). A network training is in principle not supported.
|
||||
*/
|
||||
/**
|
||||
* if `crop` is true, input image is resized so one side after resize is equal to corresponding
|
||||
* dimension in `size` and another one is equal or larger. Then, crop from the center is performed. If
|
||||
* `crop` is false, direct resize without cropping and preserving aspect ratio is performed.
|
||||
*
|
||||
* 4-dimensional [Mat] with NCHW dimensions order.
|
||||
*
|
||||
* @param image input image (with 1-, 3- or 4-channels).
|
||||
*
|
||||
* @param scalefactor multiplier for image values.
|
||||
*
|
||||
* @param size spatial size for output image
|
||||
*
|
||||
* @param mean scalar with mean values which are subtracted from channels. Values are intended to be in
|
||||
* (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
|
||||
*
|
||||
* @param swapRB flag which indicates that swap first and last channels in 3-channel image is
|
||||
* necessary.
|
||||
*
|
||||
* @param crop flag which indicates whether image will be cropped after resize or not
|
||||
*
|
||||
* @param ddepth Depth of output blob. Choose CV_32F or CV_8U.
|
||||
*/
|
||||
export declare function blobFromImage(
|
||||
image: InputArray,
|
||||
scalefactor?: double,
|
||||
size?: any,
|
||||
mean?: any,
|
||||
swapRB?: bool,
|
||||
crop?: bool,
|
||||
ddepth?: int,
|
||||
): Mat;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function blobFromImage(
|
||||
image: InputArray,
|
||||
blob: OutputArray,
|
||||
scalefactor?: double,
|
||||
size?: any,
|
||||
mean?: any,
|
||||
swapRB?: bool,
|
||||
crop?: bool,
|
||||
ddepth?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* if `crop` is true, input image is resized so one side after resize is equal to corresponding
|
||||
* dimension in `size` and another one is equal or larger. Then, crop from the center is performed. If
|
||||
* `crop` is false, direct resize without cropping and preserving aspect ratio is performed.
|
||||
*
|
||||
* 4-dimensional [Mat] with NCHW dimensions order.
|
||||
*
|
||||
* @param images input images (all with 1-, 3- or 4-channels).
|
||||
*
|
||||
* @param scalefactor multiplier for images values.
|
||||
*
|
||||
* @param size spatial size for output image
|
||||
*
|
||||
* @param mean scalar with mean values which are subtracted from channels. Values are intended to be in
|
||||
* (mean-R, mean-G, mean-B) order if image has BGR ordering and swapRB is true.
|
||||
*
|
||||
* @param swapRB flag which indicates that swap first and last channels in 3-channel image is
|
||||
* necessary.
|
||||
*
|
||||
* @param crop flag which indicates whether image will be cropped after resize or not
|
||||
*
|
||||
* @param ddepth Depth of output blob. Choose CV_32F or CV_8U.
|
||||
*/
|
||||
export declare function blobFromImages(
|
||||
images: InputArrayOfArrays,
|
||||
scalefactor?: double,
|
||||
size?: Size,
|
||||
mean?: any,
|
||||
swapRB?: bool,
|
||||
crop?: bool,
|
||||
ddepth?: int,
|
||||
): Mat;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function blobFromImages(
|
||||
images: InputArrayOfArrays,
|
||||
blob: OutputArray,
|
||||
scalefactor?: double,
|
||||
size?: Size,
|
||||
mean?: any,
|
||||
swapRB?: bool,
|
||||
crop?: bool,
|
||||
ddepth?: int,
|
||||
): void;
|
||||
|
||||
export declare function getAvailableBackends(): any;
|
||||
|
||||
export declare function getAvailableTargets(be: Backend): any;
|
||||
|
||||
/**
|
||||
* @param blob_ 4 dimensional array (images, channels, height, width) in floating point precision
|
||||
* (CV_32F) from which you would like to extract the images.
|
||||
*
|
||||
* @param images_ array of 2D Mat containing the images extracted from the blob in floating point
|
||||
* precision (CV_32F). They are non normalized neither mean added. The number of returned images equals
|
||||
* the first dimension of the blob (batch size). Every image has a number of channels equals to the
|
||||
* second dimension of the blob (depth).
|
||||
*/
|
||||
export declare function imagesFromBlob(
|
||||
blob_: any,
|
||||
images_: OutputArrayOfArrays,
|
||||
): any;
|
||||
|
||||
/**
|
||||
* @param bboxes a set of bounding boxes to apply NMS.
|
||||
*
|
||||
* @param scores a set of corresponding confidences.
|
||||
*
|
||||
* @param score_threshold a threshold used to filter boxes by score.
|
||||
*
|
||||
* @param nms_threshold a threshold used in non maximum suppression.
|
||||
*
|
||||
* @param indices the kept indices of bboxes after NMS.
|
||||
*
|
||||
* @param eta a coefficient in adaptive threshold formula: $nms\_threshold_{i+1}=eta\cdot
|
||||
* nms\_threshold_i$.
|
||||
*
|
||||
* @param top_k if >0, keep at most top_k picked indices.
|
||||
*/
|
||||
export declare function NMSBoxes(
|
||||
bboxes: any,
|
||||
scores: any,
|
||||
score_threshold: any,
|
||||
nms_threshold: any,
|
||||
indices: any,
|
||||
eta?: any,
|
||||
top_k?: any,
|
||||
): void;
|
||||
|
||||
export declare function NMSBoxes(
|
||||
bboxes: any,
|
||||
scores: any,
|
||||
score_threshold: any,
|
||||
nms_threshold: any,
|
||||
indices: any,
|
||||
eta?: any,
|
||||
top_k?: any,
|
||||
): void;
|
||||
|
||||
export declare function NMSBoxes(
|
||||
bboxes: any,
|
||||
scores: any,
|
||||
score_threshold: any,
|
||||
nms_threshold: any,
|
||||
indices: any,
|
||||
eta?: any,
|
||||
top_k?: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
* This function automatically detects an origin framework of trained model and calls an appropriate
|
||||
* function such [readNetFromCaffe], [readNetFromTensorflow], [readNetFromTorch] or
|
||||
* [readNetFromDarknet]. An order of `model` and `config` arguments does not matter.
|
||||
*
|
||||
* @param model Binary file contains trained weights. The following file extensions are expected for
|
||||
* models from different frameworks:
|
||||
* .caffemodel (Caffe, http://caffe.berkeleyvision.org/)*.pb (TensorFlow,
|
||||
* https://www.tensorflow.org/)*.t7 | *.net (Torch, http://torch.ch/)*.weights (Darknet,
|
||||
* https://pjreddie.com/darknet/)*.bin (DLDT, https://software.intel.com/openvino-toolkit)*.onnx (ONNX,
|
||||
* https://onnx.ai/)
|
||||
*
|
||||
* @param config Text file contains network configuration. It could be a file with the following
|
||||
* extensions:
|
||||
* .prototxt (Caffe, http://caffe.berkeleyvision.org/)*.pbtxt (TensorFlow,
|
||||
* https://www.tensorflow.org/)*.cfg (Darknet, https://pjreddie.com/darknet/)*.xml (DLDT,
|
||||
* https://software.intel.com/openvino-toolkit)
|
||||
*
|
||||
* @param framework Explicit framework name tag to determine a format.
|
||||
*/
|
||||
export declare function readNet(model: any, config?: any, framework?: any): Net;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* [Net] object.
|
||||
*
|
||||
* @param framework Name of origin framework.
|
||||
*
|
||||
* @param bufferModel A buffer with a content of binary file with weights
|
||||
*
|
||||
* @param bufferConfig A buffer with a content of text file contains network configuration.
|
||||
*/
|
||||
export declare function readNet(
|
||||
framework: any,
|
||||
bufferModel: uchar,
|
||||
bufferConfig?: uchar,
|
||||
): uchar;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param prototxt path to the .prototxt file with text description of the network architecture.
|
||||
*
|
||||
* @param caffeModel path to the .caffemodel file with learned network.
|
||||
*/
|
||||
export declare function readNetFromCaffe(prototxt: any, caffeModel?: any): Net;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param bufferProto buffer containing the content of the .prototxt file
|
||||
*
|
||||
* @param bufferModel buffer containing the content of the .caffemodel file
|
||||
*/
|
||||
export declare function readNetFromCaffe(
|
||||
bufferProto: uchar,
|
||||
bufferModel?: uchar,
|
||||
): uchar;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* [Net] object.
|
||||
*
|
||||
* @param bufferProto buffer containing the content of the .prototxt file
|
||||
*
|
||||
* @param lenProto length of bufferProto
|
||||
*
|
||||
* @param bufferModel buffer containing the content of the .caffemodel file
|
||||
*
|
||||
* @param lenModel length of bufferModel
|
||||
*/
|
||||
export declare function readNetFromCaffe(
|
||||
bufferProto: any,
|
||||
lenProto: size_t,
|
||||
bufferModel?: any,
|
||||
lenModel?: size_t,
|
||||
): Net;
|
||||
|
||||
/**
|
||||
* Network object that ready to do forward, throw an exception in failure cases.
|
||||
*
|
||||
* [Net] object.
|
||||
*
|
||||
* @param cfgFile path to the .cfg file with text description of the network architecture.
|
||||
*
|
||||
* @param darknetModel path to the .weights file with learned network.
|
||||
*/
|
||||
export declare function readNetFromDarknet(
|
||||
cfgFile: any,
|
||||
darknetModel?: any,
|
||||
): Net;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param bufferCfg A buffer contains a content of .cfg file with text description of the network
|
||||
* architecture.
|
||||
*
|
||||
* @param bufferModel A buffer contains a content of .weights file with learned network.
|
||||
*/
|
||||
export declare function readNetFromDarknet(
|
||||
bufferCfg: uchar,
|
||||
bufferModel?: uchar,
|
||||
): uchar;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param bufferCfg A buffer contains a content of .cfg file with text description of the network
|
||||
* architecture.
|
||||
*
|
||||
* @param lenCfg Number of bytes to read from bufferCfg
|
||||
*
|
||||
* @param bufferModel A buffer contains a content of .weights file with learned network.
|
||||
*
|
||||
* @param lenModel Number of bytes to read from bufferModel
|
||||
*/
|
||||
export declare function readNetFromDarknet(
|
||||
bufferCfg: any,
|
||||
lenCfg: size_t,
|
||||
bufferModel?: any,
|
||||
lenModel?: size_t,
|
||||
): Net;
|
||||
|
||||
/**
|
||||
* [Net] object. Networks imported from Intel's [Model] Optimizer are launched in Intel's Inference
|
||||
* Engine backend.
|
||||
*
|
||||
* @param xml XML configuration file with network's topology.
|
||||
*
|
||||
* @param bin Binary file with trained weights.
|
||||
*/
|
||||
export declare function readNetFromModelOptimizer(xml: any, bin: any): Net;
|
||||
|
||||
/**
|
||||
* Network object that ready to do forward, throw an exception in failure cases.
|
||||
*
|
||||
* @param onnxFile path to the .onnx file with text description of the network architecture.
|
||||
*/
|
||||
export declare function readNetFromONNX(onnxFile: any): Net;
|
||||
|
||||
/**
|
||||
* Network object that ready to do forward, throw an exception in failure cases.
|
||||
*
|
||||
* @param buffer memory address of the first byte of the buffer.
|
||||
*
|
||||
* @param sizeBuffer size of the buffer.
|
||||
*/
|
||||
export declare function readNetFromONNX(buffer: any, sizeBuffer: size_t): Net;
|
||||
|
||||
/**
|
||||
* Network object that ready to do forward, throw an exception in failure cases.
|
||||
*
|
||||
* @param buffer in-memory buffer that stores the ONNX model bytes.
|
||||
*/
|
||||
export declare function readNetFromONNX(buffer: uchar): uchar;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param model path to the .pb file with binary protobuf description of the network architecture
|
||||
*
|
||||
* @param config path to the .pbtxt file that contains text graph definition in protobuf format.
|
||||
* Resulting Net object is built by text graph using weights from a binary one that let us make it more
|
||||
* flexible.
|
||||
*/
|
||||
export declare function readNetFromTensorflow(model: any, config?: any): Net;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* @param bufferModel buffer containing the content of the pb file
|
||||
*
|
||||
* @param bufferConfig buffer containing the content of the pbtxt file
|
||||
*/
|
||||
export declare function readNetFromTensorflow(
|
||||
bufferModel: uchar,
|
||||
bufferConfig?: uchar,
|
||||
): uchar;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* @param bufferModel buffer containing the content of the pb file
|
||||
*
|
||||
* @param lenModel length of bufferModel
|
||||
*
|
||||
* @param bufferConfig buffer containing the content of the pbtxt file
|
||||
*
|
||||
* @param lenConfig length of bufferConfig
|
||||
*/
|
||||
export declare function readNetFromTensorflow(
|
||||
bufferModel: any,
|
||||
lenModel: size_t,
|
||||
bufferConfig?: any,
|
||||
lenConfig?: size_t,
|
||||
): Net;
|
||||
|
||||
/**
|
||||
* [Net] object.
|
||||
*
|
||||
* Ascii mode of Torch serializer is more preferable, because binary mode extensively use `long` type
|
||||
* of C language, which has various bit-length on different systems.
|
||||
* The loading file must contain serialized object with importing network. Try to eliminate a custom
|
||||
* objects from serialazing data to avoid importing errors.
|
||||
*
|
||||
* List of supported layers (i.e. object instances derived from Torch nn.Module class):
|
||||
*
|
||||
* nn.Sequential
|
||||
* nn.Parallel
|
||||
* nn.Concat
|
||||
* nn.Linear
|
||||
* nn.SpatialConvolution
|
||||
* nn.SpatialMaxPooling, nn.SpatialAveragePooling
|
||||
* nn.ReLU, nn.TanH, nn.Sigmoid
|
||||
* nn.Reshape
|
||||
* nn.SoftMax, nn.LogSoftMax
|
||||
*
|
||||
* Also some equivalents of these classes from cunn, cudnn, and fbcunn may be successfully imported.
|
||||
*
|
||||
* @param model path to the file, dumped from Torch by using torch.save() function.
|
||||
*
|
||||
* @param isBinary specifies whether the network was serialized in ascii mode or binary.
|
||||
*
|
||||
* @param evaluate specifies testing phase of network. If true, it's similar to evaluate() method in
|
||||
* Torch.
|
||||
*/
|
||||
export declare function readNetFromTorch(
|
||||
model: any,
|
||||
isBinary?: bool,
|
||||
evaluate?: bool,
|
||||
): Net;
|
||||
|
||||
/**
|
||||
* [Mat].
|
||||
*
|
||||
* @param path to the .pb file with input tensor.
|
||||
*/
|
||||
export declare function readTensorFromONNX(path: any): Mat;
|
||||
|
||||
/**
|
||||
* This function has the same limitations as [readNetFromTorch()].
|
||||
*/
|
||||
export declare function readTorchBlob(filename: any, isBinary?: bool): Mat;
|
||||
|
||||
/**
|
||||
* Shrinked model has no origin float32 weights so it can't be used in origin Caffe framework anymore.
|
||||
* However the structure of data is taken from NVidia's Caffe fork: . So the resulting model may be
|
||||
* used there.
|
||||
*
|
||||
* @param src Path to origin model from Caffe framework contains single precision floating point
|
||||
* weights (usually has .caffemodel extension).
|
||||
*
|
||||
* @param dst Path to destination model with updated weights.
|
||||
*
|
||||
* @param layersTypes Set of layers types which parameters will be converted. By default, converts only
|
||||
* Convolutional and Fully-Connected layers' weights.
|
||||
*/
|
||||
export declare function shrinkCaffeModel(
|
||||
src: any,
|
||||
dst: any,
|
||||
layersTypes?: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* To reduce output file size, trained weights are not included.
|
||||
*
|
||||
* @param model A path to binary network.
|
||||
*
|
||||
* @param output A path to output text file to be created.
|
||||
*/
|
||||
export declare function writeTextGraph(model: any, output: any): void;
|
||||
|
||||
/**
|
||||
* DNN_BACKEND_DEFAULT equals to DNN_BACKEND_INFERENCE_ENGINE if OpenCV is built with Intel's Inference
|
||||
* Engine library or DNN_BACKEND_OPENCV otherwise.
|
||||
*
|
||||
*/
|
||||
export declare const DNN_BACKEND_DEFAULT: Backend; // initializer:
|
||||
|
||||
export declare const DNN_BACKEND_HALIDE: Backend; // initializer:
|
||||
|
||||
export declare const DNN_BACKEND_INFERENCE_ENGINE: Backend; // initializer:
|
||||
|
||||
export declare const DNN_BACKEND_OPENCV: Backend; // initializer:
|
||||
|
||||
export declare const DNN_BACKEND_VKCOM: Backend; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_CPU: Target; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_OPENCL: Target; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_OPENCL_FP16: Target; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_MYRIAD: Target; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_VULKAN: Target; // initializer:
|
||||
|
||||
export declare const DNN_TARGET_FPGA: Target; // initializer:
|
||||
|
||||
/**
|
||||
* [Net::setPreferableBackend]
|
||||
*
|
||||
*/
|
||||
export type Backend = any;
|
||||
|
||||
/**
|
||||
* [Net::setPreferableBackend]
|
||||
*
|
||||
*/
|
||||
export type Target = any;
|
||||
114
opencv-js-4.10.0/src/types/opencv/features2d_draw.ts
Normal file
114
opencv-js-4.10.0/src/types/opencv/features2d_draw.ts
Normal file
|
|
@ -0,0 +1,114 @@
|
|||
import type { InputArray, InputOutputArray } from "./_types";
|
||||
/*
|
||||
* # Drawing Function of Keypoints and Matches
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* For Python API, flags are modified as cv.DRAW_MATCHES_FLAGS_DEFAULT,
|
||||
* cv.DRAW_MATCHES_FLAGS_DRAW_RICH_KEYPOINTS, cv.DRAW_MATCHES_FLAGS_DRAW_OVER_OUTIMG,
|
||||
* cv.DRAW_MATCHES_FLAGS_NOT_DRAW_SINGLE_POINTS
|
||||
*
|
||||
* @param image Source image.
|
||||
*
|
||||
* @param keypoints Keypoints from the source image.
|
||||
*
|
||||
* @param outImage Output image. Its content depends on the flags value defining what is drawn in the
|
||||
* output image. See possible flags bit values below.
|
||||
*
|
||||
* @param color Color of keypoints.
|
||||
*
|
||||
* @param flags Flags setting drawing features. Possible flags bit values are defined by
|
||||
* DrawMatchesFlags. See details above in drawMatches .
|
||||
*/
|
||||
export declare function drawKeypoints(
|
||||
image: InputArray,
|
||||
keypoints: any,
|
||||
outImage: InputOutputArray,
|
||||
color?: any,
|
||||
flags?: DrawMatchesFlags,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This function draws matches of keypoints from two images in the output image. Match is a line
|
||||
* connecting two keypoints (circles). See [cv::DrawMatchesFlags].
|
||||
*
|
||||
* @param img1 First source image.
|
||||
*
|
||||
* @param keypoints1 Keypoints from the first source image.
|
||||
*
|
||||
* @param img2 Second source image.
|
||||
*
|
||||
* @param keypoints2 Keypoints from the second source image.
|
||||
*
|
||||
* @param matches1to2 Matches from the first image to the second one, which means that keypoints1[i]
|
||||
* has a corresponding point in keypoints2[matches[i]] .
|
||||
*
|
||||
* @param outImg Output image. Its content depends on the flags value defining what is drawn in the
|
||||
* output image. See possible flags bit values below.
|
||||
*
|
||||
* @param matchColor Color of matches (lines and connected keypoints). If matchColor==Scalar::all(-1) ,
|
||||
* the color is generated randomly.
|
||||
*
|
||||
* @param singlePointColor Color of single keypoints (circles), which means that keypoints do not have
|
||||
* the matches. If singlePointColor==Scalar::all(-1) , the color is generated randomly.
|
||||
*
|
||||
* @param matchesMask Mask determining which matches are drawn. If the mask is empty, all matches are
|
||||
* drawn.
|
||||
*
|
||||
* @param flags Flags setting drawing features. Possible flags bit values are defined by
|
||||
* DrawMatchesFlags.
|
||||
*/
|
||||
export declare function drawMatches(
|
||||
img1: InputArray,
|
||||
keypoints1: any,
|
||||
img2: InputArray,
|
||||
keypoints2: any,
|
||||
matches1to2: any,
|
||||
outImg: InputOutputArray,
|
||||
matchColor?: any,
|
||||
singlePointColor?: any,
|
||||
matchesMask?: any,
|
||||
flags?: DrawMatchesFlags,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function drawMatches(
|
||||
img1: InputArray,
|
||||
keypoints1: any,
|
||||
img2: InputArray,
|
||||
keypoints2: any,
|
||||
matches1to2: any,
|
||||
outImg: InputOutputArray,
|
||||
matchColor?: any,
|
||||
singlePointColor?: any,
|
||||
matchesMask?: any,
|
||||
flags?: DrawMatchesFlags,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* Output image matrix will be created ([Mat::create]), i.e. existing memory of output image may be
|
||||
* reused. Two source image, matches and single keypoints will be drawn. For each keypoint only the
|
||||
* center point will be drawn (without the circle around keypoint with keypoint size and orientation).
|
||||
*
|
||||
*/
|
||||
export declare const DEFAULT: DrawMatchesFlags; // initializer: = 0
|
||||
|
||||
/**
|
||||
* Output image matrix will not be created ([Mat::create]). Matches will be drawn on existing content
|
||||
* of output image.
|
||||
*
|
||||
*/
|
||||
export declare const DRAW_OVER_OUTIMG: DrawMatchesFlags; // initializer: = 1
|
||||
|
||||
export declare const NOT_DRAW_SINGLE_POINTS: DrawMatchesFlags; // initializer: = 2
|
||||
|
||||
/**
|
||||
* For each keypoint the circle around keypoint with keypoint size and orientation will be drawn.
|
||||
*
|
||||
*/
|
||||
export declare const DRAW_RICH_KEYPOINTS: DrawMatchesFlags; // initializer: = 4
|
||||
|
||||
export type DrawMatchesFlags = any;
|
||||
26
opencv-js-4.10.0/src/types/opencv/fisheye.ts
Normal file
26
opencv-js-4.10.0/src/types/opencv/fisheye.ts
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import type { InputArray, OutputArray, int, Size } from "./_types";
|
||||
|
||||
/**
|
||||
* Computes the undistortion and rectification maps for the image transform using remap.
|
||||
* If D is empty, zero distortion is used. If R or P is empty, identity matrices are used.
|
||||
*
|
||||
* @param {InputArray} K - Camera intrinsic matrix.
|
||||
* @param {InputArray} D - Input vector of distortion coefficients (k1, k2, k3, k4).
|
||||
* @param {InputArray} R - Rectification transformation in the object space: 3x3 1-channel, or vector: 3x1/1x3 1-channel or 1x1 3-channel.
|
||||
* @param {InputArray} P - New camera intrinsic matrix (3x3) or new projection matrix (3x4).
|
||||
* @param {Size} size - Undistorted image size.
|
||||
* @param {int} m1type - Type of the first output map that can be CV_32FC1 or CV_16SC2. See convertMaps for details.
|
||||
* @param {OutputArray} map1 - The first output map.
|
||||
* @param {OutputArray} map2 - The second output map.
|
||||
* @return {void}
|
||||
*/
|
||||
export declare function fisheye_initUndistortRectifyMap(
|
||||
K: InputArray,
|
||||
D: InputArray,
|
||||
R: InputArray,
|
||||
P: InputArray,
|
||||
size: Size,
|
||||
m1type: int,
|
||||
map1: OutputArray,
|
||||
map2: OutputArray,
|
||||
): void;
|
||||
527
opencv-js-4.10.0/src/types/opencv/imgproc_color_conversions.ts
Normal file
527
opencv-js-4.10.0/src/types/opencv/imgproc_color_conversions.ts
Normal file
|
|
@ -0,0 +1,527 @@
|
|||
import type { InputArray, int, OutputArray } from "./_types";
|
||||
/*
|
||||
* # Color Space Conversions
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* The function converts an input image from one color space to another. In case of a transformation
|
||||
* to-from RGB color space, the order of the channels should be specified explicitly (RGB or BGR). Note
|
||||
* that the default color format in OpenCV is often referred to as RGB but it is actually BGR (the
|
||||
* bytes are reversed). So the first byte in a standard (24-bit) color image will be an 8-bit Blue
|
||||
* component, the second byte will be Green, and the third byte will be Red. The fourth, fifth, and
|
||||
* sixth bytes would then be the second pixel (Blue, then Green, then Red), and so on.
|
||||
*
|
||||
* The conventional ranges for R, G, and B channel values are:
|
||||
*
|
||||
* 0 to 255 for CV_8U images
|
||||
* 0 to 65535 for CV_16U images
|
||||
* 0 to 1 for CV_32F images
|
||||
*
|
||||
* In case of linear transformations, the range does not matter. But in case of a non-linear
|
||||
* transformation, an input RGB image should be normalized to the proper value range to get the correct
|
||||
* results, for example, for RGB `$\\rightarrow$` L*u*v* transformation. For example, if you have a
|
||||
* 32-bit floating-point image directly converted from an 8-bit image without any scaling, then it will
|
||||
* have the 0..255 value range instead of 0..1 assumed by the function. So, before calling [cvtColor] ,
|
||||
* you need first to scale the image down:
|
||||
*
|
||||
* ```cpp
|
||||
* img *= 1./255;
|
||||
* cvtColor(img, img, COLOR_BGR2Luv);
|
||||
* ```
|
||||
*
|
||||
* If you use [cvtColor] with 8-bit images, the conversion will have some information lost. For many
|
||||
* applications, this will not be noticeable but it is recommended to use 32-bit images in applications
|
||||
* that need the full range of colors or that convert an image before an operation and then convert
|
||||
* back.
|
||||
*
|
||||
* If conversion adds the alpha channel, its value will set to the maximum of corresponding channel
|
||||
* range: 255 for CV_8U, 65535 for CV_16U, 1 for CV_32F.
|
||||
*
|
||||
* [Color conversions]
|
||||
*
|
||||
* @param src input image: 8-bit unsigned, 16-bit unsigned ( CV_16UC... ), or single-precision
|
||||
* floating-point.
|
||||
*
|
||||
* @param dst output image of the same size and depth as src.
|
||||
*
|
||||
* @param code color space conversion code (see ColorConversionCodes).
|
||||
*
|
||||
* @param dstCn number of channels in the destination image; if the parameter is 0, the number of the
|
||||
* channels is derived automatically from src and code.
|
||||
*/
|
||||
export declare function cvtColor(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
code: int,
|
||||
dstCn?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This function only supports YUV420 to RGB conversion as of now.
|
||||
*
|
||||
* @param src1 8-bit image (CV_8U) of the Y plane.
|
||||
*
|
||||
* @param src2 image containing interleaved U/V plane.
|
||||
*
|
||||
* @param dst output image.
|
||||
*
|
||||
* @param code Specifies the type of conversion. It can take any of the following values:
|
||||
* COLOR_YUV2BGR_NV12COLOR_YUV2RGB_NV12COLOR_YUV2BGRA_NV12COLOR_YUV2RGBA_NV12COLOR_YUV2BGR_NV21COLOR_YUV2RGB_NV21COLOR_YUV2BGRA_NV21COLOR_YUV2RGBA_NV21
|
||||
*/
|
||||
export declare function cvtColorTwoPlane(
|
||||
src1: InputArray,
|
||||
src2: InputArray,
|
||||
dst: OutputArray,
|
||||
code: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function can do the following transformations:
|
||||
*
|
||||
* Demosaicing using bilinear interpolation[COLOR_BayerBG2BGR] , [COLOR_BayerGB2BGR] ,
|
||||
* [COLOR_BayerRG2BGR] , [COLOR_BayerGR2BGR][COLOR_BayerBG2GRAY] , [COLOR_BayerGB2GRAY] ,
|
||||
* [COLOR_BayerRG2GRAY] , [COLOR_BayerGR2GRAY]
|
||||
* Demosaicing using Variable Number of Gradients.[COLOR_BayerBG2BGR_VNG] , [COLOR_BayerGB2BGR_VNG] ,
|
||||
* [COLOR_BayerRG2BGR_VNG] , [COLOR_BayerGR2BGR_VNG]
|
||||
* Edge-Aware Demosaicing.[COLOR_BayerBG2BGR_EA] , [COLOR_BayerGB2BGR_EA] , [COLOR_BayerRG2BGR_EA] ,
|
||||
* [COLOR_BayerGR2BGR_EA]
|
||||
* Demosaicing with alpha channel[COLOR_BayerBG2BGRA] , [COLOR_BayerGB2BGRA] , [COLOR_BayerRG2BGRA] ,
|
||||
* [COLOR_BayerGR2BGRA]
|
||||
*
|
||||
* [cvtColor]
|
||||
*
|
||||
* @param src input image: 8-bit unsigned or 16-bit unsigned.
|
||||
*
|
||||
* @param dst output image of the same size and depth as src.
|
||||
*
|
||||
* @param code Color space conversion code (see the description below).
|
||||
*
|
||||
* @param dstCn number of channels in the destination image; if the parameter is 0, the number of the
|
||||
* channels is derived automatically from src and code.
|
||||
*/
|
||||
export declare function demosaicing(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
code: int,
|
||||
dstCn?: int,
|
||||
): void;
|
||||
|
||||
export declare const COLOR_BGR2BGRA: ColorConversionCodes; // initializer: = 0
|
||||
|
||||
export declare const COLOR_RGB2RGBA: ColorConversionCodes; // initializer: = COLOR_BGR2BGRA
|
||||
|
||||
export declare const COLOR_BGRA2BGR: ColorConversionCodes; // initializer: = 1
|
||||
|
||||
export declare const COLOR_RGBA2RGB: ColorConversionCodes; // initializer: = COLOR_BGRA2BGR
|
||||
|
||||
export declare const COLOR_BGR2RGBA: ColorConversionCodes; // initializer: = 2
|
||||
|
||||
export declare const COLOR_RGB2BGRA: ColorConversionCodes; // initializer: = COLOR_BGR2RGBA
|
||||
|
||||
export declare const COLOR_RGBA2BGR: ColorConversionCodes; // initializer: = 3
|
||||
|
||||
export declare const COLOR_BGRA2RGB: ColorConversionCodes; // initializer: = COLOR_RGBA2BGR
|
||||
|
||||
export declare const COLOR_BGR2RGB: ColorConversionCodes; // initializer: = 4
|
||||
|
||||
export declare const COLOR_RGB2BGR: ColorConversionCodes; // initializer: = COLOR_BGR2RGB
|
||||
|
||||
export declare const COLOR_BGRA2RGBA: ColorConversionCodes; // initializer: = 5
|
||||
|
||||
export declare const COLOR_RGBA2BGRA: ColorConversionCodes; // initializer: = COLOR_BGRA2RGBA
|
||||
|
||||
export declare const COLOR_BGR2GRAY: ColorConversionCodes; // initializer: = 6
|
||||
|
||||
export declare const COLOR_RGB2GRAY: ColorConversionCodes; // initializer: = 7
|
||||
|
||||
export declare const COLOR_GRAY2BGR: ColorConversionCodes; // initializer: = 8
|
||||
|
||||
export declare const COLOR_GRAY2RGB: ColorConversionCodes; // initializer: = COLOR_GRAY2BGR
|
||||
|
||||
export declare const COLOR_GRAY2BGRA: ColorConversionCodes; // initializer: = 9
|
||||
|
||||
export declare const COLOR_GRAY2RGBA: ColorConversionCodes; // initializer: = COLOR_GRAY2BGRA
|
||||
|
||||
export declare const COLOR_BGRA2GRAY: ColorConversionCodes; // initializer: = 10
|
||||
|
||||
export declare const COLOR_RGBA2GRAY: ColorConversionCodes; // initializer: = 11
|
||||
|
||||
export declare const COLOR_BGR2BGR565: ColorConversionCodes; // initializer: = 12
|
||||
|
||||
export declare const COLOR_RGB2BGR565: ColorConversionCodes; // initializer: = 13
|
||||
|
||||
export declare const COLOR_BGR5652BGR: ColorConversionCodes; // initializer: = 14
|
||||
|
||||
export declare const COLOR_BGR5652RGB: ColorConversionCodes; // initializer: = 15
|
||||
|
||||
export declare const COLOR_BGRA2BGR565: ColorConversionCodes; // initializer: = 16
|
||||
|
||||
export declare const COLOR_RGBA2BGR565: ColorConversionCodes; // initializer: = 17
|
||||
|
||||
export declare const COLOR_BGR5652BGRA: ColorConversionCodes; // initializer: = 18
|
||||
|
||||
export declare const COLOR_BGR5652RGBA: ColorConversionCodes; // initializer: = 19
|
||||
|
||||
export declare const COLOR_GRAY2BGR565: ColorConversionCodes; // initializer: = 20
|
||||
|
||||
export declare const COLOR_BGR5652GRAY: ColorConversionCodes; // initializer: = 21
|
||||
|
||||
export declare const COLOR_BGR2BGR555: ColorConversionCodes; // initializer: = 22
|
||||
|
||||
export declare const COLOR_RGB2BGR555: ColorConversionCodes; // initializer: = 23
|
||||
|
||||
export declare const COLOR_BGR5552BGR: ColorConversionCodes; // initializer: = 24
|
||||
|
||||
export declare const COLOR_BGR5552RGB: ColorConversionCodes; // initializer: = 25
|
||||
|
||||
export declare const COLOR_BGRA2BGR555: ColorConversionCodes; // initializer: = 26
|
||||
|
||||
export declare const COLOR_RGBA2BGR555: ColorConversionCodes; // initializer: = 27
|
||||
|
||||
export declare const COLOR_BGR5552BGRA: ColorConversionCodes; // initializer: = 28
|
||||
|
||||
export declare const COLOR_BGR5552RGBA: ColorConversionCodes; // initializer: = 29
|
||||
|
||||
export declare const COLOR_GRAY2BGR555: ColorConversionCodes; // initializer: = 30
|
||||
|
||||
export declare const COLOR_BGR5552GRAY: ColorConversionCodes; // initializer: = 31
|
||||
|
||||
export declare const COLOR_BGR2XYZ: ColorConversionCodes; // initializer: = 32
|
||||
|
||||
export declare const COLOR_RGB2XYZ: ColorConversionCodes; // initializer: = 33
|
||||
|
||||
export declare const COLOR_XYZ2BGR: ColorConversionCodes; // initializer: = 34
|
||||
|
||||
export declare const COLOR_XYZ2RGB: ColorConversionCodes; // initializer: = 35
|
||||
|
||||
export declare const COLOR_BGR2YCrCb: ColorConversionCodes; // initializer: = 36
|
||||
|
||||
export declare const COLOR_RGB2YCrCb: ColorConversionCodes; // initializer: = 37
|
||||
|
||||
export declare const COLOR_YCrCb2BGR: ColorConversionCodes; // initializer: = 38
|
||||
|
||||
export declare const COLOR_YCrCb2RGB: ColorConversionCodes; // initializer: = 39
|
||||
|
||||
export declare const COLOR_BGR2HSV: ColorConversionCodes; // initializer: = 40
|
||||
|
||||
export declare const COLOR_RGB2HSV: ColorConversionCodes; // initializer: = 41
|
||||
|
||||
export declare const COLOR_BGR2Lab: ColorConversionCodes; // initializer: = 44
|
||||
|
||||
export declare const COLOR_RGB2Lab: ColorConversionCodes; // initializer: = 45
|
||||
|
||||
export declare const COLOR_BGR2Luv: ColorConversionCodes; // initializer: = 50
|
||||
|
||||
export declare const COLOR_RGB2Luv: ColorConversionCodes; // initializer: = 51
|
||||
|
||||
export declare const COLOR_BGR2HLS: ColorConversionCodes; // initializer: = 52
|
||||
|
||||
export declare const COLOR_RGB2HLS: ColorConversionCodes; // initializer: = 53
|
||||
|
||||
export declare const COLOR_HSV2BGR: ColorConversionCodes; // initializer: = 54
|
||||
|
||||
export declare const COLOR_HSV2RGB: ColorConversionCodes; // initializer: = 55
|
||||
|
||||
export declare const COLOR_Lab2BGR: ColorConversionCodes; // initializer: = 56
|
||||
|
||||
export declare const COLOR_Lab2RGB: ColorConversionCodes; // initializer: = 57
|
||||
|
||||
export declare const COLOR_Luv2BGR: ColorConversionCodes; // initializer: = 58
|
||||
|
||||
export declare const COLOR_Luv2RGB: ColorConversionCodes; // initializer: = 59
|
||||
|
||||
export declare const COLOR_HLS2BGR: ColorConversionCodes; // initializer: = 60
|
||||
|
||||
export declare const COLOR_HLS2RGB: ColorConversionCodes; // initializer: = 61
|
||||
|
||||
export declare const COLOR_BGR2HSV_FULL: ColorConversionCodes; // initializer: = 66
|
||||
|
||||
export declare const COLOR_RGB2HSV_FULL: ColorConversionCodes; // initializer: = 67
|
||||
|
||||
export declare const COLOR_BGR2HLS_FULL: ColorConversionCodes; // initializer: = 68
|
||||
|
||||
export declare const COLOR_RGB2HLS_FULL: ColorConversionCodes; // initializer: = 69
|
||||
|
||||
export declare const COLOR_HSV2BGR_FULL: ColorConversionCodes; // initializer: = 70
|
||||
|
||||
export declare const COLOR_HSV2RGB_FULL: ColorConversionCodes; // initializer: = 71
|
||||
|
||||
export declare const COLOR_HLS2BGR_FULL: ColorConversionCodes; // initializer: = 72
|
||||
|
||||
export declare const COLOR_HLS2RGB_FULL: ColorConversionCodes; // initializer: = 73
|
||||
|
||||
export declare const COLOR_LBGR2Lab: ColorConversionCodes; // initializer: = 74
|
||||
|
||||
export declare const COLOR_LRGB2Lab: ColorConversionCodes; // initializer: = 75
|
||||
|
||||
export declare const COLOR_LBGR2Luv: ColorConversionCodes; // initializer: = 76
|
||||
|
||||
export declare const COLOR_LRGB2Luv: ColorConversionCodes; // initializer: = 77
|
||||
|
||||
export declare const COLOR_Lab2LBGR: ColorConversionCodes; // initializer: = 78
|
||||
|
||||
export declare const COLOR_Lab2LRGB: ColorConversionCodes; // initializer: = 79
|
||||
|
||||
export declare const COLOR_Luv2LBGR: ColorConversionCodes; // initializer: = 80
|
||||
|
||||
export declare const COLOR_Luv2LRGB: ColorConversionCodes; // initializer: = 81
|
||||
|
||||
export declare const COLOR_BGR2YUV: ColorConversionCodes; // initializer: = 82
|
||||
|
||||
export declare const COLOR_RGB2YUV: ColorConversionCodes; // initializer: = 83
|
||||
|
||||
export declare const COLOR_YUV2BGR: ColorConversionCodes; // initializer: = 84
|
||||
|
||||
export declare const COLOR_YUV2RGB: ColorConversionCodes; // initializer: = 85
|
||||
|
||||
export declare const COLOR_YUV2RGB_NV12: ColorConversionCodes; // initializer: = 90
|
||||
|
||||
export declare const COLOR_YUV2BGR_NV12: ColorConversionCodes; // initializer: = 91
|
||||
|
||||
export declare const COLOR_YUV2RGB_NV21: ColorConversionCodes; // initializer: = 92
|
||||
|
||||
export declare const COLOR_YUV2BGR_NV21: ColorConversionCodes; // initializer: = 93
|
||||
|
||||
export declare const COLOR_YUV420sp2RGB: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_NV21
|
||||
|
||||
export declare const COLOR_YUV420sp2BGR: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_NV21
|
||||
|
||||
export declare const COLOR_YUV2RGBA_NV12: ColorConversionCodes; // initializer: = 94
|
||||
|
||||
export declare const COLOR_YUV2BGRA_NV12: ColorConversionCodes; // initializer: = 95
|
||||
|
||||
export declare const COLOR_YUV2RGBA_NV21: ColorConversionCodes; // initializer: = 96
|
||||
|
||||
export declare const COLOR_YUV2BGRA_NV21: ColorConversionCodes; // initializer: = 97
|
||||
|
||||
export declare const COLOR_YUV420sp2RGBA: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_NV21
|
||||
|
||||
export declare const COLOR_YUV420sp2BGRA: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_NV21
|
||||
|
||||
export declare const COLOR_YUV2RGB_YV12: ColorConversionCodes; // initializer: = 98
|
||||
|
||||
export declare const COLOR_YUV2BGR_YV12: ColorConversionCodes; // initializer: = 99
|
||||
|
||||
export declare const COLOR_YUV2RGB_IYUV: ColorConversionCodes; // initializer: = 100
|
||||
|
||||
export declare const COLOR_YUV2BGR_IYUV: ColorConversionCodes; // initializer: = 101
|
||||
|
||||
export declare const COLOR_YUV2RGB_I420: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_IYUV
|
||||
|
||||
export declare const COLOR_YUV2BGR_I420: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_IYUV
|
||||
|
||||
export declare const COLOR_YUV420p2RGB: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_YV12
|
||||
|
||||
export declare const COLOR_YUV420p2BGR: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_YV12
|
||||
|
||||
export declare const COLOR_YUV2RGBA_YV12: ColorConversionCodes; // initializer: = 102
|
||||
|
||||
export declare const COLOR_YUV2BGRA_YV12: ColorConversionCodes; // initializer: = 103
|
||||
|
||||
export declare const COLOR_YUV2RGBA_IYUV: ColorConversionCodes; // initializer: = 104
|
||||
|
||||
export declare const COLOR_YUV2BGRA_IYUV: ColorConversionCodes; // initializer: = 105
|
||||
|
||||
export declare const COLOR_YUV2RGBA_I420: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_IYUV
|
||||
|
||||
export declare const COLOR_YUV2BGRA_I420: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_IYUV
|
||||
|
||||
export declare const COLOR_YUV420p2RGBA: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_YV12
|
||||
|
||||
export declare const COLOR_YUV420p2BGRA: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_YV12
|
||||
|
||||
export declare const COLOR_YUV2GRAY_420: ColorConversionCodes; // initializer: = 106
|
||||
|
||||
export declare const COLOR_YUV2GRAY_NV21: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV2GRAY_NV12: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV2GRAY_YV12: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV2GRAY_IYUV: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV2GRAY_I420: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV420sp2GRAY: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV420p2GRAY: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_420
|
||||
|
||||
export declare const COLOR_YUV2RGB_UYVY: ColorConversionCodes; // initializer: = 107
|
||||
|
||||
export declare const COLOR_YUV2BGR_UYVY: ColorConversionCodes; // initializer: = 108
|
||||
|
||||
export declare const COLOR_YUV2RGB_Y422: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_UYVY
|
||||
|
||||
export declare const COLOR_YUV2BGR_Y422: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_UYVY
|
||||
|
||||
export declare const COLOR_YUV2RGB_UYNV: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_UYVY
|
||||
|
||||
export declare const COLOR_YUV2BGR_UYNV: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_UYVY
|
||||
|
||||
export declare const COLOR_YUV2RGBA_UYVY: ColorConversionCodes; // initializer: = 111
|
||||
|
||||
export declare const COLOR_YUV2BGRA_UYVY: ColorConversionCodes; // initializer: = 112
|
||||
|
||||
export declare const COLOR_YUV2RGBA_Y422: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_UYVY
|
||||
|
||||
export declare const COLOR_YUV2BGRA_Y422: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_UYVY
|
||||
|
||||
export declare const COLOR_YUV2RGBA_UYNV: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_UYVY
|
||||
|
||||
export declare const COLOR_YUV2BGRA_UYNV: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_UYVY
|
||||
|
||||
export declare const COLOR_YUV2RGB_YUY2: ColorConversionCodes; // initializer: = 115
|
||||
|
||||
export declare const COLOR_YUV2BGR_YUY2: ColorConversionCodes; // initializer: = 116
|
||||
|
||||
export declare const COLOR_YUV2RGB_YVYU: ColorConversionCodes; // initializer: = 117
|
||||
|
||||
export declare const COLOR_YUV2BGR_YVYU: ColorConversionCodes; // initializer: = 118
|
||||
|
||||
export declare const COLOR_YUV2RGB_YUYV: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_YUY2
|
||||
|
||||
export declare const COLOR_YUV2BGR_YUYV: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_YUY2
|
||||
|
||||
export declare const COLOR_YUV2RGB_YUNV: ColorConversionCodes; // initializer: = COLOR_YUV2RGB_YUY2
|
||||
|
||||
export declare const COLOR_YUV2BGR_YUNV: ColorConversionCodes; // initializer: = COLOR_YUV2BGR_YUY2
|
||||
|
||||
export declare const COLOR_YUV2RGBA_YUY2: ColorConversionCodes; // initializer: = 119
|
||||
|
||||
export declare const COLOR_YUV2BGRA_YUY2: ColorConversionCodes; // initializer: = 120
|
||||
|
||||
export declare const COLOR_YUV2RGBA_YVYU: ColorConversionCodes; // initializer: = 121
|
||||
|
||||
export declare const COLOR_YUV2BGRA_YVYU: ColorConversionCodes; // initializer: = 122
|
||||
|
||||
export declare const COLOR_YUV2RGBA_YUYV: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_YUY2
|
||||
|
||||
export declare const COLOR_YUV2BGRA_YUYV: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_YUY2
|
||||
|
||||
export declare const COLOR_YUV2RGBA_YUNV: ColorConversionCodes; // initializer: = COLOR_YUV2RGBA_YUY2
|
||||
|
||||
export declare const COLOR_YUV2BGRA_YUNV: ColorConversionCodes; // initializer: = COLOR_YUV2BGRA_YUY2
|
||||
|
||||
export declare const COLOR_YUV2GRAY_UYVY: ColorConversionCodes; // initializer: = 123
|
||||
|
||||
export declare const COLOR_YUV2GRAY_YUY2: ColorConversionCodes; // initializer: = 124
|
||||
|
||||
export declare const COLOR_YUV2GRAY_Y422: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_UYVY
|
||||
|
||||
export declare const COLOR_YUV2GRAY_UYNV: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_UYVY
|
||||
|
||||
export declare const COLOR_YUV2GRAY_YVYU: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_YUY2
|
||||
|
||||
export declare const COLOR_YUV2GRAY_YUYV: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_YUY2
|
||||
|
||||
export declare const COLOR_YUV2GRAY_YUNV: ColorConversionCodes; // initializer: = COLOR_YUV2GRAY_YUY2
|
||||
|
||||
export declare const COLOR_RGBA2mRGBA: ColorConversionCodes; // initializer: = 125
|
||||
|
||||
export declare const COLOR_mRGBA2RGBA: ColorConversionCodes; // initializer: = 126
|
||||
|
||||
export declare const COLOR_RGB2YUV_I420: ColorConversionCodes; // initializer: = 127
|
||||
|
||||
export declare const COLOR_BGR2YUV_I420: ColorConversionCodes; // initializer: = 128
|
||||
|
||||
export declare const COLOR_RGB2YUV_IYUV: ColorConversionCodes; // initializer: = COLOR_RGB2YUV_I420
|
||||
|
||||
export declare const COLOR_BGR2YUV_IYUV: ColorConversionCodes; // initializer: = COLOR_BGR2YUV_I420
|
||||
|
||||
export declare const COLOR_RGBA2YUV_I420: ColorConversionCodes; // initializer: = 129
|
||||
|
||||
export declare const COLOR_BGRA2YUV_I420: ColorConversionCodes; // initializer: = 130
|
||||
|
||||
export declare const COLOR_RGBA2YUV_IYUV: ColorConversionCodes; // initializer: = COLOR_RGBA2YUV_I420
|
||||
|
||||
export declare const COLOR_BGRA2YUV_IYUV: ColorConversionCodes; // initializer: = COLOR_BGRA2YUV_I420
|
||||
|
||||
export declare const COLOR_RGB2YUV_YV12: ColorConversionCodes; // initializer: = 131
|
||||
|
||||
export declare const COLOR_BGR2YUV_YV12: ColorConversionCodes; // initializer: = 132
|
||||
|
||||
export declare const COLOR_RGBA2YUV_YV12: ColorConversionCodes; // initializer: = 133
|
||||
|
||||
export declare const COLOR_BGRA2YUV_YV12: ColorConversionCodes; // initializer: = 134
|
||||
|
||||
export declare const COLOR_BayerBG2BGR: ColorConversionCodes; // initializer: = 46
|
||||
|
||||
export declare const COLOR_BayerGB2BGR: ColorConversionCodes; // initializer: = 47
|
||||
|
||||
export declare const COLOR_BayerRG2BGR: ColorConversionCodes; // initializer: = 48
|
||||
|
||||
export declare const COLOR_BayerGR2BGR: ColorConversionCodes; // initializer: = 49
|
||||
|
||||
export declare const COLOR_BayerBG2RGB: ColorConversionCodes; // initializer: = COLOR_BayerRG2BGR
|
||||
|
||||
export declare const COLOR_BayerGB2RGB: ColorConversionCodes; // initializer: = COLOR_BayerGR2BGR
|
||||
|
||||
export declare const COLOR_BayerRG2RGB: ColorConversionCodes; // initializer: = COLOR_BayerBG2BGR
|
||||
|
||||
export declare const COLOR_BayerGR2RGB: ColorConversionCodes; // initializer: = COLOR_BayerGB2BGR
|
||||
|
||||
export declare const COLOR_BayerBG2GRAY: ColorConversionCodes; // initializer: = 86
|
||||
|
||||
export declare const COLOR_BayerGB2GRAY: ColorConversionCodes; // initializer: = 87
|
||||
|
||||
export declare const COLOR_BayerRG2GRAY: ColorConversionCodes; // initializer: = 88
|
||||
|
||||
export declare const COLOR_BayerGR2GRAY: ColorConversionCodes; // initializer: = 89
|
||||
|
||||
export declare const COLOR_BayerBG2BGR_VNG: ColorConversionCodes; // initializer: = 62
|
||||
|
||||
export declare const COLOR_BayerGB2BGR_VNG: ColorConversionCodes; // initializer: = 63
|
||||
|
||||
export declare const COLOR_BayerRG2BGR_VNG: ColorConversionCodes; // initializer: = 64
|
||||
|
||||
export declare const COLOR_BayerGR2BGR_VNG: ColorConversionCodes; // initializer: = 65
|
||||
|
||||
export declare const COLOR_BayerBG2RGB_VNG: ColorConversionCodes; // initializer: = COLOR_BayerRG2BGR_VNG
|
||||
|
||||
export declare const COLOR_BayerGB2RGB_VNG: ColorConversionCodes; // initializer: = COLOR_BayerGR2BGR_VNG
|
||||
|
||||
export declare const COLOR_BayerRG2RGB_VNG: ColorConversionCodes; // initializer: = COLOR_BayerBG2BGR_VNG
|
||||
|
||||
export declare const COLOR_BayerGR2RGB_VNG: ColorConversionCodes; // initializer: = COLOR_BayerGB2BGR_VNG
|
||||
|
||||
export declare const COLOR_BayerBG2BGR_EA: ColorConversionCodes; // initializer: = 135
|
||||
|
||||
export declare const COLOR_BayerGB2BGR_EA: ColorConversionCodes; // initializer: = 136
|
||||
|
||||
export declare const COLOR_BayerRG2BGR_EA: ColorConversionCodes; // initializer: = 137
|
||||
|
||||
export declare const COLOR_BayerGR2BGR_EA: ColorConversionCodes; // initializer: = 138
|
||||
|
||||
export declare const COLOR_BayerBG2RGB_EA: ColorConversionCodes; // initializer: = COLOR_BayerRG2BGR_EA
|
||||
|
||||
export declare const COLOR_BayerGB2RGB_EA: ColorConversionCodes; // initializer: = COLOR_BayerGR2BGR_EA
|
||||
|
||||
export declare const COLOR_BayerRG2RGB_EA: ColorConversionCodes; // initializer: = COLOR_BayerBG2BGR_EA
|
||||
|
||||
export declare const COLOR_BayerGR2RGB_EA: ColorConversionCodes; // initializer: = COLOR_BayerGB2BGR_EA
|
||||
|
||||
export declare const COLOR_BayerBG2BGRA: ColorConversionCodes; // initializer: = 139
|
||||
|
||||
export declare const COLOR_BayerGB2BGRA: ColorConversionCodes; // initializer: = 140
|
||||
|
||||
export declare const COLOR_BayerRG2BGRA: ColorConversionCodes; // initializer: = 141
|
||||
|
||||
export declare const COLOR_BayerGR2BGRA: ColorConversionCodes; // initializer: = 142
|
||||
|
||||
export declare const COLOR_BayerBG2RGBA: ColorConversionCodes; // initializer: = COLOR_BayerRG2BGRA
|
||||
|
||||
export declare const COLOR_BayerGB2RGBA: ColorConversionCodes; // initializer: = COLOR_BayerGR2BGRA
|
||||
|
||||
export declare const COLOR_BayerRG2RGBA: ColorConversionCodes; // initializer: = COLOR_BayerBG2BGRA
|
||||
|
||||
export declare const COLOR_BayerGR2RGBA: ColorConversionCodes; // initializer: = COLOR_BayerGB2BGRA
|
||||
|
||||
export declare const COLOR_COLORCVT_MAX: ColorConversionCodes; // initializer: = 143
|
||||
|
||||
/**
|
||||
* the color conversion codes
|
||||
*
|
||||
* [Color conversions]
|
||||
*
|
||||
*/
|
||||
export type ColorConversionCodes = any;
|
||||
733
opencv-js-4.10.0/src/types/opencv/imgproc_draw.ts
Normal file
733
opencv-js-4.10.0/src/types/opencv/imgproc_draw.ts
Normal file
|
|
@ -0,0 +1,733 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
InputArray,
|
||||
InputArrayOfArrays,
|
||||
InputOutputArray,
|
||||
int,
|
||||
Point,
|
||||
Point2d,
|
||||
Rect,
|
||||
Scalar,
|
||||
Size,
|
||||
Size2d,
|
||||
Size2l,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Drawing Functions
|
||||
* Drawing functions work with matrices/images of arbitrary depth. The boundaries of the shapes can be rendered with antialiasing (implemented only for 8-bit images for now). All the functions include the parameter color that uses an RGB value (that may be constructed with the Scalar constructor ) for color images and brightness for grayscale images. For color images, the channel ordering is normally *Blue, Green, Red*. This is what imshow, imread, and imwrite expect. So, if you form a color using the Scalar constructor, it should look like:
|
||||
*
|
||||
* `\[\texttt{Scalar} (blue \_ component, green \_ component, red \_ component[, alpha \_ component])\]`
|
||||
*
|
||||
* If you are using your own image rendering and I/O functions, you can use any channel ordering. The drawing functions process each channel independently and do not depend on the channel order or even on the used color space. The whole image can be converted from BGR to RGB or to a different color space using cvtColor .
|
||||
*
|
||||
* If a drawn figure is partially or completely outside the image, the drawing functions clip it. Also, many drawing functions can handle pixel coordinates specified with sub-pixel accuracy. This means that the coordinates can be passed as fixed-point numbers encoded as integers. The number of fractional bits is specified by the shift parameter and the real point coordinates are calculated as `$\texttt{Point}(x,y)\rightarrow\texttt{Point2f}(x*2^{-shift},y*2^{-shift})$` . This feature is especially effective when rendering antialiased shapes.
|
||||
*
|
||||
*
|
||||
*
|
||||
* The functions do not support alpha-transparency when the target image is 4-channel. In this case, the color[3] is simply copied to the repainted pixels. Thus, if you want to paint semi-transparent shapes, you can paint them in a separate buffer and then blend it with the main image.
|
||||
*/
|
||||
/**
|
||||
* The function [cv::arrowedLine] draws an arrow between pt1 and pt2 points in the image. See also
|
||||
* [line].
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param pt1 The point the arrow starts from.
|
||||
*
|
||||
* @param pt2 The point the arrow points to.
|
||||
*
|
||||
* @param color Line color.
|
||||
*
|
||||
* @param thickness Line thickness.
|
||||
*
|
||||
* @param line_type Type of the line. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the point coordinates.
|
||||
*
|
||||
* @param tipLength The length of the arrow tip in relation to the arrow length
|
||||
*/
|
||||
export declare function arrowedLine(
|
||||
img: InputOutputArray,
|
||||
pt1: Point,
|
||||
pt2: Point,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
line_type?: int,
|
||||
shift?: int,
|
||||
tipLength?: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::circle] draws a simple or filled circle with a given center and radius.
|
||||
*
|
||||
* @param img Image where the circle is drawn.
|
||||
*
|
||||
* @param center Center of the circle.
|
||||
*
|
||||
* @param radius Radius of the circle.
|
||||
*
|
||||
* @param color Circle color.
|
||||
*
|
||||
* @param thickness Thickness of the circle outline, if positive. Negative values, like FILLED, mean
|
||||
* that a filled circle is to be drawn.
|
||||
*
|
||||
* @param lineType Type of the circle boundary. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the coordinates of the center and in the radius value.
|
||||
*/
|
||||
export declare function circle(
|
||||
img: InputOutputArray,
|
||||
center: Point,
|
||||
radius: int,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::clipLine] calculates a part of the line segment that is entirely within the
|
||||
* specified rectangle. it returns false if the line segment is completely outside the rectangle.
|
||||
* Otherwise, it returns true .
|
||||
*
|
||||
* @param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) .
|
||||
*
|
||||
* @param pt1 First line point.
|
||||
*
|
||||
* @param pt2 Second line point.
|
||||
*/
|
||||
export declare function clipLine(imgSize: Size, pt1: any, pt2: any): bool;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* @param imgSize Image size. The image rectangle is Rect(0, 0, imgSize.width, imgSize.height) .
|
||||
*
|
||||
* @param pt1 First line point.
|
||||
*
|
||||
* @param pt2 Second line point.
|
||||
*/
|
||||
export declare function clipLine(imgSize: Size2l, pt1: any, pt2: any): bool;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* @param imgRect Image rectangle.
|
||||
*
|
||||
* @param pt1 First line point.
|
||||
*
|
||||
* @param pt2 Second line point.
|
||||
*/
|
||||
export declare function clipLine(imgRect: Rect, pt1: any, pt2: any): bool;
|
||||
|
||||
/**
|
||||
* The function draws contour outlines in the image if `$\\texttt{thickness} \\ge 0$` or fills the area
|
||||
* bounded by the contours if `$\\texttt{thickness}<0$` . The example below shows how to retrieve
|
||||
* connected components from the binary image and label them: :
|
||||
*
|
||||
* ```cpp
|
||||
* #include "opencv2/imgproc.hpp"
|
||||
* #include "opencv2/highgui.hpp"
|
||||
*
|
||||
* using namespace cv;
|
||||
* using namespace std;
|
||||
*
|
||||
* int main( int argc, char** argv )
|
||||
* {
|
||||
* Mat src;
|
||||
* // the first command-line parameter must be a filename of the binary
|
||||
* // (black-n-white) image
|
||||
* if( argc != 2 || !(src=imread(argv[1], 0)).data)
|
||||
* return -1;
|
||||
*
|
||||
* Mat dst = Mat::zeros(src.rows, src.cols, CV_8UC3);
|
||||
*
|
||||
* src = src > 1;
|
||||
* namedWindow( "Source", 1 );
|
||||
* imshow( "Source", src );
|
||||
*
|
||||
* vector<vector<Point> > contours;
|
||||
* vector<Vec4i> hierarchy;
|
||||
*
|
||||
* findContours( src, contours, hierarchy,
|
||||
* RETR_CCOMP, CHAIN_APPROX_SIMPLE );
|
||||
*
|
||||
* // iterate through all the top-level contours,
|
||||
* // draw each connected component with its own random color
|
||||
* int idx = 0;
|
||||
* for( ; idx >= 0; idx = hierarchy[idx][0] )
|
||||
* {
|
||||
* Scalar color( rand()&255, rand()&255, rand()&255 );
|
||||
* drawContours( dst, contours, idx, color, FILLED, 8, hierarchy );
|
||||
* }
|
||||
*
|
||||
* namedWindow( "Components", 1 );
|
||||
* imshow( "Components", dst );
|
||||
* waitKey(0);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* When thickness=[FILLED], the function is designed to handle connected components with holes
|
||||
* correctly even when no hierarchy date is provided. This is done by analyzing all the outlines
|
||||
* together using even-odd rule. This may give incorrect results if you have a joint collection of
|
||||
* separately retrieved contours. In order to solve this problem, you need to call [drawContours]
|
||||
* separately for each sub-group of contours, or iterate over the collection using contourIdx
|
||||
* parameter.
|
||||
*
|
||||
* @param image Destination image.
|
||||
*
|
||||
* @param contours All the input contours. Each contour is stored as a point vector.
|
||||
*
|
||||
* @param contourIdx Parameter indicating a contour to draw. If it is negative, all the contours are
|
||||
* drawn.
|
||||
*
|
||||
* @param color Color of the contours.
|
||||
*
|
||||
* @param thickness Thickness of lines the contours are drawn with. If it is negative (for example,
|
||||
* thickness=FILLED ), the contour interiors are drawn.
|
||||
*
|
||||
* @param lineType Line connectivity. See LineTypes
|
||||
*
|
||||
* @param hierarchy Optional information about hierarchy. It is only needed if you want to draw only
|
||||
* some of the contours (see maxLevel ).
|
||||
*
|
||||
* @param maxLevel Maximal level for drawn contours. If it is 0, only the specified contour is drawn.
|
||||
* If it is 1, the function draws the contour(s) and all the nested contours. If it is 2, the function
|
||||
* draws the contours, all the nested contours, all the nested-to-nested contours, and so on. This
|
||||
* parameter is only taken into account when there is hierarchy available.
|
||||
*
|
||||
* @param offset Optional contour shift parameter. Shift all the drawn contours by the specified
|
||||
* $\texttt{offset}=(dx,dy)$ .
|
||||
*/
|
||||
export declare function drawContours(
|
||||
image: InputOutputArray,
|
||||
contours: InputArrayOfArrays,
|
||||
contourIdx: int,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
hierarchy?: InputArray,
|
||||
maxLevel?: int,
|
||||
offset?: Point,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::drawMarker] draws a marker on a given position in the image. For the moment
|
||||
* several marker types are supported, see [MarkerTypes] for more information.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param position The point where the crosshair is positioned.
|
||||
*
|
||||
* @param color Line color.
|
||||
*
|
||||
* @param markerType The specific type of marker you want to use, see MarkerTypes
|
||||
*
|
||||
* @param markerSize The length of the marker axis [default = 20 pixels]
|
||||
*
|
||||
* @param thickness Line thickness.
|
||||
*
|
||||
* @param line_type Type of the line, See LineTypes
|
||||
*/
|
||||
export declare function drawMarker(
|
||||
img: InputOutputArray,
|
||||
position: Point,
|
||||
color: any,
|
||||
markerType?: int,
|
||||
markerSize?: int,
|
||||
thickness?: int,
|
||||
line_type?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::ellipse] with more parameters draws an ellipse outline, a filled ellipse, an
|
||||
* elliptic arc, or a filled ellipse sector. The drawing code uses general parametric form. A
|
||||
* piecewise-linear curve is used to approximate the elliptic arc boundary. If you need more control of
|
||||
* the ellipse rendering, you can retrieve the curve using [ellipse2Poly] and then render it with
|
||||
* [polylines] or fill it with [fillPoly]. If you use the first variant of the function and want to
|
||||
* draw the whole ellipse, not an arc, pass `startAngle=0` and `endAngle=360`. If `startAngle` is
|
||||
* greater than `endAngle`, they are swapped. The figure below explains the meaning of the parameters
|
||||
* to draw the blue arc.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param center Center of the ellipse.
|
||||
*
|
||||
* @param axes Half of the size of the ellipse main axes.
|
||||
*
|
||||
* @param angle Ellipse rotation angle in degrees.
|
||||
*
|
||||
* @param startAngle Starting angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param endAngle Ending angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param color Ellipse color.
|
||||
*
|
||||
* @param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that a
|
||||
* filled ellipse sector is to be drawn.
|
||||
*
|
||||
* @param lineType Type of the ellipse boundary. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the coordinates of the center and values of axes.
|
||||
*/
|
||||
export declare function ellipse(
|
||||
img: InputOutputArray,
|
||||
center: Point,
|
||||
axes: Size,
|
||||
angle: double,
|
||||
startAngle: double,
|
||||
endAngle: double,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param box Alternative ellipse representation via RotatedRect. This means that the function draws an
|
||||
* ellipse inscribed in the rotated rectangle.
|
||||
*
|
||||
* @param color Ellipse color.
|
||||
*
|
||||
* @param thickness Thickness of the ellipse arc outline, if positive. Otherwise, this indicates that a
|
||||
* filled ellipse sector is to be drawn.
|
||||
*
|
||||
* @param lineType Type of the ellipse boundary. See LineTypes
|
||||
*/
|
||||
export declare function ellipse(
|
||||
img: InputOutputArray,
|
||||
box: any,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function ellipse2Poly computes the vertices of a polyline that approximates the specified
|
||||
* elliptic arc. It is used by [ellipse]. If `arcStart` is greater than `arcEnd`, they are swapped.
|
||||
*
|
||||
* @param center Center of the arc.
|
||||
*
|
||||
* @param axes Half of the size of the ellipse main axes. See ellipse for details.
|
||||
*
|
||||
* @param angle Rotation angle of the ellipse in degrees. See ellipse for details.
|
||||
*
|
||||
* @param arcStart Starting angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param arcEnd Ending angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param delta Angle between the subsequent polyline vertices. It defines the approximation accuracy.
|
||||
*
|
||||
* @param pts Output vector of polyline vertices.
|
||||
*/
|
||||
export declare function ellipse2Poly(
|
||||
center: Point,
|
||||
axes: Size,
|
||||
angle: int,
|
||||
arcStart: int,
|
||||
arcEnd: int,
|
||||
delta: int,
|
||||
pts: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* @param center Center of the arc.
|
||||
*
|
||||
* @param axes Half of the size of the ellipse main axes. See ellipse for details.
|
||||
*
|
||||
* @param angle Rotation angle of the ellipse in degrees. See ellipse for details.
|
||||
*
|
||||
* @param arcStart Starting angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param arcEnd Ending angle of the elliptic arc in degrees.
|
||||
*
|
||||
* @param delta Angle between the subsequent polyline vertices. It defines the approximation accuracy.
|
||||
*
|
||||
* @param pts Output vector of polyline vertices.
|
||||
*/
|
||||
export declare function ellipse2Poly(
|
||||
center: Point2d,
|
||||
axes: Size2d,
|
||||
angle: int,
|
||||
arcStart: int,
|
||||
arcEnd: int,
|
||||
delta: int,
|
||||
pts: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function fillConvexPoly(
|
||||
img: InputOutputArray,
|
||||
pts: any,
|
||||
npts: int,
|
||||
color: any,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::fillConvexPoly] draws a filled convex polygon. This function is much faster than
|
||||
* the function [fillPoly] . It can fill not only convex polygons but any monotonic polygon without
|
||||
* self-intersections, that is, a polygon whose contour intersects every horizontal line (scan line)
|
||||
* twice at the most (though, its top-most and/or the bottom edge could be horizontal).
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param points Polygon vertices.
|
||||
*
|
||||
* @param color Polygon color.
|
||||
*
|
||||
* @param lineType Type of the polygon boundaries. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the vertex coordinates.
|
||||
*/
|
||||
export declare function fillConvexPoly(
|
||||
img: InputOutputArray,
|
||||
points: InputArray,
|
||||
color: any,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function fillPoly(
|
||||
img: InputOutputArray,
|
||||
pts: any,
|
||||
npts: any,
|
||||
ncontours: int,
|
||||
color: any,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
offset?: Point,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::fillPoly] fills an area bounded by several polygonal contours. The function can
|
||||
* fill complex areas, for example, areas with holes, contours with self-intersections (some of their
|
||||
* parts), and so forth.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param pts Array of polygons where each polygon is represented as an array of points.
|
||||
*
|
||||
* @param color Polygon color.
|
||||
*
|
||||
* @param lineType Type of the polygon boundaries. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the vertex coordinates.
|
||||
*
|
||||
* @param offset Optional offset of all points of the contours.
|
||||
*/
|
||||
export declare function fillPoly(
|
||||
img: InputOutputArray,
|
||||
pts: InputArrayOfArrays,
|
||||
color: any,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
offset?: Point,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The fontSize to use for [cv::putText]
|
||||
*
|
||||
* [cv::putText]
|
||||
*
|
||||
* @param fontFace Font to use, see cv::HersheyFonts.
|
||||
*
|
||||
* @param pixelHeight Pixel height to compute the fontScale for
|
||||
*
|
||||
* @param thickness Thickness of lines used to render the text.See putText for details.
|
||||
*/
|
||||
export declare function getFontScaleFromHeight(
|
||||
fontFace: any,
|
||||
pixelHeight: any,
|
||||
thickness?: any,
|
||||
): double;
|
||||
|
||||
/**
|
||||
* The function [cv::getTextSize] calculates and returns the size of a box that contains the specified
|
||||
* text. That is, the following code renders some text, the tight box surrounding it, and the baseline:
|
||||
* :
|
||||
*
|
||||
* ```cpp
|
||||
* String text = "Funny text inside the box";
|
||||
* int fontFace = FONT_HERSHEY_SCRIPT_SIMPLEX;
|
||||
* double fontScale = 2;
|
||||
* int thickness = 3;
|
||||
*
|
||||
* Mat img(600, 800, CV_8UC3, Scalar::all(0));
|
||||
*
|
||||
* int baseline=0;
|
||||
* Size textSize = getTextSize(text, fontFace,
|
||||
* fontScale, thickness, &baseline);
|
||||
* baseline += thickness;
|
||||
*
|
||||
* // center the text
|
||||
* Point textOrg((img.cols - textSize.width)/2,
|
||||
* (img.rows + textSize.height)/2);
|
||||
*
|
||||
* // draw the box
|
||||
* rectangle(img, textOrg + Point(0, baseline),
|
||||
* textOrg + Point(textSize.width, -textSize.height),
|
||||
* Scalar(0,0,255));
|
||||
* // ... and the baseline first
|
||||
* line(img, textOrg + Point(0, thickness),
|
||||
* textOrg + Point(textSize.width, thickness),
|
||||
* Scalar(0, 0, 255));
|
||||
*
|
||||
* // then put the text itself
|
||||
* putText(img, text, textOrg, fontFace, fontScale,
|
||||
* Scalar::all(255), thickness, 8);
|
||||
* ```
|
||||
*
|
||||
* The size of a box that contains the specified text.
|
||||
*
|
||||
* [putText]
|
||||
*
|
||||
* @param text Input text string.
|
||||
*
|
||||
* @param fontFace Font to use, see HersheyFonts.
|
||||
*
|
||||
* @param fontScale Font scale factor that is multiplied by the font-specific base size.
|
||||
*
|
||||
* @param thickness Thickness of lines used to render the text. See putText for details.
|
||||
*
|
||||
* @param baseLine y-coordinate of the baseline relative to the bottom-most text point.
|
||||
*/
|
||||
export declare function getTextSize(
|
||||
text: any,
|
||||
fontFace: int,
|
||||
fontScale: double,
|
||||
thickness: int,
|
||||
baseLine: any,
|
||||
): Size;
|
||||
|
||||
/**
|
||||
* The function line draws the line segment between pt1 and pt2 points in the image. The line is
|
||||
* clipped by the image boundaries. For non-antialiased lines with integer coordinates, the 8-connected
|
||||
* or 4-connected Bresenham algorithm is used. Thick lines are drawn with rounding endings. Antialiased
|
||||
* lines are drawn using Gaussian filtering.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param pt1 First point of the line segment.
|
||||
*
|
||||
* @param pt2 Second point of the line segment.
|
||||
*
|
||||
* @param color Line color.
|
||||
*
|
||||
* @param thickness Line thickness.
|
||||
*
|
||||
* @param lineType Type of the line. See LineTypes.
|
||||
*
|
||||
* @param shift Number of fractional bits in the point coordinates.
|
||||
*/
|
||||
export declare function line(
|
||||
img: InputOutputArray,
|
||||
pt1: Point,
|
||||
pt2: Point,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*/
|
||||
export declare function polylines(
|
||||
img: InputOutputArray,
|
||||
pts: any,
|
||||
npts: any,
|
||||
ncontours: int,
|
||||
isClosed: bool,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::polylines] draws one or more polygonal curves.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param pts Array of polygonal curves.
|
||||
*
|
||||
* @param isClosed Flag indicating whether the drawn polylines are closed or not. If they are closed,
|
||||
* the function draws a line from the last vertex of each curve to its first vertex.
|
||||
*
|
||||
* @param color Polyline color.
|
||||
*
|
||||
* @param thickness Thickness of the polyline edges.
|
||||
*
|
||||
* @param lineType Type of the line segments. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the vertex coordinates.
|
||||
*/
|
||||
export declare function polylines(
|
||||
img: InputOutputArray,
|
||||
pts: InputArrayOfArrays,
|
||||
isClosed: bool,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::putText] renders the specified text string in the image. Symbols that cannot be
|
||||
* rendered using the specified font are replaced by question marks. See [getTextSize] for a text
|
||||
* rendering code example.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param text Text string to be drawn.
|
||||
*
|
||||
* @param org Bottom-left corner of the text string in the image.
|
||||
*
|
||||
* @param fontFace Font type, see HersheyFonts.
|
||||
*
|
||||
* @param fontScale Font scale factor that is multiplied by the font-specific base size.
|
||||
*
|
||||
* @param color Text color.
|
||||
*
|
||||
* @param thickness Thickness of the lines used to draw a text.
|
||||
*
|
||||
* @param lineType Line type. See LineTypes
|
||||
*
|
||||
* @param bottomLeftOrigin When true, the image data origin is at the bottom-left corner. Otherwise, it
|
||||
* is at the top-left corner.
|
||||
*/
|
||||
export declare function putText(
|
||||
img: InputOutputArray,
|
||||
text: any,
|
||||
org: Point,
|
||||
fontFace: int,
|
||||
fontScale: double,
|
||||
color: Scalar,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
bottomLeftOrigin?: bool,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function [cv::rectangle] draws a rectangle outline or a filled rectangle whose two opposite
|
||||
* corners are pt1 and pt2.
|
||||
*
|
||||
* @param img Image.
|
||||
*
|
||||
* @param pt1 Vertex of the rectangle.
|
||||
*
|
||||
* @param pt2 Vertex of the rectangle opposite to pt1 .
|
||||
*
|
||||
* @param color Rectangle color or brightness (grayscale image).
|
||||
*
|
||||
* @param thickness Thickness of lines that make up the rectangle. Negative values, like FILLED, mean
|
||||
* that the function has to draw a filled rectangle.
|
||||
*
|
||||
* @param lineType Type of the line. See LineTypes
|
||||
*
|
||||
* @param shift Number of fractional bits in the point coordinates.
|
||||
*/
|
||||
export declare function rectangle(
|
||||
img: InputOutputArray,
|
||||
pt1: Point,
|
||||
pt2: Point,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* use `rec` parameter as alternative specification of the drawn rectangle: `r.tl() and
|
||||
* r.br()-Point(1,1)` are opposite corners
|
||||
*/
|
||||
export declare function rectangle(
|
||||
img: InputOutputArray,
|
||||
rec: Rect,
|
||||
color: any,
|
||||
thickness?: int,
|
||||
lineType?: int,
|
||||
shift?: int,
|
||||
): void;
|
||||
|
||||
export declare const FONT_HERSHEY_SIMPLEX: HersheyFonts; // initializer: = 0
|
||||
|
||||
export declare const FONT_HERSHEY_PLAIN: HersheyFonts; // initializer: = 1
|
||||
|
||||
export declare const FONT_HERSHEY_DUPLEX: HersheyFonts; // initializer: = 2
|
||||
|
||||
export declare const FONT_HERSHEY_COMPLEX: HersheyFonts; // initializer: = 3
|
||||
|
||||
export declare const FONT_HERSHEY_TRIPLEX: HersheyFonts; // initializer: = 4
|
||||
|
||||
export declare const FONT_HERSHEY_COMPLEX_SMALL: HersheyFonts; // initializer: = 5
|
||||
|
||||
export declare const FONT_HERSHEY_SCRIPT_SIMPLEX: HersheyFonts; // initializer: = 6
|
||||
|
||||
export declare const FONT_HERSHEY_SCRIPT_COMPLEX: HersheyFonts; // initializer: = 7
|
||||
|
||||
export declare const FONT_ITALIC: HersheyFonts; // initializer: = 16
|
||||
|
||||
export declare const FILLED: LineTypes; // initializer: = -1
|
||||
|
||||
export declare const LINE_4: LineTypes; // initializer: = 4
|
||||
|
||||
export declare const LINE_8: LineTypes; // initializer: = 8
|
||||
|
||||
export declare const LINE_AA: LineTypes; // initializer: = 16
|
||||
|
||||
export declare const MARKER_CROSS: MarkerTypes; // initializer: = 0
|
||||
|
||||
export declare const MARKER_TILTED_CROSS: MarkerTypes; // initializer: = 1
|
||||
|
||||
export declare const MARKER_STAR: MarkerTypes; // initializer: = 2
|
||||
|
||||
export declare const MARKER_DIAMOND: MarkerTypes; // initializer: = 3
|
||||
|
||||
export declare const MARKER_SQUARE: MarkerTypes; // initializer: = 4
|
||||
|
||||
export declare const MARKER_TRIANGLE_UP: MarkerTypes; // initializer: = 5
|
||||
|
||||
export declare const MARKER_TRIANGLE_DOWN: MarkerTypes; // initializer: = 6
|
||||
|
||||
/**
|
||||
* Only a subset of Hershey fonts are supported
|
||||
*
|
||||
*/
|
||||
export type HersheyFonts = any;
|
||||
|
||||
/**
|
||||
* Only a subset of Hershey fonts are supported
|
||||
*
|
||||
*/
|
||||
export type LineTypes = any;
|
||||
|
||||
/**
|
||||
* Only a subset of Hershey fonts are supported
|
||||
*
|
||||
*/
|
||||
export type MarkerTypes = any;
|
||||
681
opencv-js-4.10.0/src/types/opencv/imgproc_feature.ts
Normal file
681
opencv-js-4.10.0/src/types/opencv/imgproc_feature.ts
Normal file
|
|
@ -0,0 +1,681 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
InputArray,
|
||||
InputOutputArray,
|
||||
int,
|
||||
OutputArray,
|
||||
Size,
|
||||
TermCriteria,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Feature Detection
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* The function finds edges in the input image and marks them in the output map edges using the Canny
|
||||
* algorithm. The smallest value between threshold1 and threshold2 is used for edge linking. The
|
||||
* largest value is used to find initial segments of strong edges. See
|
||||
*
|
||||
* @param image 8-bit input image.
|
||||
*
|
||||
* @param edges output edge map; single channels 8-bit image, which has the same size as image .
|
||||
*
|
||||
* @param threshold1 first threshold for the hysteresis procedure.
|
||||
*
|
||||
* @param threshold2 second threshold for the hysteresis procedure.
|
||||
*
|
||||
* @param apertureSize aperture size for the Sobel operator.
|
||||
*
|
||||
* @param L2gradient a flag, indicating whether a more accurate $L_2$ norm $=\sqrt{(dI/dx)^2 +
|
||||
* (dI/dy)^2}$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether
|
||||
* the default $L_1$ norm $=|dI/dx|+|dI/dy|$ is enough ( L2gradient=false ).
|
||||
*/
|
||||
export declare function Canny(
|
||||
image: InputArray,
|
||||
edges: OutputArray,
|
||||
threshold1: double,
|
||||
threshold2: double,
|
||||
apertureSize?: int,
|
||||
L2gradient?: bool,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* This is an overloaded member function, provided for convenience. It differs from the above function
|
||||
* only in what argument(s) it accepts.
|
||||
*
|
||||
* Finds edges in an image using the Canny algorithm with custom image gradient.
|
||||
*
|
||||
* @param dx 16-bit x derivative of input image (CV_16SC1 or CV_16SC3).
|
||||
*
|
||||
* @param dy 16-bit y derivative of input image (same type as dx).
|
||||
*
|
||||
* @param edges output edge map; single channels 8-bit image, which has the same size as image .
|
||||
*
|
||||
* @param threshold1 first threshold for the hysteresis procedure.
|
||||
*
|
||||
* @param threshold2 second threshold for the hysteresis procedure.
|
||||
*
|
||||
* @param L2gradient a flag, indicating whether a more accurate $L_2$ norm $=\sqrt{(dI/dx)^2 +
|
||||
* (dI/dy)^2}$ should be used to calculate the image gradient magnitude ( L2gradient=true ), or whether
|
||||
* the default $L_1$ norm $=|dI/dx|+|dI/dy|$ is enough ( L2gradient=false ).
|
||||
*/
|
||||
export declare function Canny(
|
||||
dx: InputArray,
|
||||
dy: InputArray,
|
||||
edges: OutputArray,
|
||||
threshold1: double,
|
||||
threshold2: double,
|
||||
L2gradient?: bool,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* For every pixel `$p$` , the function cornerEigenValsAndVecs considers a blockSize `$\\times$`
|
||||
* blockSize neighborhood `$S(p)$` . It calculates the covariation matrix of derivatives over the
|
||||
* neighborhood as:
|
||||
*
|
||||
* `\\[M = \\begin{bmatrix} \\sum _{S(p)}(dI/dx)^2 & \\sum _{S(p)}dI/dx dI/dy \\\\ \\sum _{S(p)}dI/dx
|
||||
* dI/dy & \\sum _{S(p)}(dI/dy)^2 \\end{bmatrix}\\]`
|
||||
*
|
||||
* where the derivatives are computed using the Sobel operator.
|
||||
*
|
||||
* After that, it finds eigenvectors and eigenvalues of `$M$` and stores them in the destination image
|
||||
* as `$(\\lambda_1, \\lambda_2, x_1, y_1, x_2, y_2)$` where
|
||||
*
|
||||
* `$\\lambda_1, \\lambda_2$` are the non-sorted eigenvalues of `$M$`
|
||||
* `$x_1, y_1$` are the eigenvectors corresponding to `$\\lambda_1$`
|
||||
* `$x_2, y_2$` are the eigenvectors corresponding to `$\\lambda_2$`
|
||||
*
|
||||
* The output of the function can be used for robust edge or corner detection.
|
||||
*
|
||||
* [cornerMinEigenVal], [cornerHarris], [preCornerDetect]
|
||||
*
|
||||
* @param src Input single-channel 8-bit or floating-point image.
|
||||
*
|
||||
* @param dst Image to store the results. It has the same size as src and the type CV_32FC(6) .
|
||||
*
|
||||
* @param blockSize Neighborhood size (see details below).
|
||||
*
|
||||
* @param ksize Aperture parameter for the Sobel operator.
|
||||
*
|
||||
* @param borderType Pixel extrapolation method. See BorderTypes.
|
||||
*/
|
||||
export declare function cornerEigenValsAndVecs(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
blockSize: int,
|
||||
ksize: int,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function runs the Harris corner detector on the image. Similarly to cornerMinEigenVal and
|
||||
* cornerEigenValsAndVecs , for each pixel `$(x, y)$` it calculates a `$2\\times2$` gradient covariance
|
||||
* matrix `$M^{(x,y)}$` over a `$\\texttt{blockSize} \\times \\texttt{blockSize}$` neighborhood. Then,
|
||||
* it computes the following characteristic:
|
||||
*
|
||||
* `\\[\\texttt{dst} (x,y) = \\mathrm{det} M^{(x,y)} - k \\cdot \\left ( \\mathrm{tr} M^{(x,y)} \\right
|
||||
* )^2\\]`
|
||||
*
|
||||
* Corners in the image can be found as the local maxima of this response map.
|
||||
*
|
||||
* @param src Input single-channel 8-bit or floating-point image.
|
||||
*
|
||||
* @param dst Image to store the Harris detector responses. It has the type CV_32FC1 and the same size
|
||||
* as src .
|
||||
*
|
||||
* @param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
|
||||
*
|
||||
* @param ksize Aperture parameter for the Sobel operator.
|
||||
*
|
||||
* @param k Harris detector free parameter. See the formula above.
|
||||
*
|
||||
* @param borderType Pixel extrapolation method. See BorderTypes.
|
||||
*/
|
||||
export declare function cornerHarris(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
blockSize: int,
|
||||
ksize: int,
|
||||
k: double,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function is similar to cornerEigenValsAndVecs but it calculates and stores only the minimal
|
||||
* eigenvalue of the covariance matrix of derivatives, that is, `$\\min(\\lambda_1, \\lambda_2)$` in
|
||||
* terms of the formulae in the cornerEigenValsAndVecs description.
|
||||
*
|
||||
* @param src Input single-channel 8-bit or floating-point image.
|
||||
*
|
||||
* @param dst Image to store the minimal eigenvalues. It has the type CV_32FC1 and the same size as src
|
||||
* .
|
||||
*
|
||||
* @param blockSize Neighborhood size (see the details on cornerEigenValsAndVecs ).
|
||||
*
|
||||
* @param ksize Aperture parameter for the Sobel operator.
|
||||
*
|
||||
* @param borderType Pixel extrapolation method. See BorderTypes.
|
||||
*/
|
||||
export declare function cornerMinEigenVal(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
blockSize: int,
|
||||
ksize?: int,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function iterates to find the sub-pixel accurate location of corners or radial saddle points, as
|
||||
* shown on the figure below.
|
||||
*
|
||||
* Sub-pixel accurate corner locator is based on the observation that every vector from the center
|
||||
* `$q$` to a point `$p$` located within a neighborhood of `$q$` is orthogonal to the image gradient at
|
||||
* `$p$` subject to image and measurement noise. Consider the expression:
|
||||
*
|
||||
* `\\[\\epsilon _i = {DI_{p_i}}^T \\cdot (q - p_i)\\]`
|
||||
*
|
||||
* where `${DI_{p_i}}$` is an image gradient at one of the points `$p_i$` in a neighborhood of `$q$` .
|
||||
* The value of `$q$` is to be found so that `$\\epsilon_i$` is minimized. A system of equations may be
|
||||
* set up with `$\\epsilon_i$` set to zero:
|
||||
*
|
||||
* `\\[\\sum _i(DI_{p_i} \\cdot {DI_{p_i}}^T) \\cdot q - \\sum _i(DI_{p_i} \\cdot {DI_{p_i}}^T \\cdot
|
||||
* p_i)\\]`
|
||||
*
|
||||
* where the gradients are summed within a neighborhood ("search window") of `$q$` . Calling the first
|
||||
* gradient term `$G$` and the second gradient term `$b$` gives:
|
||||
*
|
||||
* `\\[q = G^{-1} \\cdot b\\]`
|
||||
*
|
||||
* The algorithm sets the center of the neighborhood window at this new center `$q$` and then iterates
|
||||
* until the center stays within a set threshold.
|
||||
*
|
||||
* @param image Input single-channel, 8-bit or float image.
|
||||
*
|
||||
* @param corners Initial coordinates of the input corners and refined coordinates provided for output.
|
||||
*
|
||||
* @param winSize Half of the side length of the search window. For example, if winSize=Size(5,5) ,
|
||||
* then a $(5*2+1) \times (5*2+1) = 11 \times 11$ search window is used.
|
||||
*
|
||||
* @param zeroZone Half of the size of the dead region in the middle of the search zone over which the
|
||||
* summation in the formula below is not done. It is used sometimes to avoid possible singularities of
|
||||
* the autocorrelation matrix. The value of (-1,-1) indicates that there is no such a size.
|
||||
*
|
||||
* @param criteria Criteria for termination of the iterative process of corner refinement. That is, the
|
||||
* process of corner position refinement stops either after criteria.maxCount iterations or when the
|
||||
* corner position moves by less than criteria.epsilon on some iteration.
|
||||
*/
|
||||
export declare function cornerSubPix(
|
||||
image: InputArray,
|
||||
corners: InputOutputArray,
|
||||
winSize: Size,
|
||||
zeroZone: Size,
|
||||
criteria: TermCriteria,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The [LineSegmentDetector] algorithm is defined using the standard values. Only advanced users may
|
||||
* want to edit those, as to tailor it for their own application.
|
||||
*
|
||||
* Implementation has been removed due original code license conflict
|
||||
*
|
||||
* @param _refine The way found lines will be refined, see LineSegmentDetectorModes
|
||||
*
|
||||
* @param _scale The scale of the image that will be used to find the lines. Range (0..1].
|
||||
*
|
||||
* @param _sigma_scale Sigma for Gaussian filter. It is computed as sigma = _sigma_scale/_scale.
|
||||
*
|
||||
* @param _quant Bound to the quantization error on the gradient norm.
|
||||
*
|
||||
* @param _ang_th Gradient angle tolerance in degrees.
|
||||
*
|
||||
* @param _log_eps Detection threshold: -log10(NFA) > log_eps. Used only when advance refinement is
|
||||
* chosen.
|
||||
*
|
||||
* @param _density_th Minimal density of aligned region points in the enclosing rectangle.
|
||||
*
|
||||
* @param _n_bins Number of bins in pseudo-ordering of gradient modulus.
|
||||
*/
|
||||
export declare function createLineSegmentDetector(
|
||||
_refine?: int,
|
||||
_scale?: double,
|
||||
_sigma_scale?: double,
|
||||
_quant?: double,
|
||||
_ang_th?: double,
|
||||
_log_eps?: double,
|
||||
_density_th?: double,
|
||||
_n_bins?: int,
|
||||
): any;
|
||||
|
||||
/**
|
||||
* The function finds the most prominent corners in the image or in the specified image region, as
|
||||
* described in Shi94
|
||||
*
|
||||
* Function calculates the corner quality measure at every source image pixel using the
|
||||
* [cornerMinEigenVal] or [cornerHarris] .
|
||||
* Function performs a non-maximum suppression (the local maximums in *3 x 3* neighborhood are
|
||||
* retained).
|
||||
* The corners with the minimal eigenvalue less than `$\\texttt{qualityLevel} \\cdot \\max_{x,y}
|
||||
* qualityMeasureMap(x,y)$` are rejected.
|
||||
* The remaining corners are sorted by the quality measure in the descending order.
|
||||
* Function throws away each corner for which there is a stronger corner at a distance less than
|
||||
* maxDistance.
|
||||
*
|
||||
* The function can be used to initialize a point-based tracker of an object.
|
||||
*
|
||||
* If the function is called with different values A and B of the parameter qualityLevel , and A > B,
|
||||
* the vector of returned corners with qualityLevel=A will be the prefix of the output vector with
|
||||
* qualityLevel=B .
|
||||
*
|
||||
* [cornerMinEigenVal], [cornerHarris], [calcOpticalFlowPyrLK], [estimateRigidTransform],
|
||||
*
|
||||
* @param image Input 8-bit or floating-point 32-bit, single-channel image.
|
||||
*
|
||||
* @param corners Output vector of detected corners.
|
||||
*
|
||||
* @param maxCorners Maximum number of corners to return. If there are more corners than are found, the
|
||||
* strongest of them is returned. maxCorners <= 0 implies that no limit on the maximum is set and all
|
||||
* detected corners are returned.
|
||||
*
|
||||
* @param qualityLevel Parameter characterizing the minimal accepted quality of image corners. The
|
||||
* parameter value is multiplied by the best corner quality measure, which is the minimal eigenvalue
|
||||
* (see cornerMinEigenVal ) or the Harris function response (see cornerHarris ). The corners with the
|
||||
* quality measure less than the product are rejected. For example, if the best corner has the quality
|
||||
* measure = 1500, and the qualityLevel=0.01 , then all the corners with the quality measure less than
|
||||
* 15 are rejected.
|
||||
*
|
||||
* @param minDistance Minimum possible Euclidean distance between the returned corners.
|
||||
*
|
||||
* @param mask Optional region of interest. If the image is not empty (it needs to have the type
|
||||
* CV_8UC1 and the same size as image ), it specifies the region in which the corners are detected.
|
||||
*
|
||||
* @param blockSize Size of an average block for computing a derivative covariation matrix over each
|
||||
* pixel neighborhood. See cornerEigenValsAndVecs .
|
||||
*
|
||||
* @param useHarrisDetector Parameter indicating whether to use a Harris detector (see cornerHarris) or
|
||||
* cornerMinEigenVal.
|
||||
*
|
||||
* @param k Free parameter of the Harris detector.
|
||||
*/
|
||||
export declare function goodFeaturesToTrack(
|
||||
image: InputArray,
|
||||
corners: OutputArray,
|
||||
maxCorners: int,
|
||||
qualityLevel: double,
|
||||
minDistance: double,
|
||||
mask?: InputArray,
|
||||
blockSize?: int,
|
||||
useHarrisDetector?: bool,
|
||||
k?: double,
|
||||
): void;
|
||||
|
||||
export declare function goodFeaturesToTrack(
|
||||
image: InputArray,
|
||||
corners: OutputArray,
|
||||
maxCorners: int,
|
||||
qualityLevel: double,
|
||||
minDistance: double,
|
||||
mask: InputArray,
|
||||
blockSize: int,
|
||||
gradientSize: int,
|
||||
useHarrisDetector?: bool,
|
||||
k?: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function finds circles in a grayscale image using a modification of the Hough transform.
|
||||
*
|
||||
* Example: :
|
||||
*
|
||||
* ```cpp
|
||||
* #include <opencv2/imgproc.hpp>
|
||||
* #include <opencv2/highgui.hpp>
|
||||
* #include <math.h>
|
||||
*
|
||||
* using namespace cv;
|
||||
* using namespace std;
|
||||
*
|
||||
* int main(int argc, char** argv)
|
||||
* {
|
||||
* Mat img, gray;
|
||||
* if( argc != 2 || !(img=imread(argv[1], 1)).data)
|
||||
* return -1;
|
||||
* cvtColor(img, gray, COLOR_BGR2GRAY);
|
||||
* // smooth it, otherwise a lot of false circles may be detected
|
||||
* GaussianBlur( gray, gray, Size(9, 9), 2, 2 );
|
||||
* vector<Vec3f> circles;
|
||||
* HoughCircles(gray, circles, HOUGH_GRADIENT,
|
||||
* 2, gray.rows/4, 200, 100 );
|
||||
* for( size_t i = 0; i < circles.size(); i++ )
|
||||
* {
|
||||
* Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
|
||||
* int radius = cvRound(circles[i][2]);
|
||||
* // draw the circle center
|
||||
* circle( img, center, 3, Scalar(0,255,0), -1, 8, 0 );
|
||||
* // draw the circle outline
|
||||
* circle( img, center, radius, Scalar(0,0,255), 3, 8, 0 );
|
||||
* }
|
||||
* namedWindow( "circles", 1 );
|
||||
* imshow( "circles", img );
|
||||
*
|
||||
* waitKey(0);
|
||||
* return 0;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* Usually the function detects the centers of circles well. However, it may fail to find correct
|
||||
* radii. You can assist to the function by specifying the radius range ( minRadius and maxRadius ) if
|
||||
* you know it. Or, you may set maxRadius to a negative number to return centers only without radius
|
||||
* search, and find the correct radius using an additional procedure.
|
||||
*
|
||||
* [fitEllipse], [minEnclosingCircle]
|
||||
*
|
||||
* @param image 8-bit, single-channel, grayscale input image.
|
||||
*
|
||||
* @param circles Output vector of found circles. Each vector is encoded as 3 or 4 element
|
||||
* floating-point vector $(x, y, radius)$ or $(x, y, radius, votes)$ .
|
||||
*
|
||||
* @param method Detection method, see HoughModes. Currently, the only implemented method is
|
||||
* HOUGH_GRADIENT
|
||||
*
|
||||
* @param dp Inverse ratio of the accumulator resolution to the image resolution. For example, if dp=1
|
||||
* , the accumulator has the same resolution as the input image. If dp=2 , the accumulator has half as
|
||||
* big width and height.
|
||||
*
|
||||
* @param minDist Minimum distance between the centers of the detected circles. If the parameter is too
|
||||
* small, multiple neighbor circles may be falsely detected in addition to a true one. If it is too
|
||||
* large, some circles may be missed.
|
||||
*
|
||||
* @param param1 First method-specific parameter. In case of HOUGH_GRADIENT , it is the higher
|
||||
* threshold of the two passed to the Canny edge detector (the lower one is twice smaller).
|
||||
*
|
||||
* @param param2 Second method-specific parameter. In case of HOUGH_GRADIENT , it is the accumulator
|
||||
* threshold for the circle centers at the detection stage. The smaller it is, the more false circles
|
||||
* may be detected. Circles, corresponding to the larger accumulator values, will be returned first.
|
||||
*
|
||||
* @param minRadius Minimum circle radius.
|
||||
*
|
||||
* @param maxRadius Maximum circle radius. If <= 0, uses the maximum image dimension. If < 0, returns
|
||||
* centers without finding the radius.
|
||||
*/
|
||||
export declare function HoughCircles(
|
||||
image: InputArray,
|
||||
circles: OutputArray,
|
||||
method: int,
|
||||
dp: double,
|
||||
minDist: double,
|
||||
param1?: double,
|
||||
param2?: double,
|
||||
minRadius?: int,
|
||||
maxRadius?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function implements the standard or standard multi-scale Hough transform algorithm for line
|
||||
* detection. See for a good explanation of Hough transform.
|
||||
*
|
||||
* @param image 8-bit, single-channel binary source image. The image may be modified by the function.
|
||||
*
|
||||
* @param lines Output vector of lines. Each line is represented by a 2 or 3 element vector $(\rho,
|
||||
* \theta)$ or $(\rho, \theta, \textrm{votes})$ . $\rho$ is the distance from the coordinate origin
|
||||
* $(0,0)$ (top-left corner of the image). $\theta$ is the line rotation angle in radians ( $0 \sim
|
||||
* \textrm{vertical line}, \pi/2 \sim \textrm{horizontal line}$ ). $\textrm{votes}$ is the value of
|
||||
* accumulator.
|
||||
*
|
||||
* @param rho Distance resolution of the accumulator in pixels.
|
||||
*
|
||||
* @param theta Angle resolution of the accumulator in radians.
|
||||
*
|
||||
* @param threshold Accumulator threshold parameter. Only those lines are returned that get enough
|
||||
* votes ( $>\texttt{threshold}$ ).
|
||||
*
|
||||
* @param srn For the multi-scale Hough transform, it is a divisor for the distance resolution rho .
|
||||
* The coarse accumulator distance resolution is rho and the accurate accumulator resolution is rho/srn
|
||||
* . If both srn=0 and stn=0 , the classical Hough transform is used. Otherwise, both these parameters
|
||||
* should be positive.
|
||||
*
|
||||
* @param stn For the multi-scale Hough transform, it is a divisor for the distance resolution theta.
|
||||
*
|
||||
* @param min_theta For standard and multi-scale Hough transform, minimum angle to check for lines.
|
||||
* Must fall between 0 and max_theta.
|
||||
*
|
||||
* @param max_theta For standard and multi-scale Hough transform, maximum angle to check for lines.
|
||||
* Must fall between min_theta and CV_PI.
|
||||
*/
|
||||
export declare function HoughLines(
|
||||
image: InputArray,
|
||||
lines: OutputArray,
|
||||
rho: double,
|
||||
theta: double,
|
||||
threshold: int,
|
||||
srn?: double,
|
||||
stn?: double,
|
||||
min_theta?: double,
|
||||
max_theta?: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function implements the probabilistic Hough transform algorithm for line detection, described in
|
||||
* Matas00
|
||||
*
|
||||
* See the line detection example below:
|
||||
*
|
||||
* ```cpp
|
||||
* #include <opencv2/imgproc.hpp>
|
||||
* #include <opencv2/highgui.hpp>
|
||||
*
|
||||
* using namespace cv;
|
||||
* using namespace std;
|
||||
*
|
||||
* int main(int argc, char** argv)
|
||||
* {
|
||||
* Mat src, dst, color_dst;
|
||||
* if( argc != 2 || !(src=imread(argv[1], 0)).data)
|
||||
* return -1;
|
||||
*
|
||||
* Canny( src, dst, 50, 200, 3 );
|
||||
* cvtColor( dst, color_dst, COLOR_GRAY2BGR );
|
||||
*
|
||||
* vector<Vec4i> lines;
|
||||
* HoughLinesP( dst, lines, 1, CV_PI/180, 80, 30, 10 );
|
||||
* for( size_t i = 0; i < lines.size(); i++ )
|
||||
* {
|
||||
* line( color_dst, Point(lines[i][0], lines[i][1]),
|
||||
* Point( lines[i][2], lines[i][3]), Scalar(0,0,255), 3, 8 );
|
||||
* }
|
||||
* namedWindow( "Source", 1 );
|
||||
* imshow( "Source", src );
|
||||
*
|
||||
* namedWindow( "Detected Lines", 1 );
|
||||
* imshow( "Detected Lines", color_dst );
|
||||
*
|
||||
* waitKey(0);
|
||||
* return 0;
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* This is a sample picture the function parameters have been tuned for:
|
||||
*
|
||||
* And this is the output of the above program in case of the probabilistic Hough transform:
|
||||
*
|
||||
* [LineSegmentDetector]
|
||||
*
|
||||
* @param image 8-bit, single-channel binary source image. The image may be modified by the function.
|
||||
*
|
||||
* @param lines Output vector of lines. Each line is represented by a 4-element vector $(x_1, y_1, x_2,
|
||||
* y_2)$ , where $(x_1,y_1)$ and $(x_2, y_2)$ are the ending points of each detected line segment.
|
||||
*
|
||||
* @param rho Distance resolution of the accumulator in pixels.
|
||||
*
|
||||
* @param theta Angle resolution of the accumulator in radians.
|
||||
*
|
||||
* @param threshold Accumulator threshold parameter. Only those lines are returned that get enough
|
||||
* votes ( $>\texttt{threshold}$ ).
|
||||
*
|
||||
* @param minLineLength Minimum line length. Line segments shorter than that are rejected.
|
||||
*
|
||||
* @param maxLineGap Maximum allowed gap between points on the same line to link them.
|
||||
*/
|
||||
export declare function HoughLinesP(
|
||||
image: InputArray,
|
||||
lines: OutputArray,
|
||||
rho: double,
|
||||
theta: double,
|
||||
threshold: int,
|
||||
minLineLength?: double,
|
||||
maxLineGap?: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function finds lines in a set of points using a modification of the Hough transform.
|
||||
*
|
||||
* ```cpp
|
||||
* #include <opencv2/core.hpp>
|
||||
* #include <opencv2/imgproc.hpp>
|
||||
*
|
||||
* using namespace cv;
|
||||
* using namespace std;
|
||||
*
|
||||
* int main()
|
||||
* {
|
||||
* Mat lines;
|
||||
* vector<Vec3d> line3d;
|
||||
* vector<Point2f> point;
|
||||
* const static float Points[20][2] = {
|
||||
* { 0.0f, 369.0f }, { 10.0f, 364.0f }, { 20.0f, 358.0f }, { 30.0f, 352.0f },
|
||||
* { 40.0f, 346.0f }, { 50.0f, 341.0f }, { 60.0f, 335.0f }, { 70.0f, 329.0f },
|
||||
* { 80.0f, 323.0f }, { 90.0f, 318.0f }, { 100.0f, 312.0f }, { 110.0f, 306.0f },
|
||||
* { 120.0f, 300.0f }, { 130.0f, 295.0f }, { 140.0f, 289.0f }, { 150.0f, 284.0f },
|
||||
* { 160.0f, 277.0f }, { 170.0f, 271.0f }, { 180.0f, 266.0f }, { 190.0f, 260.0f }
|
||||
* };
|
||||
*
|
||||
* for (int i = 0; i < 20; i++)
|
||||
* {
|
||||
* point.push_back(Point2f(Points[i][0],Points[i][1]));
|
||||
* }
|
||||
*
|
||||
* double rhoMin = 0.0f, rhoMax = 360.0f, rhoStep = 1;
|
||||
* double thetaMin = 0.0f, thetaMax = CV_PI / 2.0f, thetaStep = CV_PI / 180.0f;
|
||||
*
|
||||
* HoughLinesPointSet(point, lines, 20, 1,
|
||||
* rhoMin, rhoMax, rhoStep,
|
||||
* thetaMin, thetaMax, thetaStep);
|
||||
*
|
||||
* lines.copyTo(line3d);
|
||||
* printf("votes:%d, rho:%.7f, theta:%.7f\\n",(int)line3d.at(0).val[0], line3d.at(0).val[1],
|
||||
* line3d.at(0).val[2]);
|
||||
* }
|
||||
* ```
|
||||
*
|
||||
* @param _point Input vector of points. Each vector must be encoded as a Point vector $(x,y)$. Type
|
||||
* must be CV_32FC2 or CV_32SC2.
|
||||
*
|
||||
* @param _lines Output vector of found lines. Each vector is encoded as a vector<Vec3d> $(votes, rho,
|
||||
* theta)$. The larger the value of 'votes', the higher the reliability of the Hough line.
|
||||
*
|
||||
* @param lines_max Max count of hough lines.
|
||||
*
|
||||
* @param threshold Accumulator threshold parameter. Only those lines are returned that get enough
|
||||
* votes ( $>\texttt{threshold}$ )
|
||||
*
|
||||
* @param min_rho Minimum Distance value of the accumulator in pixels.
|
||||
*
|
||||
* @param max_rho Maximum Distance value of the accumulator in pixels.
|
||||
*
|
||||
* @param rho_step Distance resolution of the accumulator in pixels.
|
||||
*
|
||||
* @param min_theta Minimum angle value of the accumulator in radians.
|
||||
*
|
||||
* @param max_theta Maximum angle value of the accumulator in radians.
|
||||
*
|
||||
* @param theta_step Angle resolution of the accumulator in radians.
|
||||
*/
|
||||
export declare function HoughLinesPointSet(
|
||||
_point: InputArray,
|
||||
_lines: OutputArray,
|
||||
lines_max: int,
|
||||
threshold: int,
|
||||
min_rho: double,
|
||||
max_rho: double,
|
||||
rho_step: double,
|
||||
min_theta: double,
|
||||
max_theta: double,
|
||||
theta_step: double,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function calculates the complex spatial derivative-based function of the source image
|
||||
*
|
||||
* `\\[\\texttt{dst} = (D_x \\texttt{src} )^2 \\cdot D_{yy} \\texttt{src} + (D_y \\texttt{src} )^2
|
||||
* \\cdot D_{xx} \\texttt{src} - 2 D_x \\texttt{src} \\cdot D_y \\texttt{src} \\cdot D_{xy}
|
||||
* \\texttt{src}\\]`
|
||||
*
|
||||
* where `$D_x$`, `$D_y$` are the first image derivatives, `$D_{xx}$`, `$D_{yy}$` are the second image
|
||||
* derivatives, and `$D_{xy}$` is the mixed derivative.
|
||||
*
|
||||
* The corners can be found as local maximums of the functions, as shown below:
|
||||
*
|
||||
* ```cpp
|
||||
* Mat corners, dilated_corners;
|
||||
* preCornerDetect(image, corners, 3);
|
||||
* // dilation with 3x3 rectangular structuring element
|
||||
* dilate(corners, dilated_corners, Mat(), 1);
|
||||
* Mat corner_mask = corners == dilated_corners;
|
||||
* ```
|
||||
*
|
||||
* @param src Source single-channel 8-bit of floating-point image.
|
||||
*
|
||||
* @param dst Output image that has the type CV_32F and the same size as src .
|
||||
*
|
||||
* @param ksize Aperture size of the Sobel .
|
||||
*
|
||||
* @param borderType Pixel extrapolation method. See BorderTypes.
|
||||
*/
|
||||
export declare function preCornerDetect(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
ksize: int,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* classical or standard Hough transform. Every line is represented by two floating-point numbers
|
||||
* `$(\\rho, \\theta)$` , where `$\\rho$` is a distance between (0,0) point and the line, and
|
||||
* `$\\theta$` is the angle between x-axis and the normal to the line. Thus, the matrix must be (the
|
||||
* created sequence will be) of CV_32FC2 type
|
||||
*
|
||||
*/
|
||||
export declare const HOUGH_STANDARD: HoughModes; // initializer: = 0
|
||||
|
||||
/**
|
||||
* probabilistic Hough transform (more efficient in case if the picture contains a few long linear
|
||||
* segments). It returns line segments rather than the whole line. Each segment is represented by
|
||||
* starting and ending points, and the matrix must be (the created sequence will be) of the CV_32SC4
|
||||
* type.
|
||||
*
|
||||
*/
|
||||
export declare const HOUGH_PROBABILISTIC: HoughModes; // initializer: = 1
|
||||
|
||||
/**
|
||||
* multi-scale variant of the classical Hough transform. The lines are encoded the same way as
|
||||
* HOUGH_STANDARD.
|
||||
*
|
||||
*/
|
||||
export declare const HOUGH_MULTI_SCALE: HoughModes; // initializer: = 2
|
||||
|
||||
export declare const HOUGH_GRADIENT: HoughModes; // initializer: = 3
|
||||
|
||||
export declare const LSD_REFINE_NONE: LineSegmentDetectorModes; // initializer: = 0
|
||||
|
||||
export declare const LSD_REFINE_STD: LineSegmentDetectorModes; // initializer: = 1
|
||||
|
||||
/**
|
||||
* Advanced refinement. Number of false alarms is calculated, lines are refined through increase of
|
||||
* precision, decrement in size, etc.
|
||||
*
|
||||
*/
|
||||
export declare const LSD_REFINE_ADV: LineSegmentDetectorModes; // initializer: = 2
|
||||
|
||||
export type HoughModes = any;
|
||||
|
||||
export type LineSegmentDetectorModes = any;
|
||||
918
opencv-js-4.10.0/src/types/opencv/imgproc_filter.ts
Normal file
918
opencv-js-4.10.0/src/types/opencv/imgproc_filter.ts
Normal file
|
|
@ -0,0 +1,918 @@
|
|||
import type {
|
||||
bool,
|
||||
double,
|
||||
InputArray,
|
||||
int,
|
||||
Mat,
|
||||
OutputArray,
|
||||
OutputArrayOfArrays,
|
||||
Point,
|
||||
Scalar,
|
||||
Size,
|
||||
TermCriteria,
|
||||
} from "./_types";
|
||||
/*
|
||||
* # Image Filtering
|
||||
* Functions and classes described in this section are used to perform various linear or non-linear filtering operations on 2D images (represented as [Mat]'s). It means that for each pixel location `$(x,y)$` in the source image (normally, rectangular), its neighborhood is considered and used to compute the response. In case of a linear filter, it is a weighted sum of pixel values. In case of morphological operations, it is the minimum or maximum values, and so on. The computed response is stored in the destination image at the same location `$(x,y)$`. It means that the output image will be of the same size as the input image. Normally, the functions support multi-channel arrays, in which case every channel is processed independently. Therefore, the output image will also have the same number of channels as the input one.
|
||||
*
|
||||
* Another common feature of the functions and classes described in this section is that, unlike simple arithmetic functions, they need to extrapolate values of some non-existing pixels. For example, if you want to smooth an image using a Gaussian `$3 \times 3$` filter, then, when processing the left-most pixels in each row, you need pixels to the left of them, that is, outside of the image. You can let these pixels be the same as the left-most image pixels ("replicated
|
||||
* border" extrapolation method), or assume that all the non-existing pixels are zeros ("constant
|
||||
* border" extrapolation method), and so on. OpenCV enables you to specify the extrapolation method. For details, see [BorderTypes]
|
||||
*
|
||||
* <a name="d4/d86/group__imgproc__filter_1filter_depths"></a>
|
||||
*
|
||||
* ## Depth combinations
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
*
|
||||
* when ddepth=-1, the output image will have the same depth as the source.
|
||||
*/
|
||||
/**
|
||||
* The function applies bilateral filtering to the input image, as described in bilateralFilter can
|
||||
* reduce unwanted noise very well while keeping edges fairly sharp. However, it is very slow compared
|
||||
* to most filters.
|
||||
*
|
||||
* Sigma values*: For simplicity, you can set the 2 sigma values to be the same. If they are small (<
|
||||
* 10), the filter will not have much effect, whereas if they are large (> 150), they will have a very
|
||||
* strong effect, making the image look "cartoonish".
|
||||
*
|
||||
* Filter size*: Large filters (d > 5) are very slow, so it is recommended to use d=5 for real-time
|
||||
* applications, and perhaps d=9 for offline applications that need heavy noise filtering.
|
||||
*
|
||||
* This filter does not work inplace.
|
||||
*
|
||||
* @param src Source 8-bit or floating-point, 1-channel or 3-channel image.
|
||||
*
|
||||
* @param dst Destination image of the same size and type as src .
|
||||
*
|
||||
* @param d Diameter of each pixel neighborhood that is used during filtering. If it is non-positive,
|
||||
* it is computed from sigmaSpace.
|
||||
*
|
||||
* @param sigmaColor Filter sigma in the color space. A larger value of the parameter means that
|
||||
* farther colors within the pixel neighborhood (see sigmaSpace) will be mixed together, resulting in
|
||||
* larger areas of semi-equal color.
|
||||
*
|
||||
* @param sigmaSpace Filter sigma in the coordinate space. A larger value of the parameter means that
|
||||
* farther pixels will influence each other as long as their colors are close enough (see sigmaColor ).
|
||||
* When d>0, it specifies the neighborhood size regardless of sigmaSpace. Otherwise, d is proportional
|
||||
* to sigmaSpace.
|
||||
*
|
||||
* @param borderType border mode used to extrapolate pixels outside of the image, see BorderTypes
|
||||
*/
|
||||
export declare function bilateralFilter(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
d: int,
|
||||
sigmaColor: double,
|
||||
sigmaSpace: double,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function smooths an image using the kernel:
|
||||
*
|
||||
* `\\[\\texttt{K} = \\frac{1}{\\texttt{ksize.width*ksize.height}} \\begin{bmatrix} 1 & 1 & 1 & \\cdots
|
||||
* & 1 & 1 \\\\ 1 & 1 & 1 & \\cdots & 1 & 1 \\\\ \\hdotsfor{6} \\\\ 1 & 1 & 1 & \\cdots & 1 & 1 \\\\
|
||||
* \\end{bmatrix}\\]`
|
||||
*
|
||||
* The call `blur(src, dst, ksize, anchor, borderType)` is equivalent to `boxFilter(src, dst,
|
||||
* src.type(), anchor, true, borderType)`.
|
||||
*
|
||||
* [boxFilter], [bilateralFilter], [GaussianBlur], [medianBlur]
|
||||
*
|
||||
* @param src input image; it can have any number of channels, which are processed independently, but
|
||||
* the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
|
||||
*
|
||||
* @param dst output image of the same size and type as src.
|
||||
*
|
||||
* @param ksize blurring kernel size.
|
||||
*
|
||||
* @param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
|
||||
* center.
|
||||
*
|
||||
* @param borderType border mode used to extrapolate pixels outside of the image, see BorderTypes
|
||||
*/
|
||||
export declare function blur(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
ksize: Size,
|
||||
anchor?: Point,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function smooths an image using the kernel:
|
||||
*
|
||||
* `\\[\\texttt{K} = \\alpha \\begin{bmatrix} 1 & 1 & 1 & \\cdots & 1 & 1 \\\\ 1 & 1 & 1 & \\cdots & 1
|
||||
* & 1 \\\\ \\hdotsfor{6} \\\\ 1 & 1 & 1 & \\cdots & 1 & 1 \\end{bmatrix}\\]`
|
||||
*
|
||||
* where
|
||||
*
|
||||
* `\\[\\alpha = \\fork{\\frac{1}{\\texttt{ksize.width*ksize.height}}}{when
|
||||
* \\texttt{normalize=true}}{1}{otherwise}\\]`
|
||||
*
|
||||
* Unnormalized box filter is useful for computing various integral characteristics over each pixel
|
||||
* neighborhood, such as covariance matrices of image derivatives (used in dense optical flow
|
||||
* algorithms, and so on). If you need to compute pixel sums over variable-size windows, use
|
||||
* [integral].
|
||||
*
|
||||
* [blur], [bilateralFilter], [GaussianBlur], [medianBlur], [integral]
|
||||
*
|
||||
* @param src input image.
|
||||
*
|
||||
* @param dst output image of the same size and type as src.
|
||||
*
|
||||
* @param ddepth the output image depth (-1 to use src.depth()).
|
||||
*
|
||||
* @param ksize blurring kernel size.
|
||||
*
|
||||
* @param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel
|
||||
* center.
|
||||
*
|
||||
* @param normalize flag, specifying whether the kernel is normalized by its area or not.
|
||||
*
|
||||
* @param borderType border mode used to extrapolate pixels outside of the image, see BorderTypes
|
||||
*/
|
||||
export declare function boxFilter(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
ddepth: int,
|
||||
ksize: Size,
|
||||
anchor?: Point,
|
||||
normalize?: bool,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function constructs a vector of images and builds the Gaussian pyramid by recursively applying
|
||||
* pyrDown to the previously built pyramid layers, starting from `dst[0]==src`.
|
||||
*
|
||||
* @param src Source image. Check pyrDown for the list of supported types.
|
||||
*
|
||||
* @param dst Destination vector of maxlevel+1 images of the same type as src. dst[0] will be the same
|
||||
* as src. dst[1] is the next pyramid layer, a smoothed and down-sized src, and so on.
|
||||
*
|
||||
* @param maxlevel 0-based index of the last (the smallest) pyramid layer. It must be non-negative.
|
||||
*
|
||||
* @param borderType Pixel extrapolation method, see BorderTypes (BORDER_CONSTANT isn't supported)
|
||||
*/
|
||||
export declare function buildPyramid(
|
||||
src: InputArray,
|
||||
dst: OutputArrayOfArrays,
|
||||
maxlevel: int,
|
||||
borderType?: int,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function dilates the source image using the specified structuring element that determines the
|
||||
* shape of a pixel neighborhood over which the maximum is taken: `\\[\\texttt{dst} (x,y) = \\max
|
||||
* _{(x',y'): \\, \\texttt{element} (x',y') \\ne0 } \\texttt{src} (x+x',y+y')\\]`
|
||||
*
|
||||
* The function supports the in-place mode. Dilation can be applied several ( iterations ) times. In
|
||||
* case of multi-channel images, each channel is processed independently.
|
||||
*
|
||||
* [erode], [morphologyEx], [getStructuringElement]
|
||||
*
|
||||
* @param src input image; the number of channels can be arbitrary, but the depth should be one of
|
||||
* CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
|
||||
*
|
||||
* @param dst output image of the same size and type as src.
|
||||
*
|
||||
* @param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular
|
||||
* structuring element is used. Kernel can be created using getStructuringElement
|
||||
*
|
||||
* @param anchor position of the anchor within the element; default value (-1, -1) means that the
|
||||
* anchor is at the element center.
|
||||
*
|
||||
* @param iterations number of times dilation is applied.
|
||||
*
|
||||
* @param borderType pixel extrapolation method, see BorderTypes
|
||||
*
|
||||
* @param borderValue border value in case of a constant border
|
||||
*/
|
||||
export declare function dilate(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
kernel: InputArray,
|
||||
anchor?: Point,
|
||||
iterations?: int,
|
||||
borderType?: int,
|
||||
borderValue?: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function erodes the source image using the specified structuring element that determines the
|
||||
* shape of a pixel neighborhood over which the minimum is taken:
|
||||
*
|
||||
* `\\[\\texttt{dst} (x,y) = \\min _{(x',y'): \\, \\texttt{element} (x',y') \\ne0 } \\texttt{src}
|
||||
* (x+x',y+y')\\]`
|
||||
*
|
||||
* The function supports the in-place mode. Erosion can be applied several ( iterations ) times. In
|
||||
* case of multi-channel images, each channel is processed independently.
|
||||
*
|
||||
* [dilate], [morphologyEx], [getStructuringElement]
|
||||
*
|
||||
* @param src input image; the number of channels can be arbitrary, but the depth should be one of
|
||||
* CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
|
||||
*
|
||||
* @param dst output image of the same size and type as src.
|
||||
*
|
||||
* @param kernel structuring element used for erosion; if element=Mat(), a 3 x 3 rectangular
|
||||
* structuring element is used. Kernel can be created using getStructuringElement.
|
||||
*
|
||||
* @param anchor position of the anchor within the element; default value (-1, -1) means that the
|
||||
* anchor is at the element center.
|
||||
*
|
||||
* @param iterations number of times erosion is applied.
|
||||
*
|
||||
* @param borderType pixel extrapolation method, see BorderTypes
|
||||
*
|
||||
* @param borderValue border value in case of a constant border
|
||||
*/
|
||||
export declare function erode(
|
||||
src: InputArray,
|
||||
dst: OutputArray,
|
||||
kernel: InputArray,
|
||||
anchor?: Point,
|
||||
iterations?: int,
|
||||
borderType?: int,
|
||||
borderValue?: any,
|
||||
): void;
|
||||
|
||||
/**
|
||||
* The function applies an arbitrary linear filter to an image. In-place operation is supported. When
|
||||
* the aperture is partially outside the image, the function interpolates outlier pixel values
|
||||
* according to the specified border mode.
|
||||
*
|
||||
* The function does actually compute correlation, not the convolution:
|
||||
*
|
||||
* `\\[\\texttt{dst} (x,y) = \\sum _{ \\stackrel{0\\leq x' < \\texttt{kernel.cols},}{0\\leq y' <
| ||||