Skip to content

Commit

Permalink
imgcodecs: optimize copy of data used for IMDecode method
Browse files Browse the repository at this point in the history
Signed-off-by: Ron Evans <[email protected]>
  • Loading branch information
deadprogram committed Dec 23, 2019
1 parent 453df7c commit e9e88eb
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions imgcodecs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,7 @@ struct ByteArray Image_IMEncode_WithParams(const char* fileExt, Mat img, IntVect
}

Mat Image_IMDecode(ByteArray buf, int flags) {
std::vector<uchar> data;

for (size_t i = 0; i < buf.length; i++) {
data.push_back(buf.data[i]);
}

std::vector<uchar> data(buf.data, buf.data + buf.length);
cv::Mat img = cv::imdecode(data, flags);
return new cv::Mat(img);
}

0 comments on commit e9e88eb

Please sign in to comment.