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

In/Out Endpoint Configuration #135

Merged
merged 7 commits into from
Feb 18, 2021

Conversation

renzodgc
Copy link
Collaborator

  • Add endpoints to support the In/Out Metric.
  • Add structure for the metric's implementation.
  • Fixed typos in metrics interface.



class InOutBoundaries(BaseModel):
in_line: Tuple[Tuple[int, int], Tuple[int, int]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You will also need the direction of movement for each line. Not sure about the best way to store it

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wasn't it from in to out?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nope. Each line has a direction. Only if a person is moving in that direction it will be counted. In/Out could possibly be the same line but will have opposite directions

"""
in_out_file_path = InOutMetric.get_in_out_file_path(camera_id, settings.config)
in_out_boundaries = InOutMetric.get_in_out_boundaries(in_out_file_path)
if in_out_boundaries is None:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that before checking for the boundaries we should check for camera existence in order to return a clear 404 message.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, I thought we were doing that by default on a callback, I'll update the endpoints to check for camera existance

def get_in_out_file_path(cls, camera_id, config):
""" Returns the path to the roi_contour file """
return f"{get_source_log_directory(config)}/{camera_id}/{IN_OUT}/{IN_OUT}.json"

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not sure if the log directory is the best place to store these configuration files (such as the calibration matrix and the in/out json).
Maybe we can "refactor" this and store the config files in a different folder.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I didn't want to clog the camera's configs, and the file should be inside one of the folders for a specific camera

@@ -236,6 +239,7 @@ async def get_camera_image(camera_id: str):
"""
Gets the image related to the camera <camera_id>
"""
_ = get_camera_from_id(camera_id)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this probably works, it doesn't sound right. I think you are misusing the function or at least the name is very misleading

@@ -347,8 +355,12 @@ async def remove_roi_contour(camera_id: str, reboot_processor: Optional[bool] =
@cameras_router.get("/{camera_id}/in_out_boundaries")
async def get_in_out_boundaries(camera_id: str):
"""
Get the In/Out Boundaries
Get the In/Out Boundaries for a camera.
Two coordinates `[x,y]` are given in duples `[A,B]`. These points form a **line**.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Two coordinates `[x,y]` are given in duples `[A,B]`. These points form a **line**.
Two coordinates `[x,y]` are given in tuples `[A,B]`. These points form a **line**.

@renzodgc renzodgc merged commit 6d6a549 into galliot-us:master Feb 18, 2021
@renzodgc renzodgc deleted the InOutConfigurationEndpoints branch February 18, 2021 13:53
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.

3 participants