#include "myclass.h"
#include"ui_myclass.h"
#include <QStringBuilder>
//#include<Qstring.h>
//#include<string.h>
#include "stdafx.h"
#include "highgui.h"
#include <opencv2/core/core.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv2/features2d/features2d.hpp>
#include <opencv2/nonfree/features2d.hpp>
//#include <opencv2/legacy/legacy.hpp>
//#include "nofree\features2d.hpp"
#include <iostream>
using namespace std;
using namespace cv;
MyClass::MyClass(QWidget *parent)
: QMainWindow(parent)
{
ui.setupUi(this);
}
MyClass::~MyClass()
{
}
void MyClass::openimage_clicked()
{
QString fileName=QFileDialog::getOpenFileName(this,tr("open"),tr("image files(*.jpg*.png*.jpeg*.bmp)"));
QByteArray str=fileName.toLatin1();
image=imread(str.data());
//string str=fileName.toStdString();
//image=imread(str.data());
cvtColor(image,image,CV_RGB2RGBA);
QImage img=QImage((const unsigned char*)(image.data),image.cols,image.rows,QImage::Format_RGB32);
QLabel *label=new QLabel(this);
label->move(100,50);
label->setPixmap(QPixmap::fromImage(img));
label->resize(label->pixmap()->size());
label->show();
imwrite("sift_result1.jpg",image);
}
void MyClass::processimage_clicked()
{
flip(image, image, 5);
imwrite("sift_result1.jpg",image);
QImage img = QImage((const unsigned char*)(image.data), image.cols, image.rows, QImage::Format_RGB32);
QLabel *label = new QLabel(this);
label->move(100, 50);
label->setPixmap(QPixmap::fromImage(img));
label->resize(label->pixmap()->size());
label->show();
}
void MyClass::sift_clicked()
{
Mat image1;
image1=imread("sift_result1.jpg");
cvtColor(image1,image,CV_RGB2RGBA);
QImage img=QImage((const unsigned char*)(image.data),image.cols,image.rows,QImage::Format_RGB32);
QLabel *label=new QLabel(this);
label->move(100,50);
label->setPixmap(QPixmap::fromImage(img));
label->resize(label->pixmap()->size());
label->show();
SiftFeatureDetector detector;
vector<KeyPoint> keypoint1,keypoint2;
detector.detect(image1,keypoint1);
Mat image2;
drawKeypoints(image1,keypoint1,image2);
cvtColor(image2,image,CV_RGB2RGBA);
//imshow("sift_result1.jpg",image2);
QImage img1 = QImage((const unsigned char*)(image.data), image.cols, image.rows, QImage::Format_RGB32);
label->setPixmap(QPixmap::fromImage(img1));
label->resize(label->pixmap()->size());
label->show();
/*
Mat image3;
image2=imread("sift_result1.jpg");
SiftDescriptorExtractor extractor;
Mat descriptor1,descriptor2;
BruteForceMatcher<L2<float>> matcher;
vector<DMatch> matches;
Mat img_matches;
detector.detect(image2,keypoint2);
drawKeypoints(image2,keypoint2,image3);
extractor.compute(image1,keypoint1,descriptor1);
extractor.compute(image2,keypoint2,descriptor2);
matcher.match(descriptor1,descriptor2,matches);
drawMatches(image1,keypoint1,image2,keypoint2,matches,img_matches);
imshow("matches",img_matches);
imwrite("matches.jpg",img_matches);
waitKey();
*/
}
没有合适的资源?快使用搜索试试~ 我知道了~
vs2010+QT5.0.1+opencv2.4.3
共4个文件
cpp:2个
h:1个
ui:1个
5星 · 超过95%的资源 需积分: 13 64 下载量 6 浏览量
2013-04-18
19:55:04
上传
评论 5
收藏 3KB ZIP 举报
温馨提示
关于在vs2010上利用opencv处理图像,并利用QT做界面的简单程序。具体配置问题可以email to 1006282312@qq.com
资源推荐
资源详情
资源评论
收起资源包目录
vs2010+qt5.0.1+opencv2.4.3.zip (4个子文件)
vs2010+qt5.0.1+opencv2.4.3
myclass.ui 3KB
myclass.cpp 3KB
main.cpp 173B
myclass.h 506B
共 4 条
- 1
资源评论
- xinyinshe2013-11-01代码还是很不错的,对我这个菜鸟很有帮助
- 迷上微笑2015-04-24不错,挺好的
- 海透了心2014-04-25很好,听有用的
- 少得2014-01-23很好的资源,十分感谢
fjzzsyf
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功