Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Comparing 2 LBPs

I am using code from bytefish.de to generate my LBPs. If I generate 2 LBPs and their corresponding histograms, what is the best way to compare them?

This is my code so far:

#include "lbp.hpp"
#include "histogram.hpp"

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;

int main()
{
    //template image
    Mat temp = imread("Template.jpg",1);
    //image to be compared to
    Mat match = imread("Match.jpg",1);

    Mat dst,dst2; // image after preprocessing
    Mat lbp,lbp2; // lbp image
    Mat hist,hist2;

    //Convert to gray
    cvtColor(temp, dst, 6);
    cvtColor(match, dst2, 6);
    //remove noise
    GaussianBlur(dst, dst, Size(5,5), 5, 3, BORDER_CONSTANT);
    GaussianBlur(dst2, dst2, Size(5,5), 5, 3, BORDER_CONSTANT);
    //gets the lbp
    lbp::ELBP(dst,lbp,1,8);
    lbp::ELBP(dst2,lbp2,1,8);

   // normalize(lbp2, lbp2, 0, 255, NORM_MINMAX, CV_8UC1);
    //normalize(lbp, lbp, 0, 255, NORM_MINMAX, CV_8UC1);

    //get histograms
    lbp::histogram(lbp,hist,255);
    lbp::histogram(lbp2,hist2,255);

    //comparing the 2 LBP histograms
    double compareHist = cv::norm(hist-hist2);

    cout<<compareHist<<endl;

    waitKey(0);
    return 0;
}

Basically it gives me a quantifiable number as to how similar these two images are. My question is, how do I improve this result? Whats a better way of acheiving a quantifiable number based on how similar 2 LBPs are?

Thanks.

Comparing 2 LBPs

I am using code from bytefish.de to generate my LBPs. If I generate 2 LBPs and their corresponding histograms, what is the best way to compare them?

This is my code so far:

#include "lbp.hpp"
#include "histogram.hpp"

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;

int main()
{
    //template image
    Mat temp = imread("Template.jpg",1);
    //image to be compared to
    Mat match = imread("Match.jpg",1);

    Mat dst,dst2; // image after preprocessing
    Mat lbp,lbp2; // lbp image
    Mat hist,hist2;

    //Convert to gray
    cvtColor(temp, dst, 6);
    cvtColor(match, dst2, 6);
    //remove noise
    GaussianBlur(dst, dst, Size(5,5), 5, 3, BORDER_CONSTANT);
    GaussianBlur(dst2, dst2, Size(5,5), 5, 3, BORDER_CONSTANT);
    //gets the lbp
    lbp::ELBP(dst,lbp,1,8);
    lbp::ELBP(dst2,lbp2,1,8);

   // normalize(lbp2, lbp2, 0, 255, NORM_MINMAX, CV_8UC1);
    //normalize(lbp, lbp, 0, 255, NORM_MINMAX, CV_8UC1);

    //get histograms
    lbp::histogram(lbp,hist,255);
    lbp::histogram(lbp2,hist2,255);

    //comparing the 2 LBP histograms
    double compareHist = cv::norm(hist-hist2);

    cout<<compareHist<<endl;

    waitKey(0);
    return 0;
}

Basically it gives me a quantifiable number as to how similar these two images are. My question is, how do I improve this result? Whats a better way of acheiving a quantifiable number based on how similar 2 LBPs are?

Thanks.

Comparing 2 LBPs

I am using code from bytefish.de to generate my LBPs. If I generate 2 LBPs and their corresponding histograms, what is the best way to compare them?

This is my code so far:

#include "lbp.hpp"
#include "histogram.hpp"

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;

int main()
{
    //template image
    Mat temp = imread("Template.jpg",1);
    //image to be compared to
    Mat match = imread("Match.jpg",1);

    Mat dst,dst2; // image after preprocessing
    Mat lbp,lbp2; // lbp image
    Mat hist,hist2;

    //Convert to gray
    cvtColor(temp, dst, 6);
    cvtColor(match, dst2, 6);
    //remove noise
    GaussianBlur(dst, dst, Size(5,5), 5, 3, BORDER_CONSTANT);
    GaussianBlur(dst2, dst2, Size(5,5), 5, 3, BORDER_CONSTANT);
    //gets the lbp
    lbp::ELBP(dst,lbp,1,8);
    lbp::ELBP(dst2,lbp2,1,8);

   // normalize(lbp2, lbp2, 0, 255, NORM_MINMAX, CV_8UC1);
    //normalize(lbp, lbp, 0, 255, NORM_MINMAX, CV_8UC1);

    //get histograms
    lbp::histogram(lbp,hist,255);
    lbp::histogram(lbp2,hist2,255);

    //comparing the 2 LBP histograms
    double compareHist = cv::norm(hist-hist2);

    cout<<compareHist<<endl;

    waitKey(0);
    return 0;
}

Basically it gives me a quantifiable number as to how similar these two images are. My question is, how do I improve this result? Whats a better way of acheiving a quantifiable number based on how similar 2 LBPs are?are? Or is the way I am doing it even right?

Thanks.

Comparing 2 LBPs

I am using code from bytefish.de to generate my LBPs. If I generate 2 LBPs and their corresponding histograms, what is the best way to compare them?

This is my code so far:

#include "lbp.hpp"
#include "histogram.hpp"

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;

int main()
{
    //template image
    Mat temp = imread("Template.jpg",1);
    //image to be compared to
    Mat match = imread("Match.jpg",1);

    Mat dst,dst2; // image after preprocessing
    Mat lbp,lbp2; // lbp image
    Mat hist,hist2;

    //Convert to gray
    cvtColor(temp, dst, 6);
    cvtColor(match, dst2, 6);
    //remove noise
    GaussianBlur(dst, dst, Size(5,5), 5, 3, BORDER_CONSTANT);
    GaussianBlur(dst2, dst2, Size(5,5), 5, 3, BORDER_CONSTANT);
    //gets the lbp
    lbp::ELBP(dst,lbp,1,8);
    lbp::ELBP(dst2,lbp2,1,8);

   // normalize(lbp2, lbp2, 0, 255, NORM_MINMAX, CV_8UC1);
    //normalize(lbp, lbp, 0, 255, NORM_MINMAX, CV_8UC1);

    //get histograms
    lbp::histogram(lbp,hist,255);
    lbp::histogram(lbp2,hist2,255);

    //comparing the 2 LBP histograms
    double compareHist = cv::norm(hist-hist2);

    cout<<compareHist<<endl;

    waitKey(0);
    return 0;
}

Basically it gives me a quantifiable number as to how similar these two images are. My question is, how do I improve this result? Whats a better way of acheiving a quantifiable number based on how similar 2 LBPs are? Or is the way I am doing it even right?

Thanks.

Comparing 2 LBPs

I am using code from bytefish.de to generate my LBPs. If I generate 2 LBPs and their corresponding histograms, what is the best way to compare them?

This is my code so far:

#include "lbp.hpp"
#include "histogram.hpp"

#include <opencv2/opencv.hpp>
#include "opencv2/highgui/highgui.hpp"
#include "opencv2/imgproc/imgproc.hpp"

using namespace cv;

int main()
{
    //template image
    Mat temp = imread("Template.jpg",1);
    //image to be compared to
    Mat match = imread("Match.jpg",1);

    Mat dst,dst2; // image after preprocessing
    Mat lbp,lbp2; // lbp image
    Mat hist,hist2;

    //Convert to gray
    cvtColor(temp, dst, 6);
    cvtColor(match, dst2, 6);
    //remove noise
    GaussianBlur(dst, dst, Size(5,5), 5, 3, BORDER_CONSTANT);
    GaussianBlur(dst2, dst2, Size(5,5), 5, 3, BORDER_CONSTANT);
    //gets the lbp
    lbp::ELBP(dst,lbp,1,8);
    lbp::ELBP(dst2,lbp2,1,8);

   // normalize(lbp2, lbp2, 0, 255, NORM_MINMAX, CV_8UC1);
    //normalize(lbp, lbp, 0, 255, NORM_MINMAX, CV_8UC1);

    //get histograms
    lbp::histogram(lbp,hist,255);
    lbp::histogram(lbp2,hist2,255);

    //comparing the 2 LBP histograms
    double compareHist = cv::norm(hist-hist2);

    cout<<compareHist<<endl;

    waitKey(0);
    return 0;
}

Basically it gives me a quantifiable number as to how similar these two images are. My question is, how do I improve this result? Whats a better way of acheiving a quantifiable number based on how similar 2 LBPs are? Or is the way I am doing it even right?

Thanks.