我試圖在android上執行如下操作:http://www.youtube.com/watch?v=zjxWpKCQqJc。Android OpenCV對象檢測
這裏我的代碼:
public Mat onCameraFrame(CvCameraViewFrame inputFrame) {
Mat novo = new Mat();
Mat resp = new Mat();
Mat homer = new Mat();
//resp = inputFrame.gray();
novo = inputFrame.gray();
Mat lido = new Mat();
try {
lido = Utils.loadResource(this, R.drawable.homer);
} catch (IOException e) {
e.printStackTrace();
}
Imgproc.cvtColor(lido, homer, Imgproc.COLOR_RGB2GRAY);
FeatureDetector surf = FeatureDetector.create(FeatureDetector.FAST);
MatOfKeyPoint keypointsHomer = new MatOfKeyPoint();
MatOfKeyPoint keypoints = new MatOfKeyPoint();
surf.detect(homer, keypointsHomer);
surf.detect(novo, keypoints);
DescriptorExtractor SurfExtractor = DescriptorExtractor.create(FeatureDetector.SURF);
Mat descriptors = new Mat();
Mat homerDescriptors = new Mat();
SurfExtractor.compute(novo, keypoints, descriptors);
SurfExtractor.compute(homer, keypointsHomer, homerDescriptors);
DescriptorMatcher m = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE);
MatOfDMatch matches = new MatOfDMatch();
m.match(descriptors, homerDescriptors, matches);
Features2d.drawMatches(novo, keypoints, homer, keypointsHomer, matches, resp);
return resp;
}
,我得到了以下錯誤:https://dl.dropboxusercontent.com/u/2345114/error_android.png
如果我嘗試繪製關鍵點是這樣的:
Features2d.drawKeypoints(novo, keypoints, resp);
Features2d.drawKeypoints(homer, keypointsHomer, resp);
兩個工作正常! 我做錯了什麼?
如果你自己解決了這個問題,你介意發佈什麼解決方案是?另外:您的鏈接不再工作。看起來您的應用程序在Google Play上不可用。 – pocmo
我做過其他事情。我不知道爲什麼該應用從谷歌播放中刪除,但是。在我的網站上有一個鏈接到源代碼,apk包含在內。 http://quintao.info 我希望能對您有所幫助! = D –
嘿,你在那裏做了很好的工作!我想問你,你是如何區分不同的辛普森人之間的區別的?我試圖做一些像你的探測器,但汽車零件。我需要區分方向盤和車輪。你能給我一些建議嗎? – definera