Qt + Android + OpenCV is possible?
Hello, I'm trying to build simple android application, what just take photo from camera using opencv.
Application was built succesfull, but show me error when i try to run it on emulator or my phone. And no debug messages! I don't know what going wrong!
Is this real to use opencv in qt android app? What i need to do? Where i can read example? Sorry for bad english, not enought practics.
System is Windows 7 x86_64, Qt 5.2
.pro contents:
QT += core gui
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = opencv_android
TEMPLATE = app
LIBS += H:\OpenCV-2.4.7.1-android-sdk\sdk\native\libs\armeabi-v7a\\\*
INCLUDEPATH += H:\OpenCV-2.4.7.1-android-sdk\sdk\native\jni\include\
SOURCES += main.cpp\
mainwindow.cpp
HEADERS += mainwindow.h
FORMS += mainwindow.ui
CONFIG += mobility
MOBILITY =
ANDROID_EXTRA_LIBS =
ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android
OTHER_FILES += \
android/AndroidManifest.xml
mainwindow.cpp:
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
cap = new cv::VideoCapture(0);
}
MainWindow::~MainWindow()
{
delete ui;
}
void MainWindow::on_pbdo_clicked()
{
cv::Mat pic, color;
cap->operator >>(pic);
cv::cvtColor(pic, color, CV_BGR2RGB);
QImage img((uchar*) pic.data, pic.rows, pic.cols, pic.step, QImage::Format_RGB888);
ui->lbimg->setPixmap(QPixmap::fromImage(img));
}
I can use other openCV(imgproc, core)modules with Qt on android, but not the camera module of openCV.(Qt5.2.1 would allow us to capture the image buffer from QCamera).
http://answers.opencv.org/question/18376/cannot-use-camera-on-android-412-with-opencv-246/ I gave an answer on how to use it on old Qt 5, but also worked on Qt5.1. I havent tested 5.2 yet though