Sie sind auf Seite 1von 6

Kadir Cumali

2013717018

EE 576 PROJECT 2
1) a) Mean filter
The mean filter is a simple spatial and linear filter that replaces the center value in the
window with the average (mean) of all the pixel values in the window. The result is to reduce noise in
the image, but also to blur the edges (high frequency image detail) of the yacht. The bigger the
window the greater the noise reduction and blurring.
Syntax: boxFilter(input image, output image, int ddepth, size(9,9), Point anchor=Point(-1,-1),
bool normalize=true, BORDER_DEFAULT)

Figure 1: Object images with 9x9 moving average

1)

Figure 2: Scene images with 9x9 moving average


b) Gaussian Filter
Applying the Gaussian filter has the effect of smoothing the image. The degree of

smoothing is controlled by the choice of the standard deviation parameter sigma, not by the value of
the kernel size as in mean filter. The high spatial frequency content (sharp adges) of an image is
supressed in this filter so it can be called low-pass filter.
Syntax: GaussianBlur (Input image, Output image, Size (9,9) , double sigmaX, double
sigmaY=0,BORDER_DEFAULT)

Figure 3: Object images with Gaussian filtered (sigmaX=0,sigmaY=0, size(9,9))

Figure 4: Scene images with Gaussian filtered (sigmaX=4,sigmaY=0, size(9,9))


2) Sobel Edge Detection
The Sobel operator is a method of detecting edges. It is implemented using two masks
which are convolved with the original image to calculate approximations of the derivatives - one for
horizontal changes (x), and one for vertical (y). The magnitude |G| of the image gradient is thus given
by:
= 2 + 2

Syntax: Sobel (Input image, Output Image, int ddepth, int dx, int dy, int ksize=3, double
scale=1, double delta=0, BORDER_DEFAULT )
In figure 5, we can see the original image and its edges. Before implementing Sobel operator,
we will use Gaussian filter due to noise in the original image. Such noise might otherwise elicit a large
response from the edge detector and dominate true edges in the image.

Figure 5: Edges on object image with Gaussian filter (3x3)

Figure 6: Edges on scene image with no filter and Gaussian filter (9x9)
The figure 6 shows edges in the scene images. In the left part, there is no Gaussian filter.
However, we know that derivative operators are sensitive to noise. When we use Gaussian before
detection, it is more effective to find true edges.

3) Morphological operators
In morphological operations, there are three concepts. Two of them are the image and
the type of morphological operation we are carrying out. The third factor is called the structuring
element and is a key element in any morphological operation. The structuring element is the entity
which determines exactly which image pixels surrounding the given foregound or background pixel
must be considered in order to make the decision to change its value or not. Structuring elements
have a designated centre pixel. In this project, structuring element is taken a rectangular of 5x5,
where all SEi,j = 1. (SE: Structuring element )
Syntax: morphologyEx(Input image, Output image, MORPH_GRADIENT, element,
Point(-1,-1), iteration );

Figure 7: Edges detected with morphological gradient


The edges detected after morphological gradient are shown above. The operator works
by replacing a given pixel by the minumum or maximum in the neighbourhood defined by the
structuring element. This will little or no change in smooth regions of the image. However, when the
structuring element spans an edge, the response will be the difference between the maximum and
minimum-valued pixels in the defined region and, hence, large. Depending on the structuring
element, we will infer from the comparison with Sobel operator that redundant edges are less in
morphological processing.
4) Boundaries: Contour
If we find a contour in a binary image, we will find the boundaries of objects in an image.
For better accuracy, we might use binary images. So before finding contours, we are recommended
to apply threshold. In this algorithm, the images are converted into gray scale images. Then, we will
choose a threshold value that implies larger pixel values are assigned to 1, others to 0.
Syntax: findContours (Input/Output image, OutputArrayOfArrays contours, OutputArray
hierarchy, int mode, int method, Point offset=Point(0,0))

Figure 8: Edges with contour function


The edges depend on the threshold value before finding contours. If the threshold value
is larger than average of the pixel values, the contour image is, edges, seen clearer. If the threshold
value is smaller than average of the pixel values, many redundant edges might occur. Visually, we can
say that Sobel operator and morphological operator are more effective to find true boundaries with
some extra implementations such as filtering.

Das könnte Ihnen auch gefallen