-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy patherosion_dilation.cpp
More file actions
38 lines (34 loc) · 1.63 KB
/
erosion_dilation.cpp
File metadata and controls
38 lines (34 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
//#####################################################################################//
//#####################################################################################//
//#####################################################################################//
//# Please include the Github Repositories web URL if you are using this material. #//
//#####################################################################################//
//#####################################################################################//
//#####################################################################################//
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <vector>
#include "opencv2/opencv.hpp"
#include "opencv2/cudaarithm.hpp"
#include "opencv2/cudafilters.hpp"
#include "opencv2/cudaimgproc.hpp"
#include "opencv2/cudawarping.hpp"
#include "opencv2/imgproc/imgproc.hpp"
#include "opencv2/highgui/highgui.hpp"
#include "all_header.h"
using namespace std;
using namespace cv;
void LANEDETECTION::erode_dilate(cuda::GpuMat& src, cuda::GpuMat& dst)
{
cuda::GpuMat erode_out, dilate_out;
int noise = 3;
int dilate_const = 1;
Mat element_erosion = getStructuringElement(MORPH_RECT, Size(noise * 2 + 1, noise * 2 + 1));
Ptr<cuda::Filter> erode = cuda::createMorphologyFilter(cv::MORPH_ERODE, src.type(), element_erosion);
erode->apply(src, erode_out);
Mat element_dilation = getStructuringElement(MORPH_RECT, Size(dilate_const * 2 + 1, dilate_const * 2 + 1));
Ptr<cuda::Filter> dilateFilter = cuda::createMorphologyFilter(MORPH_DILATE, src.type(), element_dilation);
dilateFilter->apply(erode_out, dst);
}