Skip to content

Commit dd276db

Browse files
committed
Merge pull request opencv#19176 from alalek:issue_19131
2 parents 70d8201 + 3359bdc commit dd276db

File tree

1 file changed

+9
-4
lines changed
  • modules/core/include/opencv2/core

1 file changed

+9
-4
lines changed

modules/core/include/opencv2/core/mat.hpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -702,11 +702,16 @@ sub-matrices.
702702
-# Process "foreign" data using OpenCV (for example, when you implement a DirectShow\* filter or
703703
a processing module for gstreamer, and so on). For example:
704704
@code
705-
void process_video_frame(const unsigned char* pixels,
706-
int width, int height, int step)
705+
Mat process_video_frame(const unsigned char* pixels,
706+
int width, int height, int step)
707707
{
708-
Mat img(height, width, CV_8UC3, pixels, step);
709-
GaussianBlur(img, img, Size(7,7), 1.5, 1.5);
708+
// wrap input buffer
709+
Mat img(height, width, CV_8UC3, (unsigned char*)pixels, step);
710+
711+
Mat result;
712+
GaussianBlur(img, result, Size(7, 7), 1.5, 1.5);
713+
714+
return result;
710715
}
711716
@endcode
712717
-# Quickly initialize small matrices and/or get a super-fast element access.

0 commit comments

Comments
 (0)