Skip to content

Instantly share code, notes, and snippets.

@Luavis
Created March 29, 2015 04:41
Show Gist options
  • Save Luavis/d6cc39ad65123098cd18 to your computer and use it in GitHub Desktop.
Save Luavis/d6cc39ad65123098cd18 to your computer and use it in GitHub Desktop.
open cv blur function
//
// main.cpp
// cvTest
//
// Created by 강성일 on 3/28/15.
// Copyright (c) 2015 Luavis. All rights reserved.
//
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <iostream>
using namespace cv;
using namespace std;
void show(int level) {
namedWindow(string("Hello World") + level);
Mat image = imread("test.png");
Mat filtered_image;
Mat filter_kernel = Mat(Size(level, level), CV_32F, 1);
filter_kernel = filter_kernel * 1. / (level * level);
filter2D(image, filtered_image, -1, filter_kernel);
imshow(string("Hello World") + level, filtered_image);
}
int main(int ac, char** av) {
for(int i = 1; i < 10
; i++) show(2 * i + 1);
while(waitKey() != 'q') { /* Application loop */ }
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment