arm下含qt的opencv程序无法运行的问题

yulebron yulebron 墨衍会员 · AI 创作全网分发 墨衍智能分发 通过墨衍一键同步至各平台 可同步平台 CSDN微信公众号微博知乎掘金百家号博客园抖音小红书 你的文章也可以这样分发 墨衍会员 ¥399起/年,写一次发全网 我也要 + 加入社区
首先,我在PC的linux下运行的这个程序,可以正常运行
然后用qt中arm对应的开发套件去编译,没有任何报错
我也将用cmake生成的.so文件导到了arm上的/lib文件夹中
在arm中运行时,没有反应,直接跳到下一条命令行
如图
需要说明的是之前没有调用opencv库的时候,PC和ARM上均能正常运行QT程序

下面附上主要代码:
1.main.cpp
#include "widget.h"
#include <QApplication>

int main(int argc, char *argv[])
{
QApplication a(argc, argv);
Widget w;
return a.exec();
}

2.widget.cpp
#include "widget.h"
#include "ui_widget.h"
#include <QLabel>
#include <QPixmap>
#include "opencv2/opencv.hpp"

Widget::Widget(QWidget *parent) :
QWidget(parent),
ui(new Ui::Widget)
{
ui->setupUi(this);

IplImage *img = cvLoadImage("cat.jpg");
QLabel *label = new QLabel();
QImage *image;

cvCvtColor(img,img,CV_BGR2RGB);
uchar *imgData=(uchar *)img->imageData;
image=new QImage(imgData,img->width,img->height,QImage::Format_RGB888);

QPixmap pixmap = QPixmap::fromImage(image->scaled(size()));
label->setPixmap(pixmap);
label->show();
}

Widget::~Widget()
{
delete ui;
}

...全文

相关推荐

评论 4
收藏 已收藏
分享
返回顶部
yulebron
CPU和硬件区 1,026 成员 561 内容