-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Add plasma brightness contrast #2152
Conversation
Reviewer's Guide by SourceryThis PR introduces a new image augmentation transform called PlasmaBrightnessContrast that applies spatially-varying brightness and contrast adjustments using plasma fractal patterns. The implementation uses the Diamond-Square algorithm to generate organic-looking patterns that create natural, non-uniform modifications to the image. The PR also includes some parameter order standardization across multiple transforms to maintain consistency. Class diagram for PlasmaBrightnessContrastclassDiagram
class PlasmaBrightnessContrast {
- tuple[float, float] brightness_range
- tuple[float, float] contrast_range
- int plasma_size
- float roughness
- bool|None always_apply
- float p
+ PlasmaBrightnessContrast(tuple[float, float] brightness_range=(-0.3, 0.3), tuple[float, float] contrast_range=(-0.3, 0.3), int plasma_size=256, float roughness=3.0, bool|None always_apply=None, float p=0.5)
+ get_params_dependent_on_data(dict[str, Any] params, dict[str, Any] data) dict[str, Any]
+ apply(np.ndarray img, float brightness_factor, float contrast_factor, np.ndarray plasma_pattern, **params: Any) np.ndarray
+ get_transform_init_args_names() tuple[str, ...]
}
PlasmaBrightnessContrast --|> ImageOnlyTransform : Inherits
Class diagram for new functions in functional.pyclassDiagram
class functional {
+ get_grid_size(int size, tuple[int, int] target_shape) int
+ random_offset(int current_size, int total_size, float roughness, np.random.Generator random_generator) float
+ initialize_grid(int grid_size, np.random.Generator random_generator) np.ndarray
+ square_step(np.ndarray pattern, int y, int x, int step, int grid_size, float roughness, np.random.Generator random_generator) float
+ diamond_step(np.ndarray pattern, int y, int x, int half, int grid_size, float roughness, np.random.Generator random_generator) float
+ generate_plasma_pattern(tuple[int, int] target_shape, int size, float roughness, np.random.Generator random_generator) np.ndarray
+ apply_plasma_brightness_contrast(np.ndarray img, float brightness_factor, float contrast_factor, np.ndarray plasma_pattern) np.ndarray
}
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @ternaus - I've reviewed your changes - here's some feedback:
Overall Comments:
- Consider standardizing parameter order across all transforms - some instances still have always_apply before p while most have been updated to have p before always_apply
Here's what I looked at during the review
- 🟢 General issues: all looks good
- 🟢 Security: all looks good
- 🟡 Testing: 1 issue found
- 🟢 Complexity: all looks good
- 🟢 Documentation: all looks good
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2152 +/- ##
=========================================
+ Coverage 0 90.25% +90.25%
=========================================
Files 0 48 +48
Lines 0 8366 +8366
=========================================
+ Hits 0 7551 +7551
- Misses 0 815 +815 ☔ View full report in Codecov by Sentry. |
Fixes:
#2103
#2104
Summary by Sourcery
Add a new PlasmaBrightnessContrast transform to the library, allowing for spatially-varying brightness and contrast adjustments using plasma fractal patterns. Update documentation and tests to include this new feature.
New Features:
Enhancements:
Documentation:
Tests: