Skip to content

Instantly share code, notes, and snippets.

@sekimura
Last active August 29, 2015 14:02
Show Gist options
  • Save sekimura/629b1b1fc15a8914a560 to your computer and use it in GitHub Desktop.
Save sekimura/629b1b1fc15a8914a560 to your computer and use it in GitHub Desktop.
#include <opencv2/core/core.hpp>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
int
main(int argc, char *argv[])
{
cv::Mat src_img = cv::imread("./960x460.jpg", 1);
if(!src_img.data) return -1;
cv::Mat dst_img;
cv::GaussianBlur(src_img, dst_img, cv::Size(11,11), 10, 10);
cv::imwrite("./blurred.jpg", dst_img);
}
#!/usr/bin/python
import argparse
import cv2
def blurr(src, dst, sigma=48.0):
size = int(sigma)
if (size % 2 == 0):
size = size + 1
src_img = cv2.imread(src, 1)
dst_img = cv2.GaussianBlur(src_img, (size, size), sigma, sigma)
cv2.imwrite(dst, dst_img)
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument('--src', help='')
parser.add_argument('--dst', help='')
parser.add_argument('--sigma', type=float, help='')
args = parser.parse_args()
blurr(args.src, args.dst, args.sigma)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment