首页 > 科技
DIP Programming Assignment 3
Edge detection using gradient operator
Edge detection is a problem of fundamental importance in image analysis. In typical images, edges characterize object boundaries and are therefore useful for segmentation, registration, and identification of objects in a scene.
In this exercise, you are required to develop an edge detection algorithm using gradient operator:
The formula above uses four-neighbor pixels to calculate the gradient of the central pixel. An important consideration in implementing this operation is the issue of what happens when the central pixel approaches the border of the input image, as one or more four-neighbors of the central pixel may be out of the image area. We suggest that you can skip the gradient operation on the border of the input image. For an image which has M*N resolution, you can implement the gradient operator from the 2nd to (M-1)th row, and from the 2nd to (N-1)th column.
If you use IMSHOW to show the processed image Y directly, most of its detail cannot be displayed clearly because of its low dynamic range. You can use the following command to get its negative image and extend to the full dynamic range before you use IMSHOW to display it.
Y = im2uint8(mat2gray(Y));
Y = 255-double(Y);
Y = im2uint8(mat2gray(Y));
In your submitted report, an input image, an output (processed) image and source code should be included.
Example:
Original Image Gradient Image Output Image
If you have finished jobs required above, you could try other edge detect operators or use different ways to handle those special pixels in which your edge detect operator could not get a whole input data for processing. You could also try the edge function with different parameters supported by Matable and compare your results with Matlab’s output. The following are some info form Matlab help for the Matlab function edge:
Some info for Matlab function edge:
>> help edge
EDGE Find edges in intensity image.
EDGE takes an intensity or a binary image I as its input, and returns a
binary image BW of the same size as I, with 1's where the function
finds edges in I and 0's elsewhere.
EDGE supports six different edge-finding methods:
The Sobel method finds edges using the Sobel approximation to the
derivative. It returns edges at those points where the gradient of
I is maximum.
The Roberts method finds edges using the Roberts approximation to
the derivative. It returns edges at those points where the gradient
of I is maximum.
…..
The parameters you can supply differ depending on the method you
specify. If you do not specify a method, EDGE uses the Sobel method.
Sobel Method
BW = EDGE(I,'sobel') specifies the Sobel method.
BW = EDGE(I,'sobel',THRESH) specifies the sensitivity threshold for
the Sobel method. EDGE ignores all edges that are not stronger than
THRESH. If you do not specify THRESH, or if THRESH is empty ([]),
EDGE chooses the value automatically.
BW = EDGE(I,'sobel',THRESH,DIRECTION) specifies directionality for the
Sobel method. DIRECTION is a string specifying whether to look for
'horizontal' or 'vertical' edges, or 'both' (the default).
[BW,thresh] = EDGE(I,'sobel',...) returns the threshold value.
Roberts Method
BW = EDGE(I,'roberts') specifies the Roberts method.
BW = EDGE(I,'roberts',THRESH) specifies the sensitivity threshold for
the Roberts method. EDGE ignores all edges that are not stronger than
THRESH. If you do not specify THRESH, or if THRESH is empty ([]),
EDGE chooses the value automatically.
[BW,thresh] = EDGE(I,'roberts',...) returns the threshold value.
Class Support
-------------
I can be of class uint8, uint16, or double. BW is of class uint8.
Example
-------
Find the edges of the rice.tif image using the Prewitt and Canny
methods:
I = imread('rice.tif');
BW1 = edge(I,'prewitt');
BW2 = edge(I,'canny');
imshow(BW1)
figure, imshow(BW2)
…
请加QQ:99515681 邮箱:99515681@qq.com WX:codinghelp
- 搜索
-
- 01-15东莞市威勤户外用品有限公司:一站式高品质户外用品服务专家
- 01-15AI+电气时代纷至沓来,下一代数据中心HVDC如何发展?
- 01-15助听器选购指南:为什么爱可声助听器更值得入手?
- 01-152024国民消费“科技赋能”创新案例:Shokz韶音助推运动耳机音质升级
- 01-14暗揭湖南省康宸新材料有限公司客户对于全屋定制的环保性也是相当认可
- 01-14解谜武汉葳蕤繁祉百货有限公司时尚十元店秘诀就是它专业为出众而生
- 01-13Terra平台震撼来袭,引领WEB3新时代!
- 01-13中网智媒人工智能生态基金增值4.7倍,上市突破百倍指日可待!
- 01-11东莞赛铠机械:高品质混炼设备,助力中国智造崛起
- 01-11东莞市威勤户外用品有限公司:一站式高品质户外用品服务专家
- 标签列表