Ask Your Question

Bruce's profile - activity

2016-06-26 06:06:03 -0600 received badge  Editor (source)
2016-06-26 06:01:29 -0600 asked a question Cannot resolve corresponding JNI function Java_org_opencv_features2D_featuresDetector_detect_12...more(ctrl+F1)

Hello all, I know this question have many answer in web, But i still not find answer for my solution. I am try to use Matchkeypoint function like a this tutorial http://docs.opencv.org/2.4/doc/tutori... . However, I use it in android studio, When i run it , my app exit and say that "unfortunately, app has stopped" I go to FeatureDetector class and i see private static native long create_0(int detectorType); have red color

I search it in and i know this is problem with native code, i do follow this video https://www.youtube.com/watch?v=OTw_G...

But when i use my code

public Mat onCameraFrame(CameraBridgeViewBase.CvCameraViewFrame inputFrame) { mImageRGBA = inputFrame.rgba(); Utils.bitmapToMat(icon, img_object); Imgproc.cvtColor(mImageRGBA,img_scene,Imgproc.COLOR_RGBA2GRAY);

    FeatureDetector detector = FeatureDetector.create(FeatureDetector.FAST);
    DescriptorExtractor descriptor = DescriptorExtractor.create(DescriptorExtractor.ORB);;
    DescriptorMatcher matcher = DescriptorMatcher.create(DescriptorMatcher.BRUTEFORCE_HAMMING);

    MatOfKeyPoint keyPoint1 = new MatOfKeyPoint();

    detector.detect(img_object, keyPoint1);

    Mat img_keypoints_1 = new Mat();
    Features2d.drawKeypoints(img_object,keyPoint1,img_keypoints_1);

    Log.i("aaa",keyPoint1.dump());


    return mImageRGBA;
}

My app exit and i see in logcat error like below picture

image description

I was try again with another way follow this video https://www.youtube.com/watch?v=cLK9C...

But with this way i still get error image description

Please help me solved this problem, i tried every way but still can not solve my problem

2016-06-26 00:28:41 -0600 received badge  Enthusiast
2016-06-21 13:16:30 -0600 asked a question Can not change width height (-w -h parameter) in opencv_trainingcascade.exe???

Hello all,

I try to use opencv_traincascade.exe to detect my object (rear of car). But i have a problem when i choose size -w -h. This is all af step i do. _ I have positive.txt which have absolute direction to all of image which ha object. _ I have negative.txt which have absolute direction to all of background image. _ Now i use opencv_createsamples.exe to create vector file with command.

D:\Project_Android\Classifier\bin\opencv_createsamples.exe -info positive.txt -vec vector.vec -num 1000 -w 72 -h 48

Which this command, it run and i have vector file which have 1000 positive sample, size 72x48. Now, i use opencv_traincascade.exe to train, i know that size of train image had to equal size of createsample. so my command is:

D:\Project_Android\Classifier\bin\opencv_traincascade.exe -data HaarTraining -vec vector.vec -bg negative.txt -numPos 250 -numNeg 1500 -numStages 10 -nonsym -minhitrate 0.999 -maxfalsealarm 0.5 -mode ALL -w 72 -h 48 -precalcValBufSize 2046 -precalcIdxBufSize 2046 PAUSE

It not run and say error "Assertion failed <_img.row*_img.col==vecSize> in CvCascadeImageReader::PosReader::get, file C:buildslave64\win64_amdoc1\2_4_PackSlave-win6411-shared\opencv\apps\traincascade\imagestorage.cpp, line 149". More error detail is shown in below picture.

image description

In this picture i see, size of image still config width 24 height 24. And one more thing -precalcValBufSize and -precalcIdxBufSize 2046 is stll config defaul value 1024. it seem to be no change with -w -h -precalcIdxBufSize -precalcValBufSize althought i configed it. So i don't know what problem with it. I was change version of opencv 2.4.11, 2.4.12, 3.1, lastest 2.4.13. But no thing happen, It still auto config defaul value for -w -h -precalcIdxBufSize -precalcValBufSize and i can set value for this parameter.

if i use size 24x24 for createsample and haartraining. It's training good, just can use 24x24 , other sizes are still say error like above. So what problem with it and how can i fix it to get new size, i would like to use size 72x48 (i use win 7 64 bit and i was copy bin folder of opencv C:\Users\BAOTRUONG\Desktop\opencv\build\x64\vc11\bin ).