Skip to content

Enhance output path handling for image distortion#3

Open
krataratha wants to merge 1 commit into
OpenRL-Lab:mainfrom
krataratha:patch-1
Open

Enhance output path handling for image distortion#3
krataratha wants to merge 1 commit into
OpenRL-Lab:mainfrom
krataratha:patch-1

Conversation

@krataratha

Copy link
Copy Markdown

Added dynamic output folder naming based on distortion type.

Added dynamic output folder naming based on distortion type.
Copilot AI review requested due to automatic review settings June 19, 2026 16:29

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR enhances add_distortion.py so the output directory can default dynamically to ./perturbations/[type] when --img_out isn’t provided, aligning output paths with the chosen distortion type.

Changes:

  • Changed --img_out default from a fixed folder to None, and derived output_root from distortion type when unset.
  • Refactored save-path construction to use output_root and introduced an img_path variable for readability.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread add_distortion.py
Comment on lines 18 to +21
parser.add_argument('--img_out', '-o',
type=str,
default='./perturbations/CS',
help='path to the output video')
default=None,
help='path to the output video (defaults to ./perturbations/[type])')
Comment thread add_distortion.py
Comment on lines 22 to 26
parser.add_argument(
'--type', '-t',
type=str,
default='CS',
help='distortion type: CS | CC | JPEG | GB')
Comment thread add_distortion.py
if not os.path.exists(os.path.join(args.img_out, dir)):
os.makedirs(os.path.join(args.img_out, dir))
cv2.imwrite(os.path.join(args.img_out, dir, img), per_img)

Comment thread add_distortion.py
Comment on lines +39 to +40
if not os.path.exists(save_dir):
os.makedirs(save_dir)
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.

2 participants