Untitled

 avatar
unknown
plain_text
5 years ago
750 B
6
Indexable
#include "opencv2\highgui\highgui.hpp"
#include "opencv2\imgproc\imgproc.hpp"
#include <iostream>
#include <Windows.h>

using namespace std;
using namespace cv;

void main()
{
	Mat source, destination;
	source = imread("Lena.png", CV_LOAD_IMAGE_COLOR);

	int n;
	int dilation_size;

	cout << "input N : ";
	cin >> n;

	dilation_size = 3;
	Mat element = getStructuringElement(MORPH_RECT, Size(2 * dilation_size + 1, 2 * dilation_size + 1), Point(dilation_size, dilation_size));

	for (int i = 0; i < n; i++) {
	
		dilate(source, source, element);
		namedWindow("Result window", CV_WINDOW_AUTOSIZE);
		imshow("Result window", source);
	}

	waitKey(0);
	destroyWindow("Display window");
	destroyWindow("Result window");
}
Editor is loading...