Skip to content

Instantly share code, notes, and snippets.

@Noxalus
Created May 26, 2015 17:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Noxalus/a51af67ba868730ae3bc to your computer and use it in GitHub Desktop.
Save Noxalus/a51af67ba868730ae3bc to your computer and use it in GitHub Desktop.
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