-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added markdown file for rgb2cmyk function
- Loading branch information
1 parent
2394854
commit f8cec63
Showing
1 changed file
with
77 additions
and
0 deletions.
There are no files selected for viewing
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,77 @@ | ||
## RGB to CMYK | ||
|
||
Convert image from RGB color space to CMYK color space and split the channels. | ||
|
||
**plantcv.rgb2gray_cmyk**(*rgb_img, channel*) | ||
|
||
**returns** split image (c, m, y or k channel) | ||
|
||
- **Parameters:** | ||
- rgb_img - RGB image data | ||
- channel - Split 'c' (cyan), 'm' (magenta), 'y' (yellow) or 'k' (black) channel | ||
|
||
- **Context:** | ||
- Used to help differentiate plant and background | ||
|
||
|
||
**Original RGB image** | ||
|
||
![Screenshot](img/documentation_images/rgb2cmyk/original_image.jpg) | ||
|
||
```python | ||
|
||
from plantcv import plantcv as pcv | ||
|
||
# Set global debug behavior to None (default), "print" (to file), | ||
# or "plot" (Jupyter Notebooks or X11) | ||
pcv.params.debug = "print" | ||
|
||
# image converted from RGB to LAB, channels are then split. | ||
# Lightness ('l') channel is output | ||
l_channel = pcv.rgb2gray_cmyk(rgb_img=rgb_img, channel='Y') | ||
|
||
``` | ||
|
||
**Cyan channel image** | ||
|
||
![Screenshot](img/documentation_images/rgb2lab/CMYK-cyan.jpg) | ||
|
||
```python | ||
|
||
# Green-Magenta ('a') channel is output | ||
a_channel = pcv.rgb2gray_cmyk(rgb_img=rgb_img, channel='C') | ||
|
||
``` | ||
|
||
**Magenta channel image** | ||
|
||
![Screenshot](img/documentation_images/rgb2lab/CMYK-magenta.jpg) | ||
|
||
```python | ||
|
||
# Green-Magenta ('a') channel is output | ||
a_channel = pcv.rgb2gray_cmyk(rgb_img=rgb_img, channel='M') | ||
|
||
``` | ||
|
||
**Yellow channel image** | ||
|
||
![Screenshot](img/documentation_images/rgb2lab/CMYK-yellow.jpg) | ||
|
||
```python | ||
|
||
# Green-Magenta ('a') channel is output | ||
a_channel = pcv.rgb2gray_cmyk(rgb_img=rgb_img, channel='Y') | ||
|
||
``` | ||
|
||
**Black channel image** | ||
|
||
![Screenshot](img/documentation_images/rgb2lab/CMYK-black.jpg) | ||
|
||
```python | ||
|
||
# Green-Magenta ('a') channel is output | ||
a_channel = pcv.rgb2gray_cmyk(rgb_img=rgb_img, channel='K') | ||
|
||
``` |