Multi Projector System 4
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
altmain.ProjectionSplit Class Reference

Handles splitting images for dual-projector setups with overlap blending. More...

Public Member Functions

 __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.
 

Public Attributes

 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.
 

Protected Member Functions

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.
 

Detailed Description

Handles splitting images for dual-projector setups with overlap blending.

This class is responsible for:

Constructor & Destructor Documentation

◆ __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
FileNotFoundErrorif config.ini cannot be found

Member Function Documentation

◆ _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:

  1. Converts 3-channel images to 4-channel (BGRA) if needed
  2. Splits image into left and right sections with specified overlap
  3. Generates alpha blending curves
  4. Applies curves to alpha channels of overlap regions
  5. Stores results in instance buffers and saves to disk
Parameters
imageInput image as numpy array (BGR or BGRA format)
overlapWidth of overlap region in pixels (must be even for symmetric split)
blend_typeType 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
overlapWidth of the overlap region in pixels
blend_typeType 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
ValueErrorif 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
overlapOverlap width in pixels (default: 75)
blend_typeBlending curve type (default: "linear")
Exceptions
FileNotFoundErrorif input.png cannot be found in working directory
ValueErrorif 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: