COMP37212-python跟opencv代写
时间:2024-02-19
Coursework 1:
Convolution & Kernels
COMP37212
Compute the effect of convolving an image with the average and the weighted average
smoothing kernels. For your experiments, please use kitty.bmp that can be found on BB.
1. Write a short function that performs the convolution between an
image, and a 3 × 3 structuring element, by performing an explicit
looping over the image pixels. You should pad the edges of the input
image with zeros to deal with the edges and corners of the original
image.
Load the image kitty.bmp, and compute the effect for this convolution.
2. By convolving the original image (kitty.bmp) with the appropriate
kernels, compute the horizontal and vertical gradient images, and then
find the edge strength image given by the gradient magnitude
(combined image).
3. Perform thresholding of the edge strength image, and hence display the
major edges of the image. You may find it useful to plot the image
histogram for the edge-strength image. Can you find a threshold value
that gives the edges of the cat, but not the patterns in the fur, or the
wood-grain?
4. Repeat the above steps, but now starting from the weighted mean of the
original image. Compare the edge-strength images. What difference
has the weighted-mean smoothing made to the edges detected?
5. Write a report that describes your results and conclusions. Remember to
include some of the images of your results and also a listing of your code for
your own implemented functions.
Please note:
You are expected to write your own code for the
convolution and thresholding functions.
Python/OpenCV code snippets are provided on
Blackboard, however, use them as a reference to
help/guide you with your own implementation.
Use Python3/OpenCV 4.2.0 for your implementation
essay、essay代写