Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions docs/transform_auto_correct_color.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ in the RGB space after automatic detection of a color card within the image. A o
[plantcv.transform.detect_color_card](transform_detect_color_card.md), [plantcv.transform.std_color_matrix](std_color_matrix.md),
[plantcv.transform.get_color_matrix](get_color_matrix.md), and [plantcv.transform.affine_color_correction](transform_affine_color_correction.md).

**plantcv.transform.auto_correct_color**(*rgb_img, label=None, color_chip_size=None, roi=None, \*\*kwargs*)
**plantcv.transform.auto_correct_color**(*rgb_img, color_chip_size=None, roi=None, \*\*kwargs*)

**returns** corrected_img

- **Parameters**
- rgb_img - Input RGB image data containing a color card.
- label - Optional label parameter, modifies the variable name of observations recorded. (default = `pcv.params.sample_label`)
- color_chip_size - Type of color card to be detected, (case insensitive, either "classic", "passport", "nano", or "cameratrax", by default `None`). Or provide `(width, height)` of your specific color card in millimeters. If set then size scalings parameters `pcv.params.unit`, `pcv.params.px_width`, and `pcv.params.px_height` are automatically set, and utilized throughout linear and area type measurements stored to `Outputs`.
- roi - Optional rectangular ROI as returned by [`pcv.roi.rectangle`](roi_rectangle.md) within which to look for the color card. (default = None)
- **kwargs - Other keyword arguments passed to `cv2.adaptiveThreshold` and `cv2.circle`.
Expand Down
14 changes: 10 additions & 4 deletions docs/updating.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,20 @@ automatically. Alternatively, you can run `pip install -e .` to reinstall the pa

### Breaking changes between v4 and v5 <a name="breaking-changes"></a>

#### plantcv.report_size_marker_area
#### plantcv.spectral_index.egi

Renamed the input parameter `rgb_img` to `img` to reflect the flexibility of using the [EGI index function](spectral_index.md)
with RGB and hyperspectral data.

#### plantcv.transform.auto_correct_color

Removed `label` parameter since size marker data is now stored as metadata in the
[`Outputs` class](outputs.md) and does not need to be labeled per sample.

#### plantcv.spectral_index.egi
#### plantcv.transform.detect_color_card

Renamed the input parameter `rgb_img` to `img` to reflect the flexibility of using the [EGI index function](spectral_index.md)
with RGB and hyperspectral data.
Removed `label` parameter since size marker data is now stored as metadata in the
[`Outputs` class](outputs.md) and does not need to be labeled per sample.

#### plantcv.visualize.time_lapse_video

Expand Down Expand Up @@ -1266,6 +1271,7 @@ pages for more details on the input and output variable types.
* pre v4.6: NA
* post v4.6: corrected_img = **plantcv.transform.auto_correct_color**(*rgb_img, label=None, \*\*kwargs*)
* post v4.9: corrected_img = **plantcv.transform.auto_correct_color**(*rgb_img, label=None, color_chip_size=None, roi=None, \*\*kwargs*)
* post v5.0: corrected_img = **plantcv.transform.auto_correct_color**(*rgb_img, color_chip_size=None, roi=None, \*\*kwargs*)

#### plantcv.transform.correct_color

Expand Down
13 changes: 1 addition & 12 deletions plantcv/plantcv/transform/auto_correct_color.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
# Automatically detect a color card and color correct to standard chip values

from plantcv.plantcv import params, deprecation_warning
from plantcv.plantcv.transform.detect_color_card import detect_color_card
from plantcv.plantcv.transform.color_correction import get_color_matrix, std_color_matrix, affine_color_correction


def auto_correct_color(rgb_img, label=None, color_chip_size=None, roi=None, **kwargs):
def auto_correct_color(rgb_img, color_chip_size=None, roi=None, **kwargs):
"""Automatically detect a color card.
Parameters
----------
rgb_img : numpy.ndarray
Input RGB image data containing a color card.
label : str, optional
modifies the variable name of observations recorded (default = pcv.params.sample_label).
color_chip_size: str, tuple, optional
"passport", "classic", "cameratrax"; or tuple formatted (width, height)
in millimeters (default = None)
Expand All @@ -32,13 +28,6 @@ def auto_correct_color(rgb_img, label=None, color_chip_size=None, roi=None, **kw
numpy.ndarray
Color corrected image
"""
# Set label to params.sample_label if None
if label is None:
label = params.sample_label
deprecation_warning(
"The 'label' parameter is no longer utilized, since color chip size is now metadata. "
"It will be removed in PlantCV v5.0."
)
labeled_mask = detect_color_card(rgb_img=rgb_img, color_chip_size=color_chip_size, roi=roi, **kwargs)
_, card_matrix = get_color_matrix(rgb_img=rgb_img, mask=labeled_mask)
std_matrix = std_color_matrix(pos=3)
Expand Down