Logo
Explore Help
Sign In
kevin/operating-room-monitor-server
1
0
Fork 0
You've already forked operating-room-monitor-server
Code Issues Pull Requests Actions Packages Projects Releases Wiki Activity
Files
69980d80735dc4f99bb328ee86eba895c7c4b401
operating-room-monitor-server/app/services/video/frame_encode.py

14 lines
449 B
Python
Raw Normal View History

feat: surgery pipeline API, video inference, voice confirm, and tests - Add FastAPI routes for surgery start/end, results, pending confirmation (WAV upload), and health checks. - Implement RTSP/Hikvision capture, consumable classification, session manager, MinIO/Baidu voice resolution, and DB persistence. - Add documentation (client API, video backends, staging checklist) and sample camera/RTSP config. - Add pytest suite (API contract, session manager, voice, repositories, pipeline persistence) and httpx dev dependency. - Replace deprecated HTTP_422_UNPROCESSABLE_ENTITY with HTTP_422_UNPROCESSABLE_CONTENT. - Fix SurgeryPipeline DB reads to use an explicit transaction with autobegin disabled. Made-with: Cursor
2026-04-21 18:33:54 +08:00
from __future__ import annotations
import cv2
import numpy as np
def frame_to_jpeg_bytes(frame: np.ndarray, *, quality: int = 85) -> bytes:
"""Encode BGR frame to JPEG bytes for model services expecting image bytes."""
params = [int(cv2.IMWRITE_JPEG_QUALITY), int(quality)]
ok, buf = cv2.imencode(".jpg", frame, params)
if not ok or buf is None:
raise RuntimeError("cv2.imencode failed for JPEG")
return buf.tobytes()
Reference in New Issue Copy Permalink
Powered by Gitea Version: 1.25.5 Page: 124ms Template: 0ms
English
Bahasa Indonesia Deutsch English Español Français Gaeilge Italiano Latviešu Magyar nyelv Nederlands Polski Português de Portugal Português do Brasil Suomi Svenska Türkçe Čeština Ελληνικά Български Русский Українська فارسی മലയാളം 日本語 简体中文 繁體中文(台灣) 繁體中文(香港) 한국어
Licenses API