Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Use GaussianBlur with OpenCV
void proccessImage(std::vector<unsigned char>& imageData, int width, int height)
{
Mat src(width, height, CV_8UC4, const_cast<unsigned char*>(imageData.data()));
Mat src_gray, final;
// Convert the source image to gray
cvtColor(src, src_gray, CV_BGRA2GRAY);
// Apply gaussian blur on the gray image
GaussianBlur(src_gray, src_gray, cv::Size(9, 9), 2, 2);
// Convert the gray blur image to RGBA
cvtColor(src_gray, final, CV_GRAY2RGBA);
// Reform the std::vector from cv::Mat data
std::vector<unsigned char> array;
array.assign((unsigned char*)final.datastart, (unsigned char*)final.dataend);
// Send final image data to GPU and draw it
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.