-
-
Notifications
You must be signed in to change notification settings - Fork 101
Conversation
It is now possible to scale the image with a factor (ratio is preserved) that is received from the camera entity. Advantages: - Smaller snapshot file - Faster processing by deepstack
@jodur have you tried https://www.home-assistant.io/integrations/proxy/ ? This allows downsizing images Deepstack resizes the images before processing them. This integration saves the full sized image with annotations |
Yes I am aware of the proxy component. It is a overkill and a loss of unnecessary resources to use the proxy camera, just for rescaling a single snapshot. Every frame from the original cam will be rescaled when the stream from the proxy is accessed. Also an extra delay will be introduced with the proxy for the image processing in relation to realtime motion signals. |
@jodur RE faster processing did you perform a benchmark measurement to estimate the speed improvement? What % improvement is it? RE PR can you add the new arg to the README and also perform black formatting, thanks |
self._image_width, self._image_height = Image.open( | ||
io.BytesIO(bytearray(image)) | ||
).size | ||
_LOGGER.debug((f"Open image")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"Open image" - can you add to this?
|
||
#resize image if different then default | ||
if self._scale!=DEAULT_SCALE: | ||
try: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How often does this fail?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right this was a left for catching wrong scale factors given by the user. Later on i added min and max validation for the scale factor, so this wouldn't be nessecary anymore. I will remove the exception handeling
I changed the PR with your remarks:
|
LGTM, nice work |
With this change it is possible to scale the received image from a camera entity with a factor (ratio is preserved)
Note: Scale is done before transmitting to deepstack.
Advantages: