You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@hcgprague Hi!, thank you for proposing a useful code.
I guess the Mat class comes from OpenCV, so your code would be helpful if one is using both Softcam and OpenCV.
Adding such code to Softcam library will introduce an unnecessary library dependency for users who don't use OpenCV.
So I won't add this code to Softcam library itself.
But I believe that as long as your code is valid it can help other people who want to do the same.
So, I enabled the Discussions tab of this GitHub repo, where I think your post could keep open to be found for someone finding information.
I will look at applying Convert to discussion feature to this issue.
Repository owner
locked and limited conversation to collaborators
Jun 26, 2023
could it add a convert function() which make input is a Mat format ?
a convert function() which make input is a Mat format as :
void Mat2DWimage( Mat matImage, vector &directShowImage )
{
int width = matImage.cols;
int height = matImage.rows;
int channels = matImage.channels();
std::vector directShowImage(width * height * 3);
if (matImage.isContinuous()) {
memcpy(directShowImage.data(), matImage.data, directShowImage.size());
} else {
// If the image is not stored continuously in memory, copy row by row
for (int row = 0; row < height; ++row) {
memcpy(&directShowImage[row * width * 3], matImage.ptr(row), width * 3);
}
}
}
The text was updated successfully, but these errors were encountered: