Visionlit Package
Overview
Visionlit is a JavaScript package designed for advanced computer vision tasks. It provides a robust command-line interface and can be seamlessly integrated into Node.js applications for a variety of operations including image segmentation, colorization, face ID verification, and smart object detection.
For more information and live examples, please visit our web platform at myvisionlit.com.
To interact with the methods provided by Visionlit, you will need to create an account on this platform to obtain an API key.
Features
- Image Segmentation: Implement custom segmentation masks.
- Black and White Conversion: Convert color images or videos into grayscale.
- Colorization: Reintroduce color into grayscale images using machine learning.
- Smart Object Detection: Detect and identify objects within images, with options for custom display styles and color filters.
- Face ID Verification: Compare faces between two images to verify identity, useful in security and authentication.
- Identity Data Extraction: Extract and classify identity data from ID cards for specific supported countries.
Installation
To install Visionlit, run the following command:
npm install visionlit
Usage
Command Line Interface
List Available Methods
To display all executable methods:
visionlit list
Execute Specific Method
To run a specific method on an image:
visionlit run <api_key> <image_path> <method_name> [--display] [--confidence] [--option] [--color] [--country] [--to_compare]
Parameters:
api_key
: Your API key for authentication.image_path
: Path to the image file.method_name
: The name of the method to execute.display
: Type of display for detection results (e.g., Boxes, Masks).confidence
: Confidence level for detection accuracy.option
: Specific processing options.color
: Color filter for object detection in "Masks" display type.country
: Country code for ID card processing.to_compare
: Path to an additional image file for face comparison.
Using the Help Command
To access the help for the run
command:
visionlit run --help
This command will output the usage instructions, along with descriptions for each parameter and option related to the run
command. This is extremely useful for understanding what parameters and options are available and how to properly format the command.
What to Expect
When you run visionlit run --help
, you should see output similar to this:
visionlit run <key> <imagePath> <method>
Run Visionlit operations.
Positionals:
key API key for authentication. Visit https://myvisionlit.com/dashboard/account to obtain your API key.
imagePath Path to the image file or directory containing images.
method Method to execute on the image.
Options:
--display Type of display for detection results. Options: <Boxes>, <Masks> [default: Boxes]
--confidence Confidence level for detection accuracy [default: 0.25]
--option Option for processing [default: 0]
--color Filter objects with colors close to the specified color. Provide color as hexadecimal.
--country Country code for ID card processing.
--to_compare Path to an additional image file where the face to be compared is located.
--help, -h Show help [boolean]
As a Node.js Module
Example of using Visionlit in a Node.js script:
const Visionlit = require('visionlit');
(async () => {
const key = "your_api_key_here";
const vision = new Visionlit(key);
try {
const result = await vision.segmentImage("path/to/your/image.jpg");
console.log(result);
} catch (error) {
console.error(error.message);
}
})();
### Example Usage with commands
```bash
visionlit run your_api_key path/to/your/image.jpg smartObjectDetection --display Boxes --confidence 0.5