Add QImage
and CV::Mat
conversion functions into Frame
for better handling alpha channel handling
#998
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request introduces enhanced image effect capabilities for the
Frame
class by leveraging the OpenCV library. Direct manipulation ofQImage
raw data for complex effects proves challenging, and the performance ofQGraphicsEffect
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
andcv::Mat
inFrame.cpp
lack alpha channel support, several effects, including the currently implementedOutline
and the proposedShadow
, require it for proper rendering. This pull request introduces four new methods to facilitate seamless conversion betweenQImage
andcv::Mat
while preserving the alpha channel:QImage2BGRACvMat
: Converts aQImage
to acv::Mat
withBGRA
pixel format.BGRACvMat2QImage
: Converts acv::Mat
withBGRA
pixel format back to aQImage
.GetBGRACvMat
: Provides access to the underlyingcv::Mat
(inBGRA
format) of aFrame
object.SetBGRACvMat
: Allows setting thecv::Mat
(inBGRA
format) to aFrame
object.These conversion functions were previously located within the
Outline
effect code and have been migrated to theFrame
class for broader reusability. Your review and feedback on these additions would be greatly appreciated.Note: Theimagecv
variable, which appears to be a potentially unused cachedcv::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.