Changes in idvorkin/video-edit
- (#pose_helperpy)
- (#cv_helperpy)
- (#yolopy)
- .pre-commit-config.yaml
- +195, -0, * 0:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/pose_helper.py)
- Added the
pose_helper.py
file containing classes and functions for pose estimation and manipulation.- Added
BodyPart
Enum for mapping from index to body part. - Added functions
get_body_part
andis_interesting_body_part
for handling body part indexes. - Defined
Bone
as a NamedTuple with bottom and top astorch.tensor
. - Added
Body
class for handling keypoints and confidence of body parts.- Methods in
Body
class includemake_bone
,get_part
,neck
,spine
,r_upper_arm
,r_total_arm
,r_arm_lower
,r_leg_upper
,r_leg_lower
,hip_angle
,knee_angle
,armpit_angle
,spine_vertical
, andneck_to_head
.
- Methods in
- Added functions
make_angle
,bone_to_horizontal
,bone_to_vertical
for angle calculations. - Added
add_pose
function to annotate poses on images using OpenCV. This function visualizes keypoints, angles, and bones on the given image.---
- Added
- +73, -3, * 12:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/cv_helper.py)
- Significant restructuring of
LazyVideoWriter
to support multithreading.- Added threading and queue imports.
- Introduced a frame queue for buffering frames before they are written.
- Implemented a
process_queue
method to handle frame writing in a separate thread. - Modified the
write
method to enqueue frames instead of writing them directly. - Added thread management logic in
release
method to ensure proper thread shutdown.
- Added
write_text
function for drawing text on images.- Supports multi-line text and automatically calculates box size.
- Allows specifying font scale.
- Draws a background rectangle for the text for better visibility.
- Added
scale_point_to_image
function.- Scales a normalized point to image dimensions.
- Validates input types and value ranges.
- Simplified for loop syntax in
process_video
function by removing unnecessary parentheses.---
- +13, -2, *5
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/yolo.py)
- Removed the import of
Annotator
andcolors
fromplots
. - Imported
BodyPart
,get_body_part
,is_interesting_body_part
,Body
, andadd_pose
frompose_helper
. - Changed the pretrained YOLO model from
yolov8n-seg.pt
toyolov8n-pose.pt
. - Added a new method
add_pose
in theYoloProcessor
class to add pose to the image. - Modified the
frame
method to use the added pose to the base image before writing toyolo_writer
. - Adjusted the call to
cv_helper.process_video
to include a space after the comma, improving code style consistency.---
- +12, -0, * 0:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/.pre-commit-config.yaml)
- Added
.pre-commit-config.yaml
with configurations forruff-pre-commit
.- Specified the repository for pre-commit hooks as
https://github.com/astral-sh/ruff-pre-commit
. - Set the revision for the hooks to
v0.1.8
. - Configured two hooks:
ruff
for linting with types specified aspython
,pyi
, andjupyter
. Included--fix
argument to automatically fix issues.ruff-format
for formatting with the same types specified.
- Specified the repository for pre-commit hooks as
- +73, -3, * 12:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/cv_helper.py)
- Significant restructuring of
LazyVideoWriter
to support multithreading.- Added threading and queue imports.
- Introduced a frame queue for buffering frames before they are written.
- Implemented a
process_queue
method to handle frame writing in a separate thread. - Modified the
write
method to enqueue frames instead of writing them directly. - Added thread management logic in
release
method to ensure proper thread shutdown.
- Added
write_text
function for drawing text on images.- Supports multi-line text and automatically calculates box size.
- Allows specifying font scale.
- Draws a background rectangle for the text for better visibility.
- Added
scale_point_to_image
function.- Scales a normalized point to image dimensions.
- Validates input types and value ranges.
- Simplified for loop syntax in
process_video
function by removing unnecessary parentheses.---
- +195, -0, * 0:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/pose_helper.py)
- Added the
pose_helper.py
file containing classes and functions for pose estimation and manipulation.- Added
BodyPart
Enum for mapping from index to body part. - Added functions
get_body_part
andis_interesting_body_part
for handling body part indexes. - Defined
Bone
as a NamedTuple with bottom and top astorch.tensor
. - Added
Body
class for handling keypoints and confidence of body parts.- Methods in
Body
class includemake_bone
,get_part
,neck
,spine
,r_upper_arm
,r_total_arm
,r_arm_lower
,r_leg_upper
,r_leg_lower
,hip_angle
,knee_angle
,armpit_angle
,spine_vertical
, andneck_to_head
.
- Methods in
- Added functions
make_angle
,bone_to_horizontal
,bone_to_vertical
for angle calculations. - Added
add_pose
function to annotate poses on images using OpenCV. This function visualizes keypoints, angles, and bones on the given image.---
- Added
- +13, -2, *5
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/yolo.py)
- Removed the import of
Annotator
andcolors
fromplots
. - Imported
BodyPart
,get_body_part
,is_interesting_body_part
,Body
, andadd_pose
frompose_helper
. - Changed the pretrained YOLO model from
yolov8n-seg.pt
toyolov8n-pose.pt
. - Added a new method
add_pose
in theYoloProcessor
class to add pose to the image. - Modified the
frame
method to use the added pose to the base image before writing toyolo_writer
. - Adjusted the call to
cv_helper.process_video
to include a space after the comma, improving code style consistency.---
- +12, -0, * 0:
- (https://github.com/idvorkin/video-edit/blob/f585dbf580133b0fd2e2d1c911892d1b83502055/.pre-commit-config.yaml)
- Added
.pre-commit-config.yaml
with configurations forruff-pre-commit
.- Specified the repository for pre-commit hooks as
https://github.com/astral-sh/ruff-pre-commit
. - Set the revision for the hooks to
v0.1.8
. - Configured two hooks:
ruff
for linting with types specified aspython
,pyi
, andjupyter
. Included--fix
argument to automatically fix issues.ruff-format
for formatting with the same types specified.
- Specified the repository for pre-commit hooks as