valetudo-map-parser 0.1.9a6__tar.gz → 0.1.9a7__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/PKG-INFO +1 -1
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/auto_crop.py +4 -9
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/hypfer_draw.py +54 -30
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/hypfer_handler.py +2 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/rand25_handler.py +2 -13
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/pyproject.toml +1 -1
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/LICENSE +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/NOTICE.txt +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/README.md +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/__init__.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/__init__.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/color_utils.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/colors.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/drawable.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/drawable_elements.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/enhanced_drawable.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/optimized_element_map.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/rand25_parser.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/room_outline.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/shared.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/types.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/utils.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/hypfer_rooms_handler.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/map_data.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/py.typed +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/reimg_draw.py +0 -0
- {valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/rooms_handler.py +0 -0
@@ -7,6 +7,7 @@ import logging
|
|
7
7
|
|
8
8
|
import numpy as np
|
9
9
|
from numpy import rot90
|
10
|
+
from scipy import ndimage
|
10
11
|
|
11
12
|
from .types import Color, NumpyArray, TrimCropData, TrimsData
|
12
13
|
from .utils import BaseHandler
|
@@ -89,7 +90,7 @@ class AutoCrop:
|
|
89
90
|
|
90
91
|
async def _async_auto_crop_data(self, tdata: TrimsData): # , tdata=None
|
91
92
|
"""Load the auto crop data from the Camera config."""
|
92
|
-
_LOGGER.debug("Auto Crop data: %s, %s", str(tdata), str(self.auto_crop))
|
93
|
+
_LOGGER.debug("Auto Crop init data: %s, %s", str(tdata), str(self.auto_crop))
|
93
94
|
if not self.auto_crop:
|
94
95
|
trims_data = TrimCropData.from_dict(dict(tdata.to_dict())).to_list()
|
95
96
|
(
|
@@ -139,7 +140,7 @@ class AutoCrop:
|
|
139
140
|
) -> tuple[int, int, int, int]:
|
140
141
|
"""Crop the image based on the auto crop area using scipy.ndimage for better performance."""
|
141
142
|
# Import scipy.ndimage here to avoid import at module level
|
142
|
-
|
143
|
+
|
143
144
|
|
144
145
|
# Create a binary mask where True = non-background pixels
|
145
146
|
# This is much more memory efficient than storing coordinates
|
@@ -269,7 +270,7 @@ class AutoCrop:
|
|
269
270
|
|
270
271
|
# Get the current room name from robot_pos (not robot_in_room)
|
271
272
|
current_room = self.handler.robot_pos.get("in_room") if self.handler.robot_pos else None
|
272
|
-
|
273
|
+
_LOGGER.info(f"Current room: {current_room}")
|
273
274
|
|
274
275
|
if not current_room:
|
275
276
|
# For Rand256 handler, try to zoom based on robot position even without room data
|
@@ -303,12 +304,9 @@ class AutoCrop:
|
|
303
304
|
self.auto_crop[0] : self.auto_crop[2],
|
304
305
|
]
|
305
306
|
|
306
|
-
|
307
|
-
|
308
307
|
# Calculate bounding box from room outline
|
309
308
|
bounding_box = await self.async_get_room_bounding_box(current_room, rand256)
|
310
309
|
|
311
|
-
|
312
310
|
if not bounding_box:
|
313
311
|
_LOGGER.warning(
|
314
312
|
"%s: Could not calculate bounding box for room '%s'. Using full image.",
|
@@ -328,9 +326,6 @@ class AutoCrop:
|
|
328
326
|
trim_right = right + margin_size
|
329
327
|
trim_up = up - margin_size
|
330
328
|
trim_down = down + margin_size
|
331
|
-
|
332
|
-
|
333
|
-
|
334
329
|
# Ensure valid trim values
|
335
330
|
trim_left, trim_right = sorted([trim_left, trim_right])
|
336
331
|
trim_up, trim_down = sorted([trim_up, trim_down])
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/hypfer_draw.py
RENAMED
@@ -473,14 +473,21 @@ class ImageDraw:
|
|
473
473
|
"angle": angle,
|
474
474
|
"in_room": self.img_h.robot_in_room["room"],
|
475
475
|
}
|
476
|
-
# Handle active zones
|
477
|
-
if self.img_h.active_zones
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
476
|
+
# Handle active zones - Map segment ID to active_zones position
|
477
|
+
if self.img_h.active_zones:
|
478
|
+
from .config.types import RoomStore
|
479
|
+
segment_id = str(self.img_h.robot_in_room["id"])
|
480
|
+
room_store = RoomStore(self.file_name)
|
481
|
+
room_keys = list(room_store.get_rooms().keys())
|
482
|
+
|
483
|
+
if segment_id in room_keys:
|
484
|
+
position = room_keys.index(segment_id)
|
485
|
+
if position < len(self.img_h.active_zones):
|
486
|
+
self.img_h.zooming = bool(self.img_h.active_zones[position])
|
487
|
+
else:
|
488
|
+
self.img_h.zooming = False
|
489
|
+
else:
|
490
|
+
self.img_h.zooming = False
|
484
491
|
else:
|
485
492
|
self.img_h.zooming = False
|
486
493
|
return temp
|
@@ -501,14 +508,21 @@ class ImageDraw:
|
|
501
508
|
"angle": angle,
|
502
509
|
"in_room": self.img_h.robot_in_room["room"],
|
503
510
|
}
|
504
|
-
# Handle active zones
|
505
|
-
if self.img_h.active_zones
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
511
|
+
# Handle active zones - Map segment ID to active_zones position
|
512
|
+
if self.img_h.active_zones:
|
513
|
+
from .config.types import RoomStore
|
514
|
+
segment_id = str(self.img_h.robot_in_room["id"])
|
515
|
+
room_store = RoomStore(self.file_name)
|
516
|
+
room_keys = list(room_store.get_rooms().keys())
|
517
|
+
|
518
|
+
if segment_id in room_keys:
|
519
|
+
position = room_keys.index(segment_id)
|
520
|
+
if position < len(self.img_h.active_zones):
|
521
|
+
self.img_h.zooming = bool(self.img_h.active_zones[position])
|
522
|
+
else:
|
523
|
+
self.img_h.zooming = False
|
524
|
+
else:
|
525
|
+
self.img_h.zooming = False
|
512
526
|
else:
|
513
527
|
self.img_h.zooming = False
|
514
528
|
return temp
|
@@ -574,14 +588,19 @@ class ImageDraw:
|
|
574
588
|
"in_room": self.img_h.robot_in_room["room"],
|
575
589
|
}
|
576
590
|
|
577
|
-
# Handle active zones -
|
591
|
+
# Handle active zones - Map segment ID to active_zones position
|
578
592
|
if self.img_h.active_zones:
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
593
|
+
from .config.types import RoomStore
|
594
|
+
segment_id = str(self.img_h.robot_in_room["id"])
|
595
|
+
room_store = RoomStore(self.file_name)
|
596
|
+
room_keys = list(room_store.get_rooms().keys())
|
597
|
+
|
598
|
+
if segment_id in room_keys:
|
599
|
+
position = room_keys.index(segment_id)
|
600
|
+
if position < len(self.img_h.active_zones):
|
601
|
+
self.img_h.zooming = bool(self.img_h.active_zones[position])
|
602
|
+
else:
|
603
|
+
self.img_h.zooming = False
|
585
604
|
else:
|
586
605
|
self.img_h.zooming = False
|
587
606
|
else:
|
@@ -620,14 +639,19 @@ class ImageDraw:
|
|
620
639
|
"in_room": self.img_h.robot_in_room["room"],
|
621
640
|
}
|
622
641
|
|
623
|
-
# Handle active zones -
|
642
|
+
# Handle active zones - Map segment ID to active_zones position
|
624
643
|
if self.img_h.active_zones:
|
625
|
-
|
626
|
-
|
627
|
-
|
628
|
-
|
629
|
-
|
630
|
-
|
644
|
+
from .config.types import RoomStore
|
645
|
+
segment_id = str(self.img_h.robot_in_room["id"])
|
646
|
+
room_store = RoomStore(self.file_name)
|
647
|
+
room_keys = list(room_store.get_rooms().keys())
|
648
|
+
|
649
|
+
if segment_id in room_keys:
|
650
|
+
position = room_keys.index(segment_id)
|
651
|
+
if position < len(self.img_h.active_zones):
|
652
|
+
self.img_h.zooming = bool(self.img_h.active_zones[position])
|
653
|
+
else:
|
654
|
+
self.img_h.zooming = False
|
631
655
|
else:
|
632
656
|
self.img_h.zooming = False
|
633
657
|
else:
|
@@ -131,6 +131,8 @@ class HypferMapImageHandler(BaseHandler, AutoCrop):
|
|
131
131
|
# Get the pixels size and layers from the JSON data
|
132
132
|
pixel_size = int(m_json["pixelSize"])
|
133
133
|
layers, active = self.data.find_layers(m_json["layers"], {}, [])
|
134
|
+
# Populate active_zones from the JSON data
|
135
|
+
self.active_zones = active
|
134
136
|
new_frame_hash = await self.calculate_array_hash(layers, active)
|
135
137
|
if self.frame_number == 0:
|
136
138
|
self.img_hash = new_frame_hash
|
@@ -2,7 +2,7 @@
|
|
2
2
|
Image Handler Module for Valetudo Re Vacuums.
|
3
3
|
It returns the PIL PNG image frame relative to the Map Data extrapolated from the vacuum json.
|
4
4
|
It also returns calibration, rooms data to the card and other images information to the camera.
|
5
|
-
Version: 0.1.9.
|
5
|
+
Version: 0.1.9.a6
|
6
6
|
"""
|
7
7
|
|
8
8
|
from __future__ import annotations
|
@@ -264,10 +264,6 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
264
264
|
and robot_position
|
265
265
|
and destinations # Check if we have destinations data for room extraction
|
266
266
|
):
|
267
|
-
_LOGGER.debug(
|
268
|
-
"%s: Attempting early room extraction for active zone checking",
|
269
|
-
self.file_name
|
270
|
-
)
|
271
267
|
# Extract room data early if we have destinations
|
272
268
|
try:
|
273
269
|
temp_room_properties = await self.rooms_handler.async_extract_room_properties(
|
@@ -293,12 +289,6 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
293
289
|
# Restore original rooms_pos
|
294
290
|
self.rooms_pos = original_rooms_pos
|
295
291
|
|
296
|
-
_LOGGER.debug(
|
297
|
-
"%s: Early robot room detection for zoom: robot in %s, zooming=%s",
|
298
|
-
self.file_name,
|
299
|
-
robot_room_result.get("in_room", "unknown"),
|
300
|
-
self.zooming
|
301
|
-
)
|
302
292
|
except Exception as e:
|
303
293
|
_LOGGER.debug(
|
304
294
|
"%s: Early room extraction failed: %s, falling back to robot-position zoom",
|
@@ -367,7 +357,7 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
367
357
|
if robot_position:
|
368
358
|
self.robot_position = robot_position
|
369
359
|
|
370
|
-
# Check if
|
360
|
+
# Check if Zoom should be enabled based on active zones
|
371
361
|
if (
|
372
362
|
self.shared.image_auto_zoom
|
373
363
|
and self.shared.vacuum_state == "cleaning"
|
@@ -593,7 +583,6 @@ class ReImageHandler(BaseHandler, AutoCrop):
|
|
593
583
|
|
594
584
|
# Handle active zones - Set zooming based on active zones
|
595
585
|
self.active_zones = self.shared.rand256_active_zone
|
596
|
-
self.zooming = False
|
597
586
|
if self.active_zones and (
|
598
587
|
self.robot_in_room["id"]
|
599
588
|
in range(len(self.active_zones))
|
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/__init__.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/colors.py
RENAMED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/shared.py
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/types.py
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/config/utils.py
RENAMED
File without changes
|
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/map_data.py
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/py.typed
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/reimg_draw.py
RENAMED
File without changes
|
{valetudo_map_parser-0.1.9a6 → valetudo_map_parser-0.1.9a7}/SCR/valetudo_map_parser/rooms_handler.py
RENAMED
File without changes
|