Important Note: This article is part of the series in which TechReport.us discuss theory of Video Stream Matching.
Basically Algo is one but here using its two possible approaches.
- Edge Map
- Edge Angles
4.4.2.1 Algorithm 3
Input:
BMP Image
Output:
Array Of Numerical values define the Edge Map.
Working:
It takes an Image and converts it into gray scale if it is not already in gray scale. Then apply Canny Algorithm 6 Steps define in chapter 2 and return the image edges.
Step 0 : Start
Step 1 : Takes input an Image (im).
Step 2 : If (im) in gray scale
If not
then
convert (im) into gray scale.
Step 3 : (im1) = Apply Gaussian to remove noise (im)
Step 4 : (im2) = Apply Sobel operator in Horizontal direction (im1)
Step 5 : (im3) = Apply Sobel operator in Vertical direction (im1)
Step 6 : AddIm = Im2 + Im3
Step 7 : Loop1: for I =rows of (AddIm) //calculate 4 angles according to define
Step 8 : Loop2: for J = columns of (AddIm)
Step 9 : Calculate angle for each AddIm(I,J)
Store in AngelMat(I,J)
Step 10 : end Loop1
Step 11 : end Loop2
Step 12 : t1 = Threshold(AddIm)
Step 13 : t1= t1 + t1* 0.5 // for non maxima suppression
Step 14 : Loop1 : for i=rows of AddIm
Step 15 : Loop2 : for j=columns of AddIm
If AddIm( i,j) >t1 and AngleMat(i,j) is according to rules
Set AddIm( i,j) =1
else
Set AddIm( i,j) =0
Step 16: end Loop2
Step 17: end Loop1
Step 18 : t1 = Threshold(AddIm)
Step 19 : t2 = t1 + t1* 0.5 // for Double Threshold
Step 20 : Loop1 : for i=rows of AddIm
Step 21 : Loop2 : for j=columns of AddIm
If AddIm( i,j) >t1
Set AddIm( i,j) =1
else
Set AddIm( i,j) =0
Step 22 : Cheak 8-N of ( i,j)
If AddIm( i,j) Neighbours > t2
then
Set to 1
Else
Set to 0
Step 23: end Loop2
Step 24: end Loop1
Step 25 : Return (AddIm)
Step 26 : Stop
4.4.2.2 Algorithm 4
Input:
BMP Image
Output:
Array Of Numerical values define the Edge Angles.
Working:
It takes an Image and converts it into gray scale if it is not already in gray scale. Then apply Canny Algorithm 6 Steps define in chapter 2 and return the image angles.
Step 0 : Start
Step 1 : Takes input an Image (im).
Step 2 : If (im) in gray scale
If not
then
convert (im) into gray scale.
Step 3 : (im1) = Apply Gaussian to remove noise (im)
Step 4 : (im2) = Apply Sobel operator in Horizontal direction (im1)
Step 5 : (im3) = Apply Sobel operator in Vertical direction (im1)
Step 6 : AddIm = Im2 + Im3
Step 7 : Loop1: for I =rows of (AddIm) //calculate 4 angles according to define
Step 8 : Loop2: for J = columns of (AddIm)
Step 9 : Calculate angle for each AddIm(I,J)
Store in AngelMat(I,J)
Step 10 : end Loop1
Step 11 : end Loop2
Step 12 : Row =1 , Col =1
Step 13 : Loop1 : for i=rows of AddIm // make tiles of image
Step 14 : Col = Col + 1 , Row = 1 ;
Step 15 : Loop2 : for j=columns of AddIm
Calculate number of times each angle occuers in each tile
And store it in ResAng(Row,Col)
Row = Row + 1
Step 16: end Loop2
Step 17: end Loop1
Step 18 : Return (ResAng)
Step 19 : Stop