mirror of
https://github.com/hybridgroup/gocv
synced 2025-08-25 08:41:04 +08:00
imgcodecs: Add IMDecodeIntoMat to reduce heap allocations (#1035)
* imgcodecs: add IMDecodeIntoMat which allows to imdecode into existing Mat for performance
This commit is contained in:
committed by
deadprogram
parent
8f2aab1c67
commit
cd9897f55d
@@ -42,3 +42,8 @@ Mat Image_IMDecode(ByteArray buf, int flags) {
|
||||
cv::Mat img = cv::imdecode(data, flags);
|
||||
return new cv::Mat(img);
|
||||
}
|
||||
|
||||
void Image_IMDecodeIntoMat(ByteArray buf, int flags, Mat dest) {
|
||||
std::vector<uchar> data(buf.data, buf.data + buf.length);
|
||||
cv::imdecode(data, flags, dest);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user