mirror of
				https://github.com/blakeblackshear/frigate.git
				synced 2025-10-27 10:52:11 +01:00 
			
		
		
		
	Customize regions grid overlay API (#8668)
* Customize regions grid overlay * Update http.py Fix
This commit is contained in:
		
							parent
							
								
									934b16723b
								
							
						
					
					
						commit
						8864e33d1c
					
				| @ -267,6 +267,11 @@ Returns the snapshot image from the specific point in that cameras recordings. | ||||
| 
 | ||||
| Returns the latest camera image with the regions grid overlaid. | ||||
| 
 | ||||
| | param        | Type  | Description                                                                                | | ||||
| | ------------ | ----- | ------------------------------------------------------------------------------------------ | | ||||
| | `color`      | str   | The color of the grid (red,green,blue,black,white). Defaults to "green".                   | | ||||
| | `font_scale` | float | Font scale. Can be used to increase font size on high resolution cameras. Defaults to 0.5. | | ||||
| 
 | ||||
| ### `GET /clips/<camera>-<id>.jpg` | ||||
| 
 | ||||
| JPG snapshot for the given camera and event id. | ||||
|  | ||||
| @ -755,6 +755,20 @@ def grid_snapshot(camera_name): | ||||
|                 500, | ||||
|             ) | ||||
| 
 | ||||
|         color_arg = request.args.get("color", default="", type=str).lower() | ||||
|         draw_font_scale = request.args.get("font_scale", default=0.5, type=float) | ||||
| 
 | ||||
|         if color_arg == "red": | ||||
|             draw_color = (0, 0, 255) | ||||
|         elif color_arg == "blue": | ||||
|             draw_color = (255, 0, 0) | ||||
|         elif color_arg == "black": | ||||
|             draw_color = (0, 0, 0) | ||||
|         elif color_arg == "white": | ||||
|             draw_color = (255, 255, 255) | ||||
|         else: | ||||
|             draw_color = (0, 255, 0) | ||||
| 
 | ||||
|         grid_size = len(grid) | ||||
|         grid_coef = 1.0 / grid_size | ||||
|         width = detect.width | ||||
| @ -775,7 +789,7 @@ def grid_snapshot(camera_name): | ||||
|                         int((x + 1) * grid_coef * width), | ||||
|                         int((y + 1) * grid_coef * height), | ||||
|                     ), | ||||
|                     (0, 255, 0), | ||||
|                     draw_color, | ||||
|                     2, | ||||
|                 ) | ||||
|                 cv2.putText( | ||||
| @ -786,8 +800,8 @@ def grid_snapshot(camera_name): | ||||
|                         int((y * grid_coef + 0.02) * height), | ||||
|                     ), | ||||
|                     cv2.FONT_HERSHEY_SIMPLEX, | ||||
|                     fontScale=0.5, | ||||
|                     color=(0, 255, 0), | ||||
|                     fontScale=draw_font_scale, | ||||
|                     color=draw_color, | ||||
|                     thickness=2, | ||||
|                 ) | ||||
|                 cv2.putText( | ||||
| @ -798,8 +812,8 @@ def grid_snapshot(camera_name): | ||||
|                         int((y * grid_coef + 0.05) * height), | ||||
|                     ), | ||||
|                     cv2.FONT_HERSHEY_SIMPLEX, | ||||
|                     fontScale=0.5, | ||||
|                     color=(0, 255, 0), | ||||
|                     fontScale=draw_font_scale, | ||||
|                     color=draw_color, | ||||
|                     thickness=2, | ||||
|                 ) | ||||
|                 cv2.putText( | ||||
| @ -810,8 +824,8 @@ def grid_snapshot(camera_name): | ||||
|                         int((y * grid_coef + 0.08) * height), | ||||
|                     ), | ||||
|                     cv2.FONT_HERSHEY_SIMPLEX, | ||||
|                     fontScale=0.5, | ||||
|                     color=(0, 255, 0), | ||||
|                     fontScale=draw_font_scale, | ||||
|                     color=draw_color, | ||||
|                     thickness=2, | ||||
|                 ) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user