Add `QImage` and `CV::Mat` conversion functions into `Frame` for better handling alpha channel handling
This pull request introduces enhanced image effect capabilities for the Frame class by leveraging the OpenCV library. Direct manipulation of QImage raw data for complex effects proves challenging, and the performance of QGraphicsEffect can be suboptimal. To address these limitations, this PR proposes the integration of OpenCV for more efficient and versatile effect creation.
While existing conversion functions between QImage and cv::Mat in Frame.cpp lack alpha channel support, several effects, including the currently implemented Outline and the proposed Shadow, require it for proper rendering. This pull request introduces four new methods to facilitate seamless conversion between QImage and cv::Mat while preserving the alpha channel:
-
QImage2BGRACvMat: Converts aQImageto acv::MatwithBGRApixel format. -
BGRACvMat2QImage: Converts acv::MatwithBGRApixel format back to aQImage. -
GetBGRACvMat: Provides access to the underlyingcv::Mat(inBGRAformat) of aFrameobject. -
SetBGRACvMat: Allows setting thecv::Mat(inBGRAformat) to aFrameobject.
These conversion functions were previously located within the Outline effect code and have been migrated to the Frame class for broader reusability. Your review and feedback on these additions would be greatly appreciated.
~~Note: The imagecv variable, which appears to be a potentially unused cached cv::Mat, is currently shared across the code. While investigating its purpose, no clear or active usage was identified. The line intended for caching was also commented out. This aspect might warrant further review or potential removal in a subsequent cleanup.~~
Now switched to brga_image_cv variable.
Codecov Report
Attention: Patch coverage is 87.50000% with 5 lines in your changes missing coverage. Please review.
Project coverage is 57.35%. Comparing base (
7b4e999) to head (985a9df).
| Files with missing lines | Patch % | Lines |
|---|---|---|
| src/Frame.cpp | 80.00% | 5 Missing :warning: |
Additional details and impacted files
@@ Coverage Diff @@
## develop #998 +/- ##
===========================================
+ Coverage 57.31% 57.35% +0.04%
===========================================
Files 198 198
Lines 18166 18189 +23
===========================================
+ Hits 10412 10433 +21
- Misses 7754 7756 +2
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.