thermography¶
The thermography package implements different computer vision and image progessing algorithms for automatic detection of solar panel modules.
Submodules¶
thermography.module_map module¶
-
class
ModuleMap[source]¶ Bases:
objectClass responsible for storing a spatial representation of the detected modules. Each module is keyed by an unique ID Multiple detections of the same module are considered and the existing module is updated in the internal representation of the map.
Example: module_map = ModuleMap() module_map.insert([rect1, rect2, ...], frame_id=0, motion_estimate = np.array([0, 0]) # module_map.global_module_map = {0: <..., rect1, frame_id_history=[0]>; # 1: <..., rect2, frame_id_history=[0]>, # 2: <..., rect3, frame_id_history=[0]>} motion = np.array([4, 2]) rect1 += motion module_map.insert([rect1, rect4], frame_id=1, motion_estimate=motion) # module_map.global_module_map = {0: <..., rect1, frame_id_history=[0, 1]>; # 1: <..., rect2, frame_id_history=[0]>, # 2: <..., rect3, frame_id_history=[0]>, # 3: <..., rect4, frame_id_history=[1]>}
Initializes the module map to be empty.
-
insert(rectangle_list: list, frame_id: int, motion_estimate: numpy.ndarray = None)[source]¶ Inserts all rectangles contained in the list passed as first parameter into the global map representation.
Parameters: - rectangle_list – List of detected rectangles to be inserted into the global module map.
- frame_id – Frame id of the current image frame associated to the detected rectangles.
- motion_estimate – Numpy array representing the motion estimate between the last frame (ID-1) and the frame containing the rectangles.
-
thermography.thermo_app module¶
-
class
ThermoApp(input_video_path, camera_param_file)[source]¶ Bases:
objectApplication implementing the routines for module detections and analysis under the form of an object.
Example: app = ThermoApp(path_to_input_video, camera_params) app.run()
Initializes the
ThermoAppinstance by defining default parameters.Parameters: - input_video_path – Absolute path to the input video.
- camera_param_file – Parameter file of the camera.
-
classify_detected_modules() → None[source]¶ Classifies the modules in the global module map which have been detected in the current frame.
This function classifies all modules detected in the current frame which have been registered in the
self.module_mapmodule map. The modules are classified by theself.inferenceobject which generates a class probability distribution for each module.Note
This function must be called after inserting the modules in the global module map!
- See Also:
- Module
inferencefor more details.
-
cluster_segments() → None[source]¶ Clusters the segments in
self.last_segmentsaccording to the parameters inself.segment_clustering_parameters.- See Also:
- Module
segment_clusteringfor more details.
-
detect_edges() → None[source]¶ Detects the edges in the
self.last_preprocessed_imageusing the parameters inself.edge_detection_parameters.- See Also:
- Module
edge_detectionfor more details.
-
detect_intersections() → None[source]¶ Detects the intersections between the segments in
self.last_cluster_listaccording to the parameters inself.intersection_detection_parameters.- See Also:
- Module
intersection_detectionfor more details.
-
detect_rectangles() → None[source]¶ Detects the rectangles defined through the intersections in
self.last_intersectionsaccording to the parameters inself.rectangle_detection_parameters.- See Also:
- Module
rectangle_detectionfor more details.
-
detect_segments() → None[source]¶ Detects the segments in the
self.last_edges_frameusing the parameters inself.segment_detection_parameters.- See Also:
- Module
segment_detectionfor more details.
-
frames¶ Returns the frames loaded by the
self.video_loader.
-
load_video(start_frame: int, end_frame: int) → None[source]¶ Loads the video associated with the absolute path given to the constructor between the frames indicated as argument.
Parameters: - start_frame – Starting frame (inclusive)
- end_frame – Termination frame (exclusive), is set to None, the entire video will be loaded.
See Also: Module
iofor more details.
-
preprocess_frame() → None[source]¶ Preprocesses the frame stored at
self.last_input_frameby scaling, rotating and computing the attention regions.- See Also:
- Module
preprocessingfor more details.
-
run() → None[source]¶ Runs the
ThermoAppby iterating over all frames and detecting the modules. This function does not perform module classification.
-
step(frame_id, frame) → bool[source]¶ Perform a single step of the module detection using the frame passed as argument.
If the detection step is successful, the
self.last_*parameters are filled with the newly computed elements.Parameters: - frame_id – Integer identifying the id of the frame to be processed.
- frame – Numpy array containing the RGB image representing the frame to be processed.
Returns: True if the detection was successful, False otherwise.