# Algorithm代做 – Contour Detection – Solution Template

### Contour Detection – Solution Template

Algorithm代做 – 这是一个Algorithm面向对象设计的practice, 考察Algorithm的理解, 是比较有代表性的Algorithm等代写方向

1. Method Description.
``````1) Warm-up. At the beginning I used signal.convolve2d to produced edge
but however there are artifacts at image boundaries. At this time we
can use boundary='symm' parameter to minimize these artifacts.
2) Smoothing. I am using [1, 0, 1] filters for computing the gradients.
Using derivative of Gaussian (DoG) filters can help to obtain more
3) Non-maximum Suppression. The pipeline will produce boundaries
but we need to make the boundaries thiner. So we need to implement
non-maximum suppression. Non maximum suppression works by
finding the pixel with the maximum value in an edge. In the above
image, it occurs when pixel q has an intensity that is larger than both p
and r where pixels p and r are the pixels in the gradient direction of q. If
this condition is true, then we keep the pixel, otherwise we set the pixel
to zero (make it a black pixel).
``````
1. Precision Recall Plot.
``````Initial implementation Warm-up
``````
``````Smoothing Non-maximum Suppression
``````

(^)

1. Results Table.
``````Method
``````
``````overall
max F-
score
``````
``````average
max F-
score
``````

#### AP

``````Runtime
(seconds)
``````
``````Initial
implementation
``````

#### 0.533941 0.563872 0.491551 0.

``````Warm-up
[remove
boundary
artifacts]
``````

#### 0.535755 0.567632 0.494960 0.

``````Smoothing 0.539705 0.571330 0.503640 0.
``````
``````Non-maximum
Suppression
``````

#### 0.539164 0.567672 0.510573 0.

``````Val set numbers
of best model
[From
``````

#### 0.537397 0.566219 0.506208 0.

4. Visualizations.

It can be seen from the above figure that there are many noisy edges in the image, and when non-maximum suppression is not performed, the extracted edges are thicker. However, the Algorithm finally successfully simplified the rough boundary and successfully extracted the accurate boundary. Compared with Ground Truth, the average precision of the algorithm is very high, reaching 0.51057. I found that using interpolation to give nicer results at the cost of a longer run time. But I didn’t do it to save time.

5. Bells and Whistles.

I improved the performance by using multiple filters for computing the gradients. In the first "Bells and whistle", I was adding a [[1, 1, 1, 1, 0, 1, 1, 1, 1]] filter. The second one I added a filter like this [[1, 1, 1, 0, 0, 0, 1, 1, 1]], the third filter is [[1, 1, 0, 0, 0, 0, 0, 1, 1]]. So finally I successfully to improve the performance and the best AP can reach 0.543486 and it is more than expected.

``````Method
``````
``````overall
max F-
score
``````
``````average
max F-
score
``````

#### AP

``````Runtime
(seconds)
``````
``````Best base
Implementation
(from above)
``````

#### 0.539164 0.567672 0.510573 0.

``````Bells and
whistle (1)
[extra credit])
``````

#### 0.560510 0.586217 0.529332 0.

``````Bells and
whistle (2)
[extra credit])
``````

#### 0.555692 0.583597 0.529619 0.

``````Bells and
whistle (n)
[extra credit])
``````

### Corner Detection – Solution Template

NOTE: All values and figures in this template are examples that you will need to replace with your own results

1. Method Description.
``````1) Convert the original image into a grayscale image I. The pixel values of
I are computed as a weighted sum of the corresponding R, G, B
values.
2) Compute the derivatives dx and dy by convolving the image I
3) Compute the products of the derivatives dx dx , dx dy, dy dy.
4) Convolve the images dx dx , dx dy, dy dy with a Gaussian filter or a
mean filter. Define the structure tensor for each pixel as expressed
dx*dy - dxdy**2 - 0.06*(dx+ dy)**2.
5) Compute the response function for each pixel.
``````
1. Precision Recall Plot.
``````Harris w/o NMS Harris w/ NMS
``````
``````Hyper-parameters tried (1) Hyper-parameters tried (2)
``````
1. Results Table.
``````Method
Average
Precision
Runtime
``````
``````Harris w/o NMS 0.302957 0.
``````
``````Harris w/ NMS 0.502196 0.
``````
``````Hyper-parameters tried (1) 0.499337 0.
``````
``````Hyper-parameters tried (2) 0.505155 0.
``````
``````Val set numbers of best model [From
``````

#### 0.502196 0.

4. Visualizations.

As can be seen from the figure aboves, the corner detection algorithm can extract most of the corners well. But there are still false positives. This is because the checkerboard is quite different from the background, and the gradient calculated at this position is similar to the characteristics of the corner point, so it is misjudged as a corner point.

### Multi-resolution Blending – Solution

NOTE: All values and figures in this template are examples that you will need to replace with your own results

1. Method Description.
``````1) Construct Laplacian pyramids for the two images.
2) Make a third Laplacian pyramid that is constructed by a mask-based
joining of the two original-image Laplacian pyramids at every pyramid
level.
3) Reconstruct the output image from the blended Laplacian pyramid.
``````
1. Oraple.
``````Level = 1 Level = 2
``````
``````Level = 3 Level = 4
``````
``````Level = 5 Level = 6
``````
``````Im1.png
``````Im 2 .png