Skip to content

Commit

Permalink
[TUTO][FIX] Fixing error when image is RGBa instead of BGR
Browse files Browse the repository at this point in the history
  • Loading branch information
LAGNEAU Romain committed Oct 8, 2024
1 parent 5436980 commit 307082c
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions tutorial/detection/dnn/tutorial-dnn-object-detection-live.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,11 @@ int main(int argc, const char *argv[])
cv::Mat frame;
while (true) {
capture >> frame;
if (frame.type() == CV_8UC4) {
// RGBa format is not supported by the class, converting to BGR format
cv::Mat cpy = frame;
cv::cvtColor(cpy, frame, cv::COLOR_RGBA2BGR);
}
if (frame.empty())
break;

Expand Down

0 comments on commit 307082c

Please sign in to comment.