Search code examples
imageimage-processingopencvedge-detection

Opencv Edge extraction


I have an image and I want to create an edge histogram. I divide the image into 1100 image-blocks and try to find edge and its direction (horisontal, vertical, 45° diagonal, 135° diagonal or nondirectional) in each block.

How can I extract that information about edges? Do you have any ideas?

Regards!


Solution

  • I found the answer in this paper: Efficient Use of MPEG-7 Edge Histogram Descriptor by Won.

    My goal was to find following edges:

    Edge types

    Won divide each Image Block into 4 parts, calculate the average gray level in each of them and use the following coefficients:

    coeffs

    We use this coefficients as follows and get 5 values:

    indicators

    Using thresholding we estimate each type of the edge:

    program SetEdgeType(max, m_nd, m_h, m_v, m_d_45, m_d_135)
    {
    if (max < TEdge) then EdgeHisto(0)++
    else
    {
     if (m_nd > T0)    then EdgeHisto(1)++
     if (m_h > T1)     then EdgeHisto(2)++
     if (m_v > T1)     then EdgeHisto(3)++
     if (m_d_45 > T2)  then EdgeHisto(4)++
     if (m_d_135 > T2) then EdgeHisto(5)++
    }
    endif
    return(EdgeHisto)
    }
    

    Threshold values were selected by Savvas A. Chatzichristofis to be: TEdge=14, T0=0.68, T1=T2=0.98.