Skip to content

Instantly share code, notes, and snippets.

@Azhng
Created April 18, 2016 00:53
Show Gist options
  • Save Azhng/2ce46b6c766f1bd7b704bca0a45e64f8 to your computer and use it in GitHub Desktop.
Save Azhng/2ce46b6c766f1bd7b704bca0a45e64f8 to your computer and use it in GitHub Desktop.
#include <iostream>
#include <opencv2/core/core.hpp>
#include <opencv2/imgcodecs.hpp>
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include "../src/include/CvEngine.hpp"
using namespace cngn;
int main(int argc, char * argv[])
{
cv::Mat imgInput;
imgInput = cv::imread(argv[1], CV_LOAD_IMAGE_COLOR);
CvEngine engine;
cv::Mat match;
engine
.from(imgInput)
.toGray()
.appendAsyncJob("match", imgInput2, [](auto c, cv::Mat img){
std::cout << "In async" << std::endl;
return c.from(img)
.toGray()
.detectKeyPoints(400)
.drawKeyPoints(img)
.writeToFileWithName("key2");
})
.detectKeyPoints(400)
.drawKeyPoints(imgInput)
.writeToFileWithName("key1")
.mergeWithAsyncJob("match", [imgInput, match](auto m, auto n){
std::cout << " in merge" <<std::endl;
m.matchKeyPoints(n.getDescriptor(), 0, 100)
.drawMatches(n.getImage()
, n.getImage(), n.getKeyPoints()).writeToFileWithName("Match");
std::cout << m.getMatches().size() << std::endl;
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment