Command Line Interface
ImgVisFeat provides a command-line interface (CLI) built with Typer for easy access to its visualization features.
Basic Usage
The CLI uses subcommands for different visualization methods, making it intuitive and easy to use.
Getting Help
# Show main help with all available commands
imvf --help
# Show help for a specific command
imvf all --help
imvf hog --help
Available Commands
all - Visualize All Features
Applies all visualization methods to the input image.
color-channel - Color Channel Visualization
Extracts and visualizes individual RGB color channels.
gradient - Gradient Visualization
Computes and visualizes image gradients in X, Y, and combined XY directions.
hog - Histogram of Oriented Gradients
Visualizes HoG feature descriptors for object detection.
keypoint - Keypoint Detection
Detects and visualizes keypoints using SIFT, AKAZE, and ORB algorithms.
lbp - Local Binary Patterns
Extracts and visualizes LBP texture descriptors.
power-spectrum - Power Spectrum Analysis
Analyzes and visualizes frequency domain characteristics.
Examples
Basic Examples
# Visualize all features
imvf all input_image.jpg
# Visualize only HoG features
imvf hog input_image.jpg
# Visualize keypoints
imvf keypoint input_image.jpg
# Visualize color channels
imvf color-channel input_image.jpg
Using with Different Image Formats
Features
Built with Typer
The CLI is built with Typer, providing:
- Beautiful help messages with formatted output
- Shell completion support (install with
imvf --install-completion) - Type-safe arguments with automatic validation
- Intuitive subcommand structure
Auto-completion
Install shell completion for enhanced productivity:
# Install completion for your shell
imvf --install-completion
# Show completion script
imvf --show-completion
Implementation Details
The CLI is implemented in the imvf.cli module using the Typer framework.
Error Handling
If an error occurs during the visualization process:
- Error messages are printed to stderr
- The command exits with code 1
- A helpful error message indicates what went wrong
Example error output:
Output
All visualization methods:
- Display results in OpenCV windows
- Save results to a directory named after the input image
- Print progress information to stdout
Example output:
$ imvf all sample.jpg
Visualizing sample.jpg
Number of keypoints (SIFT) : 957
Number of keypoints (AKAZE): 513
Number of keypoints (ORB): 500
Visualization complete.
Notes
- Each subcommand represents a specific visualization method
- The
allcommand runs all available visualization methods - Results are automatically saved to an output directory
- Press any key in the OpenCV window to close the visualization