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

Birdseye Autolayout #6734

Merged
merged 10 commits into from
Jun 11, 2023
Merged

Birdseye Autolayout #6734

merged 10 commits into from
Jun 11, 2023

Conversation

NickM-27
Copy link
Sponsor Collaborator

@NickM-27 NickM-27 commented Jun 7, 2023

This PR works to attempt to fill in the full birdseye canvas with camera as opposed to the grid layout. This is especially useful for cameras like my hikvision panoramic which essentially takes up the same space as 2 16:9 cameras. There are a few behavior changes relative to the previous implementation:

  • the birdseye aspect ratio matters, this should match the aspect ratio of the majority of your cameras so they fit nicely into the layout
  • the birdseye resolution matters, the auto layout implementation will attempt to put all cameras in based on their native detect resolution and then scale down if there is not enough height available.
  • the order of the cameras matters and can be customized to better fit what is optimal

Screen Shot 2023-06-07 at 10 45 34 AM

@netlify
Copy link

netlify bot commented Jun 7, 2023

Deploy Preview for frigate-docs canceled.

Name Link
🔨 Latest commit d4015f0
🔍 Latest deploy log https://app.netlify.com/sites/frigate-docs/deploys/648265fdd3a1cb00088822aa

@blakeblackshear
Copy link
Owner

Did you test this with portrait cameras as well?

@NickM-27
Copy link
Sponsor Collaborator Author

No I haven't tested with portrait, I think it would work fine if the birdseye resolution was set to portrait but if it was the default horizontal I don't think this would allow portrait to take the full screen

@blakeblackshear blakeblackshear merged commit fd6eb78 into dev Jun 11, 2023
@blakeblackshear blakeblackshear deleted the birdseye-autolayout branch June 11, 2023 12:54
@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 12, 2023

No I haven't tested with portrait, I think it would work fine if the birdseye resolution was set to portrait but if it was the default horizontal I don't think this would allow portrait to take the full screen

Can confirm, a vertical camera gets squished into a box suitable for a normal horizontal camera. I think it would be nice to have the option for a vertical camera to take up two horizontal places.

Example:

|       |   H1   |
|   V   |--------|
|       |   H2   |

@NickM-27
Copy link
Sponsor Collaborator Author

@JeffWDH how many cameras are in your layout? behavior will be different if it is 3+

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 12, 2023

@NickM-27 I was testing with two, one vertical and one horizontal.

I just tested with one vertical and two horizontal and a similar layout happens, the vertical one gets squished into a.box suitable for a horizontal camera.

@NickM-27
Copy link
Sponsor Collaborator Author

Thanks, I have fixed this #6779

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 12, 2023

@NickM-27 Excellent, thank you very much for all the work you put into this project.

@ccutrer
Copy link
Contributor

ccutrer commented Jun 12, 2023

This is not working well with my one portrait camera. It's getting squished down tiny. I'm on 0.13.0-FF90DB3. I am seeing a couple log lines about 2023-06-12 22:08:29.727095303 [2023-06-12 22:08:29] frigate.output ERROR : Canvas ratio is 810.0 > 720 :: 1.5, which I'm not sure if it's related or not.

latest

@NickM-27
Copy link
Sponsor Collaborator Author

@ccutrer Have you read the conversation above?

@ccutrer
Copy link
Contributor

ccutrer commented Jun 12, 2023

Yes. In particular

I just tested with one vertical and two horizontal and a similar layout happens, the vertical one gets squished into a.box suitable for a horizontal camera.

But my screenshot looks like my portrait camera is somehow getting squished down to 1/4 the size of a box suitable for a landscape camera, not one. I also saw a similar thing when I had ~10 active cameras. I'm happy to test that PR out though. Are docker images not automatically generated for PRs?

@NickM-27
Copy link
Sponsor Collaborator Author

it's the same issue, fixed in the PR. It is also worth noting that the cameras that come first in the order are given higher priority as far as sizing goes. So if you want the portrait camera to be higher size you should order it to be one of the first ones in the layout

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 13, 2023

dev-7e5abe7-tensorrt

@NickM-27 - it's better but still not optimal:
2 Camera
image
3 Camera
image

I've tried reordering my cameras in the "cameras:" section but it doesn't seem to change the layout.

@NickM-27
Copy link
Sponsor Collaborator Author

yeah, you need to set the birdseye order with

cameras:
  your_camera:
    birdseye:
      order: x

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 13, 2023

That makes much more sense than what I was doing :)

I ordered the vertical camera 0, and the other two 1 & 2. The birdseye stream is broken now and get the following errors in the log:

2023-06-13 14:51:23.811805977  Traceback (most recent call last):
2023-06-13 14:51:23.811812317    File "/opt/frigate/frigate/output.py", line 549, in update
2023-06-13 14:51:23.811813877      updated_frame = self.update_frame()
2023-06-13 14:51:23.811815797    File "/opt/frigate/frigate/output.py", line 525, in update_frame
2023-06-13 14:51:23.811816997      self.copy_to_position(
2023-06-13 14:51:23.811818237    File "/opt/frigate/frigate/output.py", line 251, in copy_to_position
2023-06-13 14:51:23.811819247      copy_yuv_to_position(
2023-06-13 14:51:23.811820387    File "/opt/frigate/frigate/util.py", line 481, in copy_yuv_to_position
2023-06-13 14:51:23.811821387      destination_frame[
2023-06-13 14:51:23.811822567  ValueError: could not broadcast input array from shape (1280,720) into shape (1080,720)

@NickM-27
Copy link
Sponsor Collaborator Author

Interesting, I'll take a look at that but for now maybe try increasing the birdseye resolution slightly

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 13, 2023

This is with:
width: 2000
height: 1100
image

No errors in the log

@NickM-27
Copy link
Sponsor Collaborator Author

what is the resolution on the portrait cam?

@JeffWDH
Copy link
Contributor

JeffWDH commented Jun 13, 2023

Detect (W/H): 720/1280
Record (W/H): 1440x2560

@DrSpaldo
Copy link

Will the changes made here give the potential for Birdseye to only display one camera? Ie. Only display the camera with the last motion, so you see the current/last motion camera better and not split?

@NickM-27
Copy link
Sponsor Collaborator Author

Will the changes made here give the potential for Birdseye to only display one camera? Ie. Only display the camera with the last motion, so you see the current/last motion camera better and not split?

Not sure I understand the question, birdseye always showed 1 camera if only 1 camera fit the activity type. These PRs only change the layout not the birdseye behavior itself

@DrSpaldo
Copy link

DrSpaldo commented Jul 17, 2023

Not sure I understand the question, birdseye always showed 1 camera if only 1 camera fit the activity type. These PRs only change the layout not the birdseye behavior itself

Thanks @NickM-27 , I was hoping that the changes may allow for the display to only ever show one camera. The last camera that detected motion or an object. So that there is ever only one larger display but it would change depending on the most recent motion or object detection.

As in, there was an option that this new PR gives the function of saying, only display x amount of cameras at any one time.

@NickM-27
Copy link
Sponsor Collaborator Author

That would be a separate feature request although I don't think it would be difficult to implement

@DrSpaldo
Copy link

DrSpaldo commented Jul 17, 2023

That would be a separate feature request although I don't think it would be difficult to implement

Thanks @NickM-27 , I thought that part of it may be out of scope of this PR. However, given the new changes that this will allow for the camera view/size, etc, I thought they may go well together. I will create a new issue/feature request

@isaacolsen94
Copy link

So out of curiosity (tried testing real fast but couldn't get Unraid to download dev branch), if I have 6 x 16:9 feeds, and 2 4:3 feeds. would this be able to make 2 columns x 3 rows of 16:9 and 1 column 2 rows of 4:3 to fill the screen?

@NickM-27
Copy link
Sponsor Collaborator Author

So out of curiosity (tried testing real fast but couldn't get Unraid to download dev branch), if I have 6 x 16:9 feeds, and 2 4:3 feeds. would this be able to make 2 columns x 3 rows of 16:9 and 1 column 2 rows of 4:3 to fill the screen?

It would depend on the order of the cameras

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants