-
Notifications
You must be signed in to change notification settings - Fork 280
Image sharpening #1825
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
Merged
+631
−432
Merged
Image sharpening #1825
Changes from 33 commits
Commits
Show all changes
41 commits
Select commit
Hold shift + click to select a range
8b27535
sharpening function
joshqsumner c369764
include sharpen
joshqsumner 2eac040
test sharpen function
joshqsumner b877581
include sharpening in docs/updating
joshqsumner 81d170c
deepsource
joshqsumner bfc3069
import params
joshqsumner 112f66d
changing init order
joshqsumner 24f4eb0
direct import
joshqsumner 16287cb
deepsource
joshqsumner 28ce95d
moving helper to helpers
joshqsumner 68c663e
deepsource
joshqsumner 7e3673c
shuffling order
joshqsumner eb51b03
deepsource again
joshqsumner 26b8429
module name
joshqsumner 077fd5b
changing module name back
joshqsumner ec799c1
moving helper back to main sharpen module
joshqsumner 37ac07a
importing np and cv2
joshqsumner 5f291e1
less specific namespace
joshqsumner 0fbcbb4
params back to bottom
joshqsumner 9af3baf
shuffling init
joshqsumner f1dbc4a
Merge branch 'main' into v5.0
joshqsumner 0c52263
Merge branch 'v5.0' into image-sharpening
joshqsumner 4fc053a
importing directly again
joshqsumner 9c63d97
relative import
joshqsumner d2acd28
moving params import into function
joshqsumner 1051b93
just going to try to change the whole thing I guess
joshqsumner 9e179f3
testing more specific import in readimage
joshqsumner 32085a8
test import change
joshqsumner 3101c10
desperation? spelling?
joshqsumner 3dc16b0
Merge branch 'v5.0' into image-sharpening
joshqsumner 4174323
moving params and output class definitions to globals module
joshqsumner 49665c7
Delete time_lapse_video.py
joshqsumner 187fc66
had to remove time lapse video for checks to run
joshqsumner 86c1c44
Merge branch 'v5.0' into image-sharpening
nfahlgren c3bc07d
Update docs/sharpen.md
joshqsumner 1ea6789
copilot suggestions
joshqsumner 5a425ef
read in as gray
joshqsumner 0294791
Merge branch 'v5.0' into image-sharpening
nfahlgren aa4e48a
Add output to function signature
nfahlgren 90eed0a
Reformat docstrings to numpydoc style
nfahlgren 125cc85
Remove spaces
nfahlgren File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| ## Sharpen | ||
|
|
||
| Sharpens an image through the unmask-sharpening method. Applies a gaussian blur which is subtracted from an exaggerated version of the starting image. | ||
|
|
||
| **plantcv.sharpen**(*img, ksize, amount=1, threshold=0, sigma_x=0, sigma_y=None, roi=None*) | ||
|
|
||
| **returns** sharpened image | ||
|
|
||
| - **Parameters:** | ||
| - img - RGB or grayscale image data | ||
| - ksize - Tuple of kernel dimensions, e.g. (5, 5). Must be odd integers. | ||
| - amount - Integer describing amount of sharpening, higher numbers will sharpen more. | ||
| - threshold - Integer cutoff on low contrast, contrasts lower than this will be removed. | ||
| - sigma_x - standard deviation in X direction; if 0 (default), calculated from kernel size | ||
| - sigma_y - standard deviation in Y direction; if sigma_Y is None (default), sigma_Y is taken to equal sigma_X | ||
| - roi - Optional rectangular ROI as returned by [`pcv.roi.rectangle`](roi_rectangle.md) within which to apply this function. (default = None, which uses the entire image) | ||
nfahlgren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
nfahlgren marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| - **Context:** | ||
| - Used to reduce blur in an image | ||
|
|
||
| **Original image** | ||
|
|
||
|  | ||
|
|
||
| **Sharpening Image** | ||
|
|
||
| ```python | ||
|
|
||
| # Apply sharpening within an ROI to show differences | ||
| roi = pcv.roi.rectangle(img, 200, 0, 335, 200) | ||
| sharp1 = pcv.sharpen(img, (5, 5), amount=1, roi=roi) | ||
|
|
||
| # Higher amount of sharpening will look more dramatic | ||
| sharp5 = pcv.sharpen(img, (5, 5), amount = 5, roi=roi) | ||
| ``` | ||
|
|
||
| **Sharpen (ksize = (5,5), amount=1, roi=roi)** | ||
|
|
||
|  | ||
|
|
||
| **Sharpen (ksize = (5,5), amount=5, roi=roi)** | ||
|
|
||
|  | ||
|
|
||
| **Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/main/plantcv/plantcv/sharpen.py) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.