2014-06-23 04:10:45 -0600 | commented question | Adding Trackbar on jni part of Android OpenCV Thank you berak |
2014-06-22 11:43:34 -0600 | asked a question | Adding Trackbar on jni part of Android OpenCV Hello, I am new to Android OpenCV. I am trying to detect circles using Hough Algorithm on Android phone. I have edited jni part of Android OpenCv sample code(OpenCv Tutorial2 - Mixed Processing). I am able to detect circles on myy Android. Now i want to add trackbar for caliberation purpose to change the value of param1 and param2 in hough function. void HoughCircles(InputArray image, OutputArray circles, int method, double dp, double minDist, double param1, double param2, int minRadius=0, int maxRadius=0); Here is my code for circle detection: include<jni.h>include <opencv2 core="" core.hpp="">include <opencv2 imgproc="" imgproc.hpp="">include <opencv2 highgui="" highgui.hpp="">include <opencv2 features2d="" features2d.hpp="">include <vector>include <iostream>include <stdio.h>define w 400using namespace std; using namespace cv; /// Global Variables const int alpha_slider_max = 100; int alpha_slider; double alpha; double beta; /// Matrices to store images Mat src1; Mat dst; /** * @function on_trackbar * @brief Callback for trackbar */ int resizefactor = 5; Point center1(1200,100); void drawcircle(Mat mRgb){ circle( mRgb, center1, w/12,Scalar( 0, 0, 255 ),3, 8 ); Point textPos(1140, 170); std::ostringstream oss2; oss2 << "Ref.r:" <<w 12="" ;="" puttext(mrgb,="" oss2.str(),="" textpos,="" font_hershey_simplex,="" 1.0,="" scalar(0,0,255),="" 1,8,="" false);="" }<="" p=""> /** * @function on_trackbar * @brief Callback for trackbar */ void convertHough(Mat mRgb,Mat image, int rmin, int rmax){ } } extern "C" { JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv*, jobject, jlong addrGray, jlong addrRgba); JNIEXPORT void JNICALL Java_org_opencv_samples_tutorial2_Tutorial2Activity_FindFeatures(JNIEnv, jobject, jlong addrGray, jlong addrRgba) { Mat& mGr = *(Mat)addrGray; Mat& mRgb = (Mat)addrRgba; // vector<keypoint> v; /* FastFeatureDetector detector(50); detector.detect(mGr, v); for( unsigned int i = 0; i < v.size(); i++ ) { const KeyPoint& kp ... (more) |