Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

could it add a convert function() which make input is a Mat format #34

Closed
hcgprague opened this issue Jun 26, 2023 · 1 comment
Closed

Comments

@hcgprague
Copy link

hcgprague commented 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);
}
}
}

@tshino
Copy link
Owner

tshino commented Jun 26, 2023

@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
@tshino tshino converted this issue into discussion #35 Jun 26, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants