diff options
author | Tom Brazier <tom_github@firstsolo.net> | 2023-06-01 15:29:16 +0100 |
---|---|---|
committer | Tom Brazier <tom_github@firstsolo.net> | 2023-06-01 15:29:16 +0100 |
commit | 51ebc1a7f860341cd170b4fcc5af6680ce77767a (patch) | |
tree | f6b4f075e12fa0893d93e59f60efd6ddf134b124 | |
parent | 73266c54a62c15da83e1e318b7c6beb080403bf9 (diff) |
slightly reduce number of lines of code
-rw-r--r-- | tracker-pt/module/point_extractor.cpp | 19 |
1 files changed, 7 insertions, 12 deletions
diff --git a/tracker-pt/module/point_extractor.cpp b/tracker-pt/module/point_extractor.cpp index 11a12d5e..3329fafc 100644 --- a/tracker-pt/module/point_extractor.cpp +++ b/tracker-pt/module/point_extractor.cpp @@ -148,6 +148,7 @@ void PointExtractor::color_to_grayscale(const cv::Mat& frame, cv::Mat1b& output) return; } + const float half_chr_key_str = *s.chroma_key_strength * 0.5; switch (s.blob_color) { case pt_color_green_only: @@ -167,38 +168,32 @@ void PointExtractor::color_to_grayscale(const cv::Mat& frame, cv::Mat1b& output) } case pt_color_red_chromakey: { - float non_key_coeff = -0.5 * *s.chroma_key_strength; - filter_single_channel(frame, 1, non_key_coeff, non_key_coeff, s.chroma_key_overexposed, output); + filter_single_channel(frame, 1, -half_chr_key_str, -half_chr_key_str, s.chroma_key_overexposed, output); break; } case pt_color_green_chromakey: { - float non_key_coeff = -0.5 * *s.chroma_key_strength; - filter_single_channel(frame, non_key_coeff, 1, non_key_coeff, s.chroma_key_overexposed, output); + filter_single_channel(frame, -half_chr_key_str, 1, -half_chr_key_str, s.chroma_key_overexposed, output); break; } case pt_color_blue_chromakey: { - float non_key_coeff = -0.5 * *s.chroma_key_strength; - filter_single_channel(frame, non_key_coeff, non_key_coeff, 1, s.chroma_key_overexposed, output); + filter_single_channel(frame, -half_chr_key_str, -half_chr_key_str, 1, s.chroma_key_overexposed, output); break; } case pt_color_cyan_chromakey: { - float non_key_coeff = -1.0 * *s.chroma_key_strength; - filter_single_channel(frame, non_key_coeff, 0.5, 0.5, s.chroma_key_overexposed, output); + filter_single_channel(frame, -*s.chroma_key_strength, 0.5, 0.5, s.chroma_key_overexposed, output); break; } case pt_color_yellow_chromakey: { - float non_key_coeff = -1.0 * *s.chroma_key_strength; - filter_single_channel(frame, 0.5, 0.5, non_key_coeff, s.chroma_key_overexposed, output); + filter_single_channel(frame, 0.5, 0.5, -*s.chroma_key_strength, s.chroma_key_overexposed, output); break; } case pt_color_magenta_chromakey: { - float non_key_coeff = -1.0 * *s.chroma_key_strength; - filter_single_channel(frame, 0.5, non_key_coeff, 0.5, s.chroma_key_overexposed, output); + filter_single_channel(frame, 0.5, -*s.chroma_key_strength, 0.5, s.chroma_key_overexposed, output); break; } case pt_color_hardware: |