Changes have been pushed for the repository "fawkesrobotics/fawkes".

Clone:  https://github.com/fawkesrobotics/fawkes.git
Gitweb: https://github.com/fawkesrobotics/fawkes

The branch, neltester/cv_fv_color_conversions has been updated
        to  cb1031e8c24cca67c7e50ed9cb7161ad31ec1e2f (commit)
      from  096225776fff1373ece155e4b7935f14f6098514 (commit)

https://github.com/fawkesrobotics/fawkes/tree/neltester/cv_fv_color_conversions

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- *Log* ---------------------------------------------------------------
commit cb1031e8c24cca67c7e50ed9cb7161ad31ec1e2f
Author:     Niklas Sebastian Eltester <[email protected]>
AuthorDate: Fri Jun 11 12:28:11 2021 +0200
Commit:     Niklas Sebastian Eltester <[email protected]>
CommitDate: Fri Jun 11 12:32:24 2021 +0200

    fvutils: optimise color conversions
    
    The previous color conversion used an inefficient while for the tmp
    buffer, this is replaced by the proper 8 bit color depth formula for
    YUV422 images.
    Further the copying of the cv::Mat image is replaced by creating an
    empty cv::Mat of the same type and dimesions.

https://github.com/fawkesrobotics/fawkes/commit/cb1031e8c

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


- *Summary* -----------------------------------------------------------
 src/libs/fvutils/adapters/cvmatadapter.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)


- *Diffs* -------------------------------------------------------------

- *commit* cb1031e8c24cca67c7e50ed9cb7161ad31ec1e2f - - - - - - - - - -
Author:  Niklas Sebastian Eltester <[email protected]>
Date:    Fri Jun 11 12:28:11 2021 +0200
Subject: fvutils: optimise color conversions

 src/libs/fvutils/adapters/cvmatadapter.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

_Diff for modified files_:
diff --git a/src/libs/fvutils/adapters/cvmatadapter.cpp 
b/src/libs/fvutils/adapters/cvmatadapter.cpp
index 158f75636..4714854fb 100644
--- a/src/libs/fvutils/adapters/cvmatadapter.cpp
+++ b/src/libs/fvutils/adapters/cvmatadapter.cpp
@@ -43,14 +43,13 @@ namespace firevision {
 void
 CvMatAdapter::convert_image_bgr(unsigned char *buffer, cv::Mat &image)
 {
-       int buffer_size = 0;
-       while (buffer[buffer_size] != '\0') {
-               buffer_size++;
-       }
-       unsigned char tmp[buffer_size];
+       //8 bit color depth -> width * height + (width * height) * 0.5 + (width 
* height) * 0.5
+       //                      Y             + U                      + V
+       unsigned char tmp[image.cols * image.rows * 2];
        convert(YUV422_PLANAR, YUV422_PACKED, buffer, tmp, image.cols, 
image.rows);
        cv::Mat tmp_mat = cv::Mat(image.size(), CV_8UC2, tmp);
        cv::cvtColor(tmp_mat, image, cv::COLOR_YUV2BGR_UYVY, 3);
+       tmp_mat.release();
 }
 
 /** Convert image from cv::Mat into buffer.
@@ -60,9 +59,10 @@ CvMatAdapter::convert_image_bgr(unsigned char *buffer, 
cv::Mat &image)
 void
 CvMatAdapter::convert_image_yuv422_planar(cv::Mat &image, unsigned char 
*buffer)
 {
-       cv::Mat tmp_mat = cv::Mat(image);
+       cv::Mat tmp_mat = cv::Mat(image.size(), CV_8UC3, 3);
        cv::cvtColor(image, tmp_mat, cv::COLOR_BGR2YUV, 3);
        convert(YUV422_PACKED, YUV422_PLANAR, tmp_mat.data, buffer, image.cols, 
image.rows);
+       tmp_mat.release();
 }
 
 /* Creates a new IplImage for a ROI.



_______________________________________________
fawkes-commits mailing list
[email protected]
https://lists.kbsg.rwth-aachen.de/listinfo/fawkes-commits

Reply via email to