Handles splitting images for dual-projector setups with overlap blending.
More...
|
| | __init__ (self) |
| | Initializes the ProjectionSplit processor with NumPy backend.
|
| |
| | process_images (self, int overlap=75, str blend_type="linear") |
| | Main public interface for processing static images.
|
| |
|
|
| cfg |
| | Configuration manager instance.
|
| |
|
| image_left |
| | Processed left projector output image.
|
| |
|
| image_right |
| | Processed right projector output image.
|
| |
|
| image_main |
| | Original input image buffer for reference.
|
| |
|
| Tuple[np.ndarray, np.ndarray] | _generate_alpha_curves (self, int overlap, str blend_type) |
| | Generates alpha blending curves for overlap region.
|
| |
| None | _apply_blending (self, np.ndarray image, int overlap, str blend_type) |
| | Applies alpha blending to split images using NumPy operations.
|
| |
Handles splitting images for dual-projector setups with overlap blending.
This class is responsible for:
- Loading and processing input images for dual-projector setups
- Generating mathematical alpha blending curves for smooth transitions
- Splitting images into left/right sections with configurable overlap
- Applying blending using pure NumPy operations (no GPU dependency)
- Saving processed outputs to disk for projector display
◆ __init__()
| altmain.ProjectionSplit.__init__ |
( |
|
self | ) |
|
Initializes the ProjectionSplit processor with NumPy backend.
Constructor that sets up the processor by:
- Initializing image storage buffers as None
- Loading configuration from config.ini file
- Using pure NumPy operations for cross-platform compatibility
- Postcondition
- self.image_left, self.image_right, self.image_main are initialized to None
-
self.cfg contains loaded configuration from config.ini
- Exceptions
-
| FileNotFoundError | if config.ini cannot be found |
◆ _apply_blending()
| None altmain.ProjectionSplit._apply_blending |
( |
|
self, |
|
|
np.ndarray |
image, |
|
|
int |
overlap, |
|
|
str |
blend_type |
|
) |
| |
|
protected |
Applies alpha blending to split images using NumPy operations.
Core processing method that:
- Converts 3-channel images to 4-channel (BGRA) if needed
- Splits image into left and right sections with specified overlap
- Generates alpha blending curves
- Applies curves to alpha channels of overlap regions
- Stores results in instance buffers and saves to disk
- Parameters
-
| image | Input image as numpy array (BGR or BGRA format) |
| overlap | Width of overlap region in pixels (must be even for symmetric split) |
| blend_type | Type of blending curve to apply |
- Postcondition
- self.image_left and self.image_right contain processed images
-
left.png and right.png are saved to working directory
◆ _generate_alpha_curves()
| Tuple[np.ndarray, np.ndarray] altmain.ProjectionSplit._generate_alpha_curves |
( |
|
self, |
|
|
int |
overlap, |
|
|
str
|
blend_type |
|
) |
| |
|
protected |
Generates alpha blending curves for overlap region.
Creates mathematical curves that determine transparency values across the overlap zone using three supported blending types:
- Linear: Straight-line fade with configurable slope parameter
- Quadratic: Parabolic fade (x²) for smoother transition
- Gaussian: Bell curve fade using error function for natural blending
- Parameters
-
| overlap | Width of the overlap region in pixels |
| blend_type | Type of blending curve: "linear", "quadratic", or "gaussian" |
- Returns
- Tuple of (left_curve, right_curve) where each is a 1D numpy array of alpha values (float32) ranging from 0.0 to 1.0 across overlap width
- Exceptions
-
| ValueError | if an unsupported blend_type is provided |
◆ process_images()
| altmain.ProjectionSplit.process_images |
( |
|
self, |
|
|
int |
overlap = 75, |
|
|
str |
blend_type = "linear" |
|
) |
| |
Main public interface for processing static images.
Loads input image from disk and applies splitting and blending operations. This is the primary method called by the GUI controller for image processing.
- Parameters
-
| overlap | Overlap width in pixels (default: 75) |
| blend_type | Blending curve type (default: "linear") |
- Exceptions
-
| FileNotFoundError | if input.png cannot be found in working directory |
| ValueError | if blend_type is not supported |
- Postcondition
- self.image_main contains the loaded input image
-
self.image_left and self.image_right contain processed outputs
-
left.png and right.png are saved to working directory
The documentation for this class was generated from the following file: