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
-
Zymeworks Announces FDA Clearance of Investigational New Drug Application for ZW171, a novel 2+1 T-cVANCOUVER, British Columbia, June 17, 2024 (GLOBE NEWSWIRE) -- Zymeworks Inc. (Nasdaq: ZYME), a clinical-stage biotechnology company developing a di2024-06-17
-
Indonesia Stock Exchange Partners with Nasdaq to Upgrade Market InfrastructureTechnology partnership will further enhance overall resilience and integrity of the exchange, while supporting the rapid deployment of new products2024-06-17
-
Adalvo 的 Liraglutide 預充式注射筆成為歐盟首款獲得批准的仿製藥馬爾他聖瓜安, June 17, 2024 (GLOBE NEWSWIRE) -- Adalvo 宣布 Liraglutide 預充式注射筆成功取得 DCP 批准,成為歐盟首款獲得批准的仿製藥。 根據 IQVIA 的報2024-06-17
-
促进生育,助力三胎——“三胎免费生”联合公益行动正式启动为积极响应国家号召实施三胎生育政策,扩大妇幼服务健康供给,在云南省优生优育妇幼保健协会指导下,昆明广播电视台联合昆明安琪儿妇产医院,于6月13日在昆明广播2024-06-17
-
学党史传承红色精神 守党纪筑牢自律防线——平安养老险湖南分公司党支部开展主题党日活动七一前夕,平安养老险湖南分公司党支部全体成员走进“千年学府、百年师范”——湖南第一师范,开展了一次学史明理、学史增信、学史崇德、学史力行的主题党日活动。重2024-06-17