CS4186

计算机代考 In this work, LBP and HOG are used as the feature descriptors to retrieve images. Color and texture are two important features…

Introduction 计算机代考

In this work, LBP and HOG are used as the feature descriptors to retrieve images. Color and texture are two important features in image retrieval. LBP has a great advantage in extracting the texture of images because of its computational simplicity and robustness. It is also rotation invariant when it is used in uniform mode. The HOG feature is very useful in detecting the edge and corner features, where the histogram of direction of gradients calculated. The disadvantage of HOG descriptors is that it is not rotation invariant. Euclidean distance is used to measure the similarity of the two histogram.

 

Methods

2.1 LBP 计算机代考

Local Binary Pattern (LBP) is a simple texture descriptor which labels the pixels of an image by comparing the current pixel with the neighborhoods and considers the result as a binary number. The binary number can be converted into a decimal.

LBP are widely used in computer vision tasks, such as face recognition.

In this assignment, we choose the parameters P = 8 and R=1. Where, R is the radius of the circle and P is the number of surrounding points. That means the cells where the black points located are selected to compare with the center points, which is shown in Figure (1).

计算机代考
计算机代考

The implementing method is shown as follows:

Step1. Convert the input image into gray. In this assignment, we calculate the LBPH with only gray channel. But it is also possible to use three R,G,B channels to get three histograms and then concatenate them.

Step2. Compare the center pixel with each neighbour which is marked black in Figure(1)-(b). If the value of neighbour pixel is greater than the center pixel, then we get a 1, otherwise we get a 0. Then we get a binary sequence.

Step3. We convert this binary sequence into a decimal and assigned this value  to the center pixel. Then we get a LBP map.

Step4. We calculate the histogram of LBP map.

In this assignment, LBP is implemented by myself.

 

2.2 HOG  计算机代考

Histogram of gradient(HOG) is widely used in computer vision for tasks detection and classification.

HOG decomposes one image into small cells, computes an histogram of oriented gradients in each cell. normalizes the result using a block-wise pattern, and return a descriptor for each cell.

Step 1: Preprocess the Input Image.

The input image should be re-sized into 128 x 64. Because euclidean distance between the histograms of the two images is computed. Therefore the histogram should have the same dimension. Based on the implementation process, the input image should have the same shape.

Step 2: Calculate the Gradients in both x direction and y direction.  计算机代考

The gradient of each pixel in the image is calculated in x and y directions in this step. The gradients can be easily solved by edge detectors such as Sobel Filter or Laplacian Filter. The two gradients are used to detect the edges in horizontal and vertical direction separately. After obtaining Gx and Gy, the magnitude and direction of gradient can be easily calculated using the following formula:

Step 3: Calculate Histogram of Gradients.

In this step, the histogram is calculated in each small 8×8 cell. Based on the gradient magnitude and direction of the gradient map we calculated in last step. A 9 bins histogram is obtained in each cell with the angle ranging from 0 to 180.

 

Step 4: Block Normalization  计算机代考

In order to eliminate the effect of lighting variations, each histogram is normalized used block normalization method.

 

Step 5:  Calculate the HOG feature vector.

In the final step, the histograms in each cell are concatenated.

 

In this assignment, Sklearn library is used to get the HOG features.

 

2.3 Combine HOG and LBP  计算机代考

Because HOG and LBPH are both one dimensional array. So we can simply concatenate them and get a new histogram. The experiments show that this can improve the retrieval performance.

Results

The MAP results for HOG is shown as follows:

Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 Q10 avg
0.4204 0.1338 0.0677 0.1757 0.6770 0.0383 0.0031 0.0215 0.1702 0.0044 0.1711

 

The top 10 result is shown as follows:  计算机代考

计算机代考
计算机代考

 
QQ在线咨询
售前咨询热线
QQ:3554475127
售后咨询热线
QQ:3042439236