I want to Integrate Android with C++and OpenCV

**I have two “.cpp” and one “.h” files which I want to integrate with my Android app , tell me how can I do that I am totally beginner in JNI , I don’t know how to convert my C++ code to JNI . I am pasting my code can any one please convert this to JNI and explain me the line also which is been converted …

#include <QDebug>

#include
#include
#include
#include
#include
#include

#include “imageprocessor.h”

ImageProcessor::ImageProcessor(QObject *parent):QObject(parent)
{
img_thread = new ThreadProcessor();

connect(img_thread, SIGNAL(finished()),this, SLOT(image_processed()));

}

void ImageProcessor::process_image(const QString &source_image)
{
qDebug() << "###ImgProc### ImageProcessor::process_image " << source_image;

if(source_image.size() == 0)
{
    emit error("Error. The image URL is empty");
    return;
}

QUrl source_url(source_image);
QString local_file_name = source_url.toLocalFile();

QFileInfo img_file(local_file_name);
if(img_file.exists() == false)
{
    emit error("Error. The image URL does not exist");
    return;
}

if(img_file.isFile() == false)
{
    emit error("Error. The image URL is not a valid file");
    return;
}


if(img_file.isReadable() == false)
{
    emit error("Error. The image is not readable");
    return;
}

m_circles = 0;
m_processed_file = "";
img_thread->process_image(source_image);

}

void ImageProcessor::image_processed()
{
m_circles = img_thread->num_circles;
m_processed_file = img_thread->output_file;
qDebug() << "###ImgProc### ImageProcessor::image_processed " << m_circles;
qDebug() << "###ImgProc### ImageProcessor::image_processed " << m_processed_file;
emit completed();
}

int ImageProcessor::getNumCircles() const
{
qDebug() << "###ImgProc### ImageProcessor::getNumCircles " << m_circles;
return m_circles;
}

QString ImageProcessor::getProcessedImage() const
{
qDebug() << "###ImgProc### ImageProcessor::getProcessedImage " << m_processed_file;
return m_processed_file;
}

ThreadProcessor::ThreadProcessor(QObject *parent):QThread(parent)
{
}

ThreadProcessor::~ThreadProcessor()
{
}

void ThreadProcessor::run()
{
find_circles_hough_transform(input_file.toStdString(),
output_file.toStdString());
}

void ThreadProcessor::process_image(const QString &source_url_)
{
qDebug() << "###ImgProc### ThreadProcessor::process_image " << source_url_;

num_circles = 0;

QUrl source_url(source_url_);
input_file = source_url.toLocalFile();

QFileInfo source_file_path_info(input_file);
QString source_dir = source_file_path_info.absolutePath();
QString source_file_name = source_file_path_info.fileName();


output_file = source_dir + "/proc_" + source_file_name;

qDebug() << "###ImgProc### ThreadProcessor::process_image SRC : " << input_file;
qDebug() << "###ImgProc### ThreadProcessor::process_image DEST : " << output_file;
start();

}

void ThreadProcessor::find_circles_hough_transform(const string &file_name,
const string &dest_file_name)
{
qDebug() << “###ImgProc### Applying image transform - Gaussian blur + Hough circle transform”;
Mat src, src_gray;

/// Read the image
qDebug() << "###ImgProc### " << file_name.c_str();
num_circles = 0;

src = cv::imread(file_name, 1);

if (!src.data)
{
    return;
}

/// Convert it to gray
cvtColor(src, src_gray, CV_BGR2GRAY);

/// Reduce the noise so we avoid false circle detection
GaussianBlur(src_gray, src_gray, Size(9, 9), 2, 2);

vector<Vec3f> circles;

/// Apply the Hough Transform to find the circles
HoughCircles(src_gray, circles, CV_HOUGH_GRADIENT, 1, src_gray.rows / 8, 200, 100, 0, 0);
num_circles = (int)circles.size();
qDebug() << "###ImgProc###  Number of hough circles found = " << circles.size();
for (size_t i = 0; i < circles.size(); i++)
{
    Point center(cvRound(circles[i][0]), cvRound(circles[i][1]));
    int radius = cvRound(circles[i][2]);

    stringstream ss;
    ss<<(int)(i + 1);
    string str = ss.str();

    putText(src, str, center, FONT_HERSHEY_SIMPLEX, 3, Scalar(0,0,255), 5);
    circle(src, center, radius, Scalar(0, 0, 255), 5);
}

/// Show your results

vector<int> compression_params;
compression_params.push_back(CV_IMWRITE_PNG_COMPRESSION);
compression_params.push_back(9);

try
{
    imwrite(dest_file_name, src, compression_params);
}
catch (std::runtime_error& ex)
{
    qDebug() << "###ImgProc### Exception converting image to PNG format " << ex.what();
}

}