ubuntu系统下qt中用什么函数扫描i/o口
2016-09-06
展开全部
下面通过2个小例子来简单介绍一下linux下opencv怎样在Qt中进行编程的。
Example 1(用Qt Console Application开发):
用QtCreator新建一个Qt Console Application的过程此处就省略掉。建立完后在main函数中输入以下代码:
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
int main(int argc, char *argv[])
{
// QCoreApplication a(argc, argv);
namedWindow( "src", WINDOW_AUTOSIZE );
Mat src1 = imread( "lena.jpg" );
while(1)
{
imshow( "src", src1 );
char c = waitKey(30);
if( 27==c )
return 0;
}
// return a.exec();
}
Example 1(用Qt Console Application开发):
用QtCreator新建一个Qt Console Application的过程此处就省略掉。建立完后在main函数中输入以下代码:
#include <QCoreApplication>
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/imgproc/imgproc.hpp>
using namespace cv;
int main(int argc, char *argv[])
{
// QCoreApplication a(argc, argv);
namedWindow( "src", WINDOW_AUTOSIZE );
Mat src1 = imread( "lena.jpg" );
while(1)
{
imshow( "src", src1 );
char c = waitKey(30);
if( 27==c )
return 0;
}
// return a.exec();
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询