Ask Your Question

Nepherpitou's profile - activity

2020-06-21 09:58:40 -0600 received badge  Famous Question (source)
2016-06-07 23:41:02 -0600 received badge  Notable Question (source)
2015-01-10 15:20:13 -0600 received badge  Popular Question (source)
2013-12-27 05:41:56 -0600 received badge  Student (source)
2013-12-26 12:29:47 -0600 received badge  Editor (source)
2013-12-26 12:11:33 -0600 asked a question 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));
}