Created
May 26, 2015 17:13
-
-
Save Noxalus/a51af67ba868730ae3bc to your computer and use it in GitHub Desktop.
Use GaussianBlur with OpenCV
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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