Putting it all together - the main() function
Over the course of this chapter, we have implemented for different components of our LBP feature extraction system:
Computing the LBP code for each pixel.
Checking whether a given LBP code corresponds to a uniform pattern code.
Computing the spatially enhanced LBP histogram.
The code that we share in this section brings everything together and assembles it under the umbrella of a main()
function:
#include <iostream> #include "opencv2/highgui/highgui.hpp" #include "opencv2/core/core.hpp" using namespace std; using namespace cv; int main(int argc, char** argv) {
This is to remind users that a command-line argument is expected:
if(argc != 2) { cout << "USAGE: ./lbp_image [IMAGE]\n"; return 1; } const string imagepath = argv[1]; Mat src = imread(imagepath, CV_LOAD_IMAGE_GRAYSCALE);
The next...