-
Notifications
You must be signed in to change notification settings - Fork 265
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #569 from danforthcenter/add-feature-to-pcv.visual…
…ize.pseudocolor
- Loading branch information
Showing
13 changed files
with
311 additions
and
196 deletions.
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.
Binary file added
BIN
+11.1 KB
docs/img/documentation_images/mask_bad_threshold/original_grayscale.jpg
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.
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.
Binary file added
BIN
+15.7 KB
docs/img/documentation_images/pseudocolor/pseudocolored_mask_bad_obj.png
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 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,40 @@ | ||
## Mask bad pixels Threshold | ||
|
||
Creates a binary image from a grayscale based on pixel values and the definition of "bad" pixels. | ||
"Bad" pixels are invalid numeric data such as not a number (nan) or infinite (inf). | ||
|
||
**plantcv.threshold.mask_bad(*float_img, bad_type="native"*)** | ||
|
||
**returns** thresholded/binary image | ||
|
||
- **Parameters:** | ||
- float_img - Input float image data (most likely an image that is the result of some numeric calculation, e.g. a hyperspectral index image). The datatype should be "float". | ||
- bad_type - The definition of "bad" pixels ("nan", "inf", or "native", default="native") | ||
- **Context:** | ||
- Used to threshold based on value of pixels. This can be useful to post-process calculated hyperspectral indices. | ||
- **Example use:** | ||
- Below (to be followed with "visualize.pseudocolor" to visualize the result). | ||
|
||
```python | ||
|
||
from plantcv import plantcv as pcv | ||
# Mask all types of bad pixels out present in the original image (nan and inf) | ||
bad_mask_1 = pcv.threshold.mask_bad(float_img=float_img, bad_type="native") | ||
|
||
# Mask pixels with nan values (if any) in the original image out | ||
bad_mask_2 = pcv.threshold.mask_bad(float_img=float_img, bad_type="nan") | ||
|
||
# Mask pixels with inf values (if any) in the original image out | ||
bad_mask_3 = pcv.threshold.mask_bad(float_img=float_img, bad_type="inf") | ||
|
||
``` | ||
|
||
**Mask for bad pixels** | ||
|
||
We can see that a mask indicating locations of "bad" pixels generated. | ||
|
||
![Screenshot](img/documentation_images/mask_bad_threshold/bad_mask_both.png) | ||
|
||
To visualize the original image with "bad" pixels highlighted, check [here](https://github.com/danforthcenter/plantcv/blob/master/docs/visualize_pseudocolor.md) | ||
|
||
**Source Code:** [Here](https://github.com/danforthcenter/plantcv/blob/master/plantcv/plantcv/threshold/threshold_methods.py) |
This file contains 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 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 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 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 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.