Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# This file is part of opencv-js-react project from Robomous.
# This file is part of @robomous/opencv-react project from Robomous.
# It is subject to the license terms in the LICENSE file found in the top-level directory

version: 2
Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

---

# opencv-js-react
# @robomous/opencv-react

A React wrapper for the official OpenCV.js library — bring computer vision to your React apps using WebAssembly.

Expand All @@ -26,13 +26,13 @@ This package is **browser-oriented**. It is not a generic Node.js image processi

```bash
# pnpm (recommended)
pnpm add opencv-js-react
pnpm add @robomous/opencv-react

# npm
npm install opencv-js-react
npm install @robomous/opencv-react

# yarn
yarn add opencv-js-react
yarn add @robomous/opencv-react
```

**Peer dependencies** (install separately if not already present):
Expand All @@ -44,7 +44,7 @@ pnpm add react react-dom
## Quick start

```tsx
import { OpenCVCanvas } from 'opencv-js-react';
import { OpenCVCanvas } from '@robomous/opencv-react';

export default function App() {
return (
Expand Down Expand Up @@ -72,7 +72,7 @@ export default function App() {

```tsx
import React, { useRef } from 'react';
import { OpenCVCanvas } from 'opencv-js-react';
import { OpenCVCanvas } from '@robomous/opencv-react';

export default function Demo() {
const outputCanvasRef = useRef<HTMLCanvasElement>(null);
Expand Down Expand Up @@ -200,7 +200,7 @@ interface ProcessPayload {

## OpenCV.js source

`opencv-js-react` does not bundle an OpenCV.js binary. By default it loads from the official CDN:
`@robomous/opencv-react` does not bundle an OpenCV.js binary. By default it loads from the official CDN:

```
https://docs.opencv.org/4.13.0/opencv.js
Expand Down Expand Up @@ -239,7 +239,7 @@ Supported versions: `4.10.0`, `4.11.0`, `4.12.0`, `4.13.0`. Output is written to
## Local development

```bash
git clone https://github.com/Robomous/opencv-js-react.git
git clone https://github.com/Robomous/opencv-react.git
cd opencv-js-react
pnpm install

Expand Down Expand Up @@ -278,7 +278,7 @@ Publishing is triggered automatically when a GitHub release is published. The re

To configure npm trusted publishing:
- See [npm trusted publishers documentation](https://docs.npmjs.com/trusted-publishers/)
- Enable it in your npm package settings for the `Robomous/opencv-js-react` GitHub repository
- Enable it in your npm package settings for the `Robomous/opencv-react` GitHub repository

Manual publish:

Expand Down
8 changes: 4 additions & 4 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
# opencv-js-react Examples
# @robomous/opencv-react Examples

Self-contained code examples showing how to use the `opencv-js-react` library. Copy any file into your own React project that has `opencv-js-react` installed.
Self-contained code examples showing how to use the `@robomous/opencv-react` library. Copy any file into your own React project that has `@robomous/opencv-react` installed.

## Prerequisites

```bash
npm install opencv-js-react react react-dom
npm install @robomous/opencv-react react react-dom
# or
pnpm add opencv-js-react react react-dom
pnpm add @robomous/opencv-react react react-dom
```

---
Expand Down
6 changes: 3 additions & 3 deletions examples/basic-hook-usage.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
* Example: Basic hook usage
*
* The simplest way to use opencv-js-react — load OpenCV with the `useOpenCV` hook
* The simplest way to use @robomous/opencv-react — load OpenCV with the `useOpenCV` hook
* and access the `cv` namespace for processing.
*
* OpenCV.js loads once (singleton) and is shared across all hook instances in
* the app. Any component that calls useOpenCV() will receive the same instance.
*/
import { useOpenCV } from 'opencv-js-react';
import { useOpenCV } from '@robomous/opencv-react';

export function BasicHookUsage() {
const { cv, isReady, isLoading, error } = useOpenCV();
Expand Down
4 changes: 2 additions & 2 deletions examples/deferred-loading.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand All @@ -11,7 +11,7 @@
* Call `load()` from any event handler to trigger the download on demand.
* Subsequent calls to `load()` are no-ops — OpenCV loads exactly once.
*/
import { useOpenCV } from 'opencv-js-react';
import { useOpenCV } from '@robomous/opencv-react';

export function DeferredLoading() {
const { isReady, isLoading, error, load } = useOpenCV({ autoLoad: false });
Expand Down
6 changes: 3 additions & 3 deletions examples/edge-detection.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand All @@ -15,8 +15,8 @@
* - Using the full OpenCV.js API through the index signature: cv['GaussianBlur']
*/
import { useRef } from 'react';
import { OpenCVCanvas } from 'opencv-js-react';
import type { OpenCVNamespace, ProcessPayload } from 'opencv-js-react';
import { OpenCVCanvas } from '@robomous/opencv-react';
import type { OpenCVNamespace, ProcessPayload } from '@robomous/opencv-react';

const IMAGE_URL = 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png';

Expand Down
6 changes: 3 additions & 3 deletions examples/grayscale-filter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand All @@ -14,8 +14,8 @@
* - `mat.delete()` — ALWAYS delete every Mat you create to avoid memory leaks
*/
import { useRef } from 'react';
import { OpenCVCanvas } from 'opencv-js-react';
import type { ProcessPayload } from 'opencv-js-react';
import { OpenCVCanvas } from '@robomous/opencv-react';
import type { ProcessPayload } from '@robomous/opencv-react';

const IMAGE_URL = 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png';

Expand Down
6 changes: 3 additions & 3 deletions examples/threshold-adjustment.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand All @@ -15,8 +15,8 @@
* current value without creating stale closures
*/
import { useRef, useState } from 'react';
import { OpenCVCanvas, useOpenCV } from 'opencv-js-react';
import type { OpenCVNamespace, ProcessPayload } from 'opencv-js-react';
import { OpenCVCanvas, useOpenCV } from '@robomous/opencv-react';
import type { OpenCVNamespace, ProcessPayload } from '@robomous/opencv-react';

const IMAGE_URL = 'https://upload.wikimedia.org/wikipedia/commons/thumb/4/47/PNG_transparency_demonstration_1.png/280px-PNG_transparency_demonstration_1.png';

Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "opencv-js-react",
"name": "@robomous/opencv-react",
"version": "0.1.0",
"description": "A React wrapper for the official OpenCV.js library.",
"type": "module",
Expand Down Expand Up @@ -72,12 +72,12 @@
"license": "Apache-2.0",
"repository": {
"type": "git",
"url": "https://github.com/Robomous/opencv-js-react.git"
"url": "https://github.com/Robomous/opencv-react.git"
},
"bugs": {
"url": "https://github.com/Robomous/opencv-js-react/issues"
"url": "https://github.com/Robomous/opencv-react/issues"
},
"homepage": "https://github.com/Robomous/opencv-js-react#readme",
"homepage": "https://github.com/Robomous/opencv-react#readme",
"keywords": [
"opencv",
"opencv.js",
Expand Down
4 changes: 2 additions & 2 deletions scripts/build-opencv-js-release.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# This file is part of opencv-js-react project from Robomous.
# This file is part of @robomous/opencv-react project from Robomous.
# It is subject to the license terms in the LICENSE file found in the top-level directory

# =============================================================================
Expand Down Expand Up @@ -138,7 +138,7 @@ BUILD_DIR="${CHECKOUT_DIR}/build_js"
# Summary
# =============================================================================
echo "============================================================"
echo " opencv-js-react: Building OpenCV.js"
echo " @robomous/opencv-react: Building OpenCV.js"
echo "============================================================"
echo " Version: ${VERSION}"
echo " Package name: ${PACKAGE_NAME}"
Expand Down
2 changes: 1 addition & 1 deletion scripts/helpers/opencv-release-config.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# This file is part of opencv-js-react project from Robomous.
# This file is part of @robomous/opencv-react project from Robomous.
# It is subject to the license terms in the LICENSE file found in the top-level directory

# Helper configuration for the OpenCV.js release build workflow.
Expand Down
4 changes: 2 additions & 2 deletions scripts/test-all-versions.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env bash
# This file is part of opencv-js-react project from Robomous.
# This file is part of @robomous/opencv-react project from Robomous.
# It is subject to the license terms in the LICENSE file found in the top-level directory

# =============================================================================
Expand Down Expand Up @@ -27,7 +27,7 @@ FAIL=0
declare -a RESULTS

echo "============================================================"
echo " opencv-js-react: Testing all OpenCV.js versions"
echo " @robomous/opencv-react: Testing all OpenCV.js versions"
echo "============================================================"
echo ""

Expand Down
2 changes: 1 addition & 1 deletion scripts/vendor-opencv.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand Down
2 changes: 1 addition & 1 deletion scripts/verify-opencv-version.mjs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/usr/bin/env node
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/**
Expand Down
2 changes: 1 addition & 1 deletion src/assets/opencv/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# OpenCV.js Local Asset (optional)

The `opencv-js-react` package does **not** bundle an OpenCV.js binary. By default it loads
The `@robomous/opencv-react` package does **not** bundle an OpenCV.js binary. By default it loads
OpenCV.js from the official CDN at runtime:

```
Expand Down
2 changes: 1 addition & 1 deletion src/components/OpenCVCanvas.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import React, { useRef, useEffect, useCallback } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/constants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

/** The OpenCV version vendored in this package. */
Expand Down
2 changes: 1 addition & 1 deletion src/global.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import type { OpenCVNamespace } from './types';
Expand Down
2 changes: 1 addition & 1 deletion src/hooks/useOpenCV.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import { useState, useEffect, useCallback, useRef } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

export { useOpenCV } from './hooks/useOpenCV';
Expand Down
2 changes: 1 addition & 1 deletion src/loader/loadOpenCV.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import type { OpenCVNamespace } from '../types';
Expand Down
2 changes: 1 addition & 1 deletion src/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import type { RefObject } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion tests/OpenCVCanvas.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import React, { createRef } from 'react';
Expand Down
2 changes: 1 addition & 1 deletion tests/setup.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import '@testing-library/jest-dom';
Expand Down
2 changes: 1 addition & 1 deletion tests/useOpenCV.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import { describe, it, expect, vi } from 'vitest';
Expand Down
2 changes: 1 addition & 1 deletion tsup.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import { defineConfig } from 'tsup';
Expand Down
2 changes: 1 addition & 1 deletion vitest.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// This file is part of opencv-js-react project from Robomous.
// This file is part of @robomous/opencv-react project from Robomous.
// It is subject to the license terms in the LICENSE file found in the top-level directory

import { defineConfig } from 'vitest/config';
Expand Down
Loading