Multi-Projector
|
A class to handle various commands related to image processing and display. More...
Public Member Functions | |
__init__ (self, gui, shared_data) | |
Initializes the Commands instance. | |
load_left_image (self) | |
Loads the left image from a file. | |
load_right_image (self) | |
Loads the right image from a file. | |
smooth_gradient (self, length, rate) | |
Creates a smooth gradient for the overlap region. | |
show_left_image (self) | |
Displays the left image with a smooth gradient applied to the overlap region. | |
show_right_image (self) | |
Displays the right image with a smooth gradient applied to the overlap region. | |
show_right_original (self) | |
Displays the original left image without any modifications. | |
show_left_original (self) | |
Displays the original right image without any modifications. | |
set_overlap_region (self) | |
Sets the overlap region for image processing. | |
increase_overlap (self) | |
Increases the overlap region value by one. | |
decrease_overlap (self) | |
Decreases the overlap region value by one. | |
Public Attributes | |
gui = gui | |
shared_data = shared_data | |
io = ImageIO(shared_data) | |
A class to handle various commands related to image processing and display.
The Commands class provides methods for loading, displaying, and adjusting the overlap region for images within a graphical user interface (GUI). It also supports image blending for overlapping regions with smooth gradient transitions.
Multi-Projector.Commands.Commands.__init__ | ( | self, | |
gui, | |||
shared_data ) |
Initializes the Commands instance.
Sets up the GUI interface, shared data, and ImageIO for image operations.
gui | The GUI instance used for displaying images and receiving user input. |
shared_data | The shared data structure that holds images and other state information. |
Multi-Projector.Commands.Commands.decrease_overlap | ( | self | ) |
Decreases the overlap region value by one.
Decrements the overlap region by one (ensuring it does not go negative) and redisplays the current image with the updated overlap.
Multi-Projector.Commands.Commands.increase_overlap | ( | self | ) |
Increases the overlap region value by one.
Increments the overlap region by one and redisplays the current image with the updated overlap.
Multi-Projector.Commands.Commands.load_left_image | ( | self | ) |
Loads the left image from a file.
Opens a file dialog for the user to select a left image file. If a file is selected, it is loaded into the shared data.
Multi-Projector.Commands.Commands.load_right_image | ( | self | ) |
Loads the right image from a file.
Opens a file dialog for the user to select a right image file. If a file is selected, it is loaded into the shared data.
Multi-Projector.Commands.Commands.set_overlap_region | ( | self | ) |
Sets the overlap region for image processing.
Updates the overlap region value from the GUI input, updates the shared data, and redisplays the current image (left or right) with the new overlap setting.
Multi-Projector.Commands.Commands.show_left_image | ( | self | ) |
Displays the left image with a smooth gradient applied to the overlap region.
If a left image is available, this method applies a smooth gradient to its overlapping region and displays it on the GUI canvas. If no left image is loaded, an error message is shown.
Multi-Projector.Commands.Commands.show_left_original | ( | self | ) |
Displays the original right image without any modifications.
If a right image is loaded, it displays the original right image on the GUI canvas.
Multi-Projector.Commands.Commands.show_right_image | ( | self | ) |
Displays the right image with a smooth gradient applied to the overlap region.
If a right image is available, this method applies a smooth gradient to its overlapping region and displays it on the GUI canvas. If no right image is loaded, an error message is shown.
Multi-Projector.Commands.Commands.show_right_original | ( | self | ) |
Displays the original left image without any modifications.
If a left image is loaded, it displays the original left image on the GUI canvas.
Multi-Projector.Commands.Commands.smooth_gradient | ( | self, | |
length, | |||
rate ) |
Creates a smooth gradient for the overlap region.
Generates a gradient that transitions from full brightness to zero using a non-linear quadratic falloff. The gradient is scaled by the specified rate and clipped to be between 0 and 1.
length | The length of the gradient. |
rate | A scaling factor to control the gradient's intensity. |