energy_methods.pv_module_counting#
Experimental counting of resolved, regular PV module grids in RGB orthophotos.
Colour segmentation finds candidate tables; brightness profiles find frame lines. Every returned cell is an image-derived candidate, never a verified module or a capacity measurement. The detector is intended for approximately horizontal, blue/grey, regularly framed arrays. Unresolved grids return no estimate, not zero.
- class energy_methods.pv_module_counting.ModuleCountingConfig(blue_excess=0.025, minimum_brightness=0.25, minimum_table_pixels=500, minimum_table_aspect=2.0, maximum_slope=0.12, column_prominence=0.025, row_prominence=0.015, minimum_pitch_pixels=3.0, spacing_tolerance=0.3, minimum_blue_fraction=0.45)[source]#
Bases:
objectExplicit image-space screening parameters, not trained/calibrated probabilities.
RGB thresholds use 0..1 intensity; lengths/areas use delivered image pixels. Parameters need reassessment for different colours, rendering and resolution.
- Parameters:
blue_excess (float)
minimum_brightness (float)
minimum_table_pixels (int)
minimum_table_aspect (float)
maximum_slope (float)
column_prominence (float)
row_prominence (float)
minimum_pitch_pixels (float)
spacing_tolerance (float)
minimum_blue_fraction (float)
- blue_excess: float = 0.025#
- minimum_brightness: float = 0.25#
- minimum_table_pixels: int = 500#
- minimum_table_aspect: float = 2.0#
- maximum_slope: float = 0.12#
- column_prominence: float = 0.025#
- row_prominence: float = 0.015#
- minimum_pitch_pixels: float = 3.0#
- spacing_tolerance: float = 0.3#
- minimum_blue_fraction: float = 0.45#
- class energy_methods.pv_module_counting.ModuleCandidate(table, row, column, vertices_xy, status, reasons, blue_fraction)[source]#
Bases:
objectA quadrilateral in pixel-centre coordinates (x right, y down).
IDs describe this image/grid run, not persistent engineering asset IDs. Review flags express screening decisions, not detection confidence scores.
- Parameters:
table (int)
row (int)
column (int)
vertices_xy (tuple[XY, XY, XY, XY])
status (Literal['regular_candidate', 'review_candidate', 'excluded'])
reasons (tuple[str, ...])
blue_fraction (float)
- table: int#
- row: int#
- column: int#
- vertices_xy: tuple[XY, XY, XY, XY]#
- status: Literal['regular_candidate', 'review_candidate', 'excluded']#
- reasons: tuple[str, ...]#
- blue_fraction: float#
- property id: str#
- class energy_methods.pv_module_counting.TableGrid(id, bounds_xyxy, slope, rows, columns, column_pitch_pixels, row_pitch_pixels)[source]#
Bases:
objectDetected table geometry and frame pitch, in delivered image pixels.
- Parameters:
id (int)
bounds_xyxy (tuple[int, int, int, int])
slope (float)
rows (int)
columns (int)
column_pitch_pixels (float)
row_pitch_pixels (float)
- id: int#
- bounds_xyxy: tuple[int, int, int, int]#
- slope: float#
- rows: int#
- columns: int#
- column_pitch_pixels: float#
- row_pitch_pixels: float#
- class energy_methods.pv_module_counting.ModuleCount(image_shape, config, tables, cells, rejected_tables)[source]#
Bases:
objectCandidate inventory with explicit unresolved/excluded areas.
estimated_modulesincludes review candidates. It is not a validated inventory. A missing estimate means no grid resolved, not an empty PV site.- Parameters:
image_shape (tuple[int, int])
config (ModuleCountingConfig)
tables (tuple[TableGrid, ...])
cells (tuple[ModuleCandidate, ...])
rejected_tables (tuple[dict[str, Any], ...])
- image_shape: tuple[int, int]#
- config: ModuleCountingConfig#
- cells: tuple[ModuleCandidate, ...]#
- rejected_tables: tuple[dict[str, Any], ...]#
- property estimated_modules: int | None#
- property review_candidates: int#
- property regular_candidates: int#
- energy_methods.pv_module_counting.count_regular_pv_modules(rgb, site_mask=None, *, config=None, maximum_pixels=4000000, maximum_cells=100000)[source]#
Detect tables and count visible grid cells with no hand-entered row counts.
Input is H x W x 3 uint8 RGB or finite float RGB in 0..1. A boolean mask defines the scope; cells crossing it are excluded. No image rescaling is performed. Per-table shear correction samples original intensities for frame profiles; it adds no optical detail. Narrow seams/irregular pitches and weak colour support are flagged for review; unsupported and clipped tables are recorded.
The method cannot distinguish module frames from cell patterns in arbitrary imagery. Check ground scale, imagery and independent plant records. It does not infer missing modules, purchase imagery, train a model or prove absence.
- Parameters:
rgb (ndarray[tuple[Any, ...], dtype[Any]])
site_mask (ndarray[tuple[Any, ...], dtype[bool]] | None)
config (ModuleCountingConfig | None)
maximum_pixels (int)
maximum_cells (int)
- Return type:
- energy_methods.pv_module_counting.module_candidates_geojson(result, bounds_wgs84)[source]#
Export all cells and review/exclusion flags from a north-up EPSG:4326 image.
Bounds are outer image edges, west/south/east/north. Pixel centres use a half-pixel offset. These are image georeferences, not surveyed asset positions.
- Parameters:
result (ModuleCount)
bounds_wgs84 (tuple[float, float, float, float])
- Return type:
dict[str, Any]