Concepts in Image Processing

Image Moment

M p q = d e f ∑ x ∑ y x p y q I ( x , y ) M_{pq}\xlongequal{def}\sum_x \sum_y x^p y^q I(x, y) Mpqdef xyxpyqI(x,y)
so the centroid of image is
( x , y ) = ( M 10 M 00 , M 01 M 00 ) (x,y) = \left( \frac{M_{10}}{M_{00}},\frac{M_{01}}{M_{00}} \right) (x,y)=(M00M10,M00M01)
compute moments in python:

M = cv2.moments(c)

reference: Image moment

Canny Edge Detection

a multi-stage algorithm

  1. Noise Reduction
    • Gaussian Filter
  2. Finding Intensity Gradient of the Image
    1. filter with Sobel Kernel in both horizontal and vertical direction to get first derivative in horizontal direction G x G_x Gx and vetical direcition G y G_y Gy
    2. G = G x 2 + G y 2 θ = arctan ⁡ ( G y G x ) G=\sqrt{G_x^2 + G_y^2} \\ \theta = \arctan \left(\dfrac{G_y}{G_x}\right) G=Gx2+Gy2 θ=arctan(GxGy)
  3. Non-maximum Suppression
  4. Hysteresis Thresholding
    • what is it: Standard and Hysteresis Thresholding
    • We need two threshold values, minVal and maxVal. Any edges with intensity gradient more than maxVal are sure to be edges and those below minVal are sure to be non-edges, so discarded. Those who lie between these two thresholds are classified edges or non-edges based on their connectivity. If they are connected to “sure-edge” pixels, they are considered to be part of edges. Otherwise, they are also discarded.

OpenCV

edges = cv2.Canny(image, 100, 200)

reference: Canny Edge Detection

猜你喜欢

转载自blog.csdn.net/w112348/article/details/113427542