https://github.com/webarkit/oneeurofilter-ts
One Euro Filter to Typescript
https://github.com/webarkit/oneeurofilter-ts
filters oneeurofilter
Last synced: 4 months ago
JSON representation
One Euro Filter to Typescript
- Host: GitHub
- URL: https://github.com/webarkit/oneeurofilter-ts
- Owner: webarkit
- License: lgpl-2.1
- Created: 2023-03-31T19:35:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-20T17:16:00.000Z (over 1 year ago)
- Last Synced: 2025-05-14T08:14:21.558Z (about 1 year ago)
- Topics: filters, oneeurofilter
- Language: TypeScript
- Homepage:
- Size: 70.3 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OneEuroFilter-ts
This code is a translation to Typescript of the original code from [Jaan Tollander](https://jaantollander.com/post/noise-filtering-using-one-euro-filter/#mjx-eqn%3A1).
It's not well tested yet, so I can not assure of the correctness of the code.
## Installation
Install with npm:
```bash
npm install @webarkit/oneeurofilter-ts
```
Install with yarn:
```bash
yarn add @webarkit/oneeurofilter-ts
```
## Usage
In a typescript file:
```typescript
// import the OneEuroFilter class into your project
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";
let filterMinCF: number = 0.0001;
let filterBeta: number = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
/* yourData is the data you want to filter, createData() is a dummy function here,
use it you method or data instead...
*/
let yourData = createData();
// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);
// then use yourData...
```
In a javascript file:
```javascript
// import the OneEuroFilter class into your project
import { OneEuroFilter } from "@webarkit/oneeurofilter-ts";
let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
/* yourData is the data you want to filter, createData() is a dummy function here,
use it you method or data instead...
*/
let yourData = createData();
// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);
// then use yourData...
```
in a html script tag with module support:
```html
{
"imports": {
"oef": "https://raw.github.com/webarkit/oneeurofilter-ts/main/dist/OneEuroFilter.mjs",
}
}
// import the OneEuroFilter class into your project
import { OneEuroFilter } from "oef";
let filterMinCF = 0.0001;
let filterBeta = 0.01;
const filter = new OneEuroFilter(filterMinCF, filterBeta);
/* yourData is the data you want to filter, createData() is a dummy function here,
use it you method or data instead...
*/
let yourData = createData();
// filter the data (yourData) with the filter method
filter.filter(Date.now(), yourData);
// then use yourData...
```