Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for cropping pictures in proxy camera #18431

Merged
merged 2 commits into from
Nov 22, 2018

Conversation

glpatcern
Copy link
Contributor

@glpatcern glpatcern commented Nov 13, 2018

This PR is motivated by having some public panoramic webcams in my HA setup: those cameras have a large width/height ratio and their preview in HA is far from optimal. A cropped version of the image gives a better preview and the full picture is still accessible by clicking on it, as per default behavior of the proxy camera. I think this can be useful in general, not only for this case.

The PR includes extending the configuration to introduce a mode (either resize, default, or crop) and further parameters for the crop operation.

The crop mode is supported both on static images and on video streams, but I could only test it on a static image. I'm happy to do further testing on an MJPEG stream if I can get one.

Edit: this was successfully tested on a video stream, though with some caveats as illustrated in #39924.

Description:

Related issue (if applicable): N/A

Pull request in home-assistant.io with documentation (if applicable): home-assistant/home-assistant.io#7491

Example entry for configuration.yaml (if applicable):

camera:
  - platform: proxy
    name: My cropped view
    entity_id: camera.original
    mode: crop
    image_left: 800
    max_image_width: 1100

Checklist:

  • The code change is tested and works locally.
  • Local tests pass with tox. Your PR cannot be merged unless tests pass
  • There is no commented out code in this PR.

If user exposed functionality or configuration variables are added/changed:

If the code communicates with devices, web services, or third-party tools:

  • New dependencies have been added to the REQUIREMENTS variable (example).
  • New dependencies are only imported inside functions that use them (example).
  • New or updated dependencies have been added to requirements_all.txt by running script/gen_requirements_all.py.
  • New files were added to .coveragerc.

If the code does not interact with devices:

  • Tests have been added to verify that the new code works.

homeassistant/components/camera/proxy.py Outdated Show resolved Hide resolved
homeassistant/components/camera/proxy.py Outdated Show resolved Hide resolved
homeassistant/components/camera/proxy.py Show resolved Hide resolved
homeassistant/components/camera/proxy.py Show resolved Hide resolved
glpatcern added a commit to glpatcern/home-assistant.github.io that referenced this pull request Nov 13, 2018
This includes extending the configuration to introduce a mode
(either 'resize', default, or 'crop') and further coordinates
for the crop operation.
@glpatcern glpatcern changed the title WIP: Added support for cropping pictures in proxy camera Add support for cropping pictures in proxy camera Nov 13, 2018
@pvizeli pvizeli merged commit b246fc9 into home-assistant:dev Nov 22, 2018
@ghost ghost removed the in progress label Nov 22, 2018
frenck pushed a commit to home-assistant/home-assistant.io that referenced this pull request Dec 5, 2018
* Extended documentation for proxy camera to include PR 18431

home-assistant/core#18431

* Further refinements

* ✏️ Tweak
@balloob balloob mentioned this pull request Dec 12, 2018
@github-actions github-actions bot locked and limited conversation to collaborators Sep 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants