New Post

Python Code || Path Planning with Grey Wolf Optimization (GWO) ~xRay Pixy

Image
Learn how to implement an obstacle-avoiding path planning for a robot using the Grey Wolf Optimization (GWO) in a static environment. #optimization #algorithm #metaheuristic #robotics #deeplearning #ArtificialIntelligence #MachineLearning #computervision #research #projects #thesis #Python

Local Directional Pattern (LDP)

 Local Directional Pattern


How to Calculate Local Directional Pattern (LDP) Code? With Example |Kirsch Compass Mask| ~xRay Pixy

Click here - > WATCH NOW

What are Local Directional Patterns?

LDP = Local Directional Pattern. Local Directional Pattern is a descriptor i.e., used for Face Recognition. 

What is Descriptor? 

Descriptors rely on Gradient-based or intensity variation approaches detect Local Features (e.g.,  Edges, Blobs and Regions).  BLOB = Binary Large Object (i.e., the region of the image). Descriptors such as HOG, SIFT, SURF (rely on local gradient computation).  Binary Descriptors such as BRISK, ORB or FREAK (rely on local intensity differences). Local Directional Pattern (LDP) Assign code for each pixel in the image. Local Directional Pattern (LDP) encoded image is divided into regions.

How LDP Calculate? 

For Each pixel in the image LDP computes an 8-bit binary code. 8-bit binary pattern is calculated by involving the local regions of the image of size 3x3 with Krisch Mask in 8 Directions. Local Directional Pattern (LDP) Local Region’s Values: 


What is Kirsch Compass Mask? 

Local Directional Pattern (LDP) is Based on the known KIRSCH MASK. Kirsch Mask is non-linear Edge Detector. Using Kirsch mask we can find Edges in the following 8 direction: North, North West, West, South West, South, South East, East, North East.

How to Calculate Local Directional Pattern Value?


Calculation of Eight Directional Responses.

Calculate East Direction Mask i.e., 𝑚_0

 E (East)

E = [ (5 * 30) + (5 * 25) + (5 * 10) + (-3 * 50) + (-3 * 40) + (-3 * 45) + (-3 * 55) + (-3 * 15) + (0 * 60) ]

E = [ 150 + 125 + 50 – 150 – 120 – 135 – 165  – 45 – 0 ] 

E = [– 290 ]

Calculate North Direction Mask i.e., 𝑚_2

 N (North)

N = [ (5 * 55) + (5 * 15) + (5 * 30) + (-3 * 25) + (-3 * 10) + (-3 * 50) + (-3 * 40) + (-3 * 45) + (0 * 60) ]

N = [275 + 75 + 150 – 75 – 30 – 150 – 120 – 135 – 0  ] 

N = [– 10]

 Calculate South Direction Mask i.e., 𝑚_6

 S (South)

S = [ (5 * 10) + (5 * 50) + (5 * 40) + (-3 * 45) + (-3 * 55) + (-3 * 15) + (-3 * 30) + (-3 * 25) + (0 * 60) ]

S = [50 + 250 + 200 – 135 – 165 – 45 – 90 – 75 – 0  ] 

S = [– 10]

 Calculate West Direction Mask i.e., 𝑚_4

 W (West)

W = [ (5 * 55) + (5 * 45) + (5 * 40) + (-3 * 50) + (-3 * 10) + (-3 * 25) + (-3 * 30) + (-3 * 15) + (0 * 60) ]

W = [275 + 225 + 200 – 150 – 30 – 75 – 90 – 45 – 0  ] 

W = [ 310]


Rank Calculated Values in Ascending Order [Ranking of Directional Response]

(MSB, also called the high-order bit). the high-order bit or left-most bit


LDP is formed Considering only first 3 values of sorted Edge Response in descending order (i.e., largest to smallest).

LDP code for K = 3 is computed as:

𝑚_5 = 270   (3rd most significant directional response).

Calculate LDP Code of the pixel (x , y) : 

〖 𝑳𝑫𝑷〗_(𝒙,𝒚)  (𝒎_𝟎…𝒎_𝟕 )= ∑_𝟎^𝟕▒〖𝒔 (𝒎_𝒊−𝒎_𝟓 )∗𝟐^𝒊 〗

 Calculate LDP Binary Code of the pixel (x , y) 

〖 𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 )= ∑_0^7▒〖𝑠 (𝑚_𝑖−𝑚_5 )∗2^𝑖 〗

For i =  0, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_0−𝑚_5 )∗2^0 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−290−270)∗1〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−560) 〗 *  1

− 560 < 0

 0 * 1

 0

For i = 1, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_1−𝑚_5 )∗2^1 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−250−270)∗2〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−520) 〗 * 2

− 520 < 0

 0 * 2

 0

For i = 2, 

〖 𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_2−𝑚_5 )∗2^2 〗

〖 𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−10−270)∗4〗

〖 𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−280) 〗 * 4

− 280 < 0

 0 * 4

0

For i = 3, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_3−𝑚_5 )∗2^3 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (110−270)∗8〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−160) 〗 * 8

  - 160 < 0 

  0 * 8

0

For i = 4, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_4−𝑚_5 )∗2^4 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (310−270)∗16〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (40) 〗 * 16

 40 ≥0 

 1 * 16

16

For i = 5, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_5−𝑚_5 )∗2^5 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (270−270)∗32〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (0) 〗 * 32

 0 ≥0 

 1 * 32

32

For i = 6, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_6−𝑚_5 )∗2^6 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−10−270)∗64〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−280) 〗 * 64

 -280 <0 

 0 * 64

 0

For i = 7, 

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (𝑚_7−𝑚_5 )∗2^7 〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−130−270)∗128〗

〖𝐿𝐷𝑃〗_(𝑥,𝑦)  (𝑚_0…𝑚_7 ) = ∑_0^7▒〖𝑠 (−400) 〗

 -400<0 

  0 * 128

 0

Calculated LDP Code = 0 * 𝟐^𝟎+"0 ∗ " 𝟐^𝟏+"0 ∗ " 𝟐^𝟐+"0 ∗ " 𝟐^𝟑+"1 ∗ " 𝟐^𝟒+"1 ∗ " 𝟐^𝟓 " +0 ∗ " 𝟐^𝟔+"0 ∗ " 𝟐^𝟕

〖 𝑳𝑫𝑷〗_(𝒙,𝒚)  (𝒎_𝟎…𝒎_𝟕 ) = (0 * 1) + (0 * 2) +  (0 * 4) + (0 * 8) + (1 * 16) + (1 * 32) + (0 * 64) + (0 * 128)

〖 𝑳𝑫𝑷〗_(𝒙,𝒚)  (𝒎_𝟎…𝒎_𝟕 ) =  16 + 32 = 48

LDP CODE = 48

Local Directional Pattern Video for more Details 

How to Calculate Local Directional Pattern (LDP) Code? With Example |Kirsch Compass Mask| ~xRay Pixy

Click here - > WATCH NOW


Comments

Popular Post

PARTICLE SWARM OPTIMIZATION ALGORITHM NUMERICAL EXAMPLE

Cuckoo Search Algorithm for Optimization Problems

Particle Swarm Optimization (PSO)

PSO (Particle Swarm Optimization) Example Step-by-Step

how is the LBP |Local Binary Pattern| values calculated? Step-by-Step with Example

PSO Python Code || Particle Swarm Optimization in Python || ~xRay Pixy

Bat algorithm Explanation Step by Step with example

Grey Wolf Optimization Algorithm

Grey Wolf Optimization Algorithm Numerical Example

Whale Optimization Algorithm Code Implementation || WOA CODE || ~xRay Pixy