Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 3 | PointedEar | 1 | /*------------------------------------------------------------------------------------------*\ |
| 2 | This file contains material supporting chapter 1 of the cookbook: |
||
| 3 | Computer Vision Programming using the OpenCV Library. |
||
| 4 | by Robert Laganiere, Packt Publishing, 2011. |
||
| 5 | |||
| 6 | This program is free software; permission is hereby granted to use, copy, modify, |
||
| 7 | and distribute this source code, or portions thereof, for any purpose, without fee, |
||
| 8 | subject to the restriction that the copyright notice may not be removed |
||
| 9 | or altered from any source or altered source distribution. |
||
| 10 | The software is released on an as-is basis and without any warranties of any kind. |
||
| 11 | In particular, the software is not guaranteed to be fault-tolerant or free from failure. |
||
| 12 | The author disclaims all warranties with regard to this software, any use, |
||
| 13 | and any consequent failure, is purely the responsibility of the user. |
||
| 14 | |||
| 15 | Copyright (C) 2010-2011 Robert Laganiere, www.laganiere.name |
||
| 16 | \*------------------------------------------------------------------------------------------*/ |
||
| 17 | |||
| 18 | #include "mainwindow.h" |
||
| 19 | #include "ui_mainwindow.h" |
||
| 20 | |||
| 21 | MainWindow::MainWindow(QWidget *parent) |
||
| 22 | : QMainWindow(parent), ui(new Ui::MainWindow) |
||
| 23 | { |
||
| 24 | ui->setupUi(this); |
||
| 25 | } |
||
| 26 | |||
| 27 | MainWindow::~MainWindow() |
||
| 28 | { |
||
| 29 | delete ui; |
||
| 30 | } |
||
| 31 | |||
| 32 | void MainWindow::on_pushButton_clicked() |
||
| 33 | { |
||
| 34 | QString fileName = QFileDialog::getOpenFileName(this, |
||
| 35 | tr("Open Image"), ".", tr("Image Files (*.png *.jpg *.bmp)")); |
||
| 36 | |||
| 37 | image= cv::imread(fileName.toAscii().data()); |
||
| 38 | cv::namedWindow("Original Image"); |
||
| 39 | cv::imshow("Original Image", image); |
||
| 40 | } |
||
| 41 | |||
| 42 | void MainWindow::on_pushButton_2_clicked() |
||
| 43 | { |
||
| 44 | cv::flip(image,image,1); |
||
| 45 | cv::namedWindow("Output Image"); |
||
| 46 | cv::imshow("Output Image", image); |
||
| 47 | } |