AI

CH-4 – Slope Feature Extraction – Part-6

Important Note: This article is part of the series in which TechReport.us discuss theory of Video Stream Matching.

In that section three Algos are discuss.

  • Slope Magnitude
  • Slope Direction
  • Slope Signs

4.4.3.1 Algorithm 5

Input:

BMP Image

Output:

Array Of Numerical values define the Slope Magnitude property.

Working:

It takes an Image and converts it into gray scale if it is not already in gray scale. For slope magnitude it checks the per pixel maximum change with its neighbor’s pixels.

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 Padding to make it into power of two (im)

Step 4 : (I , J) = Size (im1)

Step 5 : Loop1: for I =rows of (Im1) //calculate 8-N

Step 6 : Loop2: for J = columns of (Im1)

Step 7 : Calculate 8-N for each Im(I,J)

Store the maximum Value of 8-N in Mag(I,J)

Step 8 : end Loop1

Step 9 : end Loop2

Step 10 : Return (Mag)

Step 11 : Stop

4.4.3.2 Algorithm 6

Input:

BMP Image

Output:

Array Of Numerical values define the Slope Direction property.

Working:

It takes an Image and converts it into gray scale if it is not already in gray scale. For slope Direction it checks the per pixel maximum change with its neighbor’s pixels.

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 Padding to make it into power of two (im)

Step 4 : (I , J) = Size (im1)

Step 5 : Loop1: for I =rows of (Im1) //calculate 8-N

Step 6 : Loop2: for J = columns of (Im1)

Step 7 : Calculate 8-N for each Im(I,J) (s)

if s > 0

sd(i,j)=k;

elseif s < 0

sd(i,j)=k+8;

else

sd(i,j)=16;

endif

Step 8 : end Loop1

Step 9 : end Loop2

Step 10 : Return (sd)

Step 11 : Stop

4.4.3.3 Algorithm 7

Input:

BMP Image

Output:

Array Of Numerical values define the Slope Signs property.

Working:

It takes an Image and converts it into gray scale if it is not already in gray scale. For slope Signs it checks the per pixel change with its neighbor’s pixels.

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 Padding to make it into power of two (im)

Step 4 : (I , J) = Size (im1)

Step 5 : Loop1: for I =rows of (Im1) //calculate 8-N

Step 6 : Loop2: for J = columns of (Im1)

Step 7 : Calculate 8-N for each Im(I,J),

Step 8 : (s) = all 8 are (ii,jj)

if s > 0

sxalgo(i,j)=1;

elseif s < 0

sxalgo(i,j)=-1;

else

sxalgo(i,j)=0;

end

Step 9 : end Loop1

Step 10 : end Loop2

Step 11: wh=1; wn=0,wp=0,wz=0;//counter for arrays

Step 12 : Loop1: for I =1:16:rows of (Im1) //make tiles

Step 13: wh=wh+1; wn=0,wp=0,wz=0;

Step 14 : Loop2: for J =1:16: columns of (Im1)

if sxalgo(g,k)>0

pc=pc+1;

elseif sxalgo(g,k)<0

nc=nc+1;

else

zc=zc+1;

end

Step 15 :

wpmat(wh,wp)=pc; // arrange values in array

wnmat(wh,wn)=nc;

wzmat(wh,wn)=zc;

Step 16: wn=wn+1,wp=wp+1,wz=wz+1;

Step 17 : end Loop1

Step 18 : end Loop2

Step 19 : slopes = [wpmat(:) , wnmat(:) , wzmat(:)] ;

Step 20 : Return (slopes)

Step 21 : Stop

Ali Imran
Over the past 20+ years, I have been working as a software engineer, architect, and programmer, creating, designing, and programming various applications. My main focus has always been to achieve business goals and transform business ideas into digital reality. I have successfully solved numerous business problems and increased productivity for small businesses as well as enterprise corporations through the solutions that I created. My strong technical background and ability to work effectively in team environments make me a valuable asset to any organization.
https://ITsAli.com

Leave a Reply