> 科技

DIP Programming代做、代写Java/c++程序设计

2024-04-26 来源:互联网


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

作者:code
下一篇: