From 162187608bbaf1f79d38c88803754c8e58359129 Mon Sep 17 00:00:00 2001 From: Patrick Simianer Date: Sat, 26 Nov 2016 12:40:34 +0100 Subject: cleanup --- opencv-qt-integration-1/ImageViewer.cpp | 28 ----------------- opencv-qt-integration-1/ImageViewer.h | 23 -------------- opencv-qt-integration-1/ImageViewer.pro | 10 ------ opencv-qt-integration-1/README.md | 41 ------------------------ opencv-qt-integration-1/main.cpp | 10 ------ opencv-qt-integration-1/python/ImageViewer.py | 45 --------------------------- 6 files changed, 157 deletions(-) delete mode 100644 opencv-qt-integration-1/ImageViewer.cpp delete mode 100644 opencv-qt-integration-1/ImageViewer.h delete mode 100644 opencv-qt-integration-1/ImageViewer.pro delete mode 100644 opencv-qt-integration-1/README.md delete mode 100644 opencv-qt-integration-1/main.cpp delete mode 100644 opencv-qt-integration-1/python/ImageViewer.py (limited to 'opencv-qt-integration-1') diff --git a/opencv-qt-integration-1/ImageViewer.cpp b/opencv-qt-integration-1/ImageViewer.cpp deleted file mode 100644 index 780f221..0000000 --- a/opencv-qt-integration-1/ImageViewer.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include -#include -#include "ImageViewer.h" - -ImageViewer::ImageViewer() -{ - img = cv::imread("../assets/flughahn.jpg"); - - imageLabel = new QLabel(); - if (img.empty()) { - imageLabel->setText("Cannot load the input image!"); - } else { - cv::cvtColor(img, img, cv::COLOR_BGR2RGB); - QImage _img(img.data, img.cols, img.rows, QImage::Format_RGB888); - imageLabel->setPixmap(QPixmap::fromImage(_img)); - } - - quitButton = new QPushButton("Quit"); - connect(quitButton, SIGNAL(clicked()), this, SLOT(close())); - - mainLayout = new QVBoxLayout(); - mainLayout->addWidget(imageLabel); - mainLayout->addWidget(quitButton); - - setLayout(mainLayout); - setWindowTitle("OpenCV - Qt Integration"); -} diff --git a/opencv-qt-integration-1/ImageViewer.h b/opencv-qt-integration-1/ImageViewer.h deleted file mode 100644 index e07c333..0000000 --- a/opencv-qt-integration-1/ImageViewer.h +++ /dev/null @@ -1,23 +0,0 @@ -#ifndef IMAGEVIEWER_H -#define IMAGEVIEWER_H - -#include -#include - -class QLabel; -class QVBoxLayout; -class QPushButton; - -class ImageViewer : public QWidget -{ -public: - ImageViewer(); - -private: - cv::Mat img; - QLabel *imageLabel; - QVBoxLayout *mainLayout; - QPushButton *quitButton; -}; - -#endif diff --git a/opencv-qt-integration-1/ImageViewer.pro b/opencv-qt-integration-1/ImageViewer.pro deleted file mode 100644 index 0614934..0000000 --- a/opencv-qt-integration-1/ImageViewer.pro +++ /dev/null @@ -1,10 +0,0 @@ -TEMPLATE = app -TARGET = ImageViewer -INCLUDEPATH += . -QT += widgets - -# Input -HEADERS += ImageViewer.h -SOURCES += ImageViewer.cpp main.cpp -INCLUDEPATH += /usr/local/include -LIBS += -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs diff --git a/opencv-qt-integration-1/README.md b/opencv-qt-integration-1/README.md deleted file mode 100644 index e0200ae..0000000 --- a/opencv-qt-integration-1/README.md +++ /dev/null @@ -1,41 +0,0 @@ -OpenCV - Qt Integration -======================= - -This code sample shows the basics to display OpenCV's matrix (`cv::Mat`) within a Qt GUI. The code simply load the `flughahn.jpg` image from the `assets/` directory and display it using the `QLabel` widget. - -![Screenshot](http://i.imgur.com/k1et0FY.png) - -Within the `python/` directory, you will see the same code written in Python. - -To compile and run the code, you need to have Qt 5 installed on your computer. The code is successfully tested on the following environment: - - - Mac OS X Mavericks - - Qt 5.3.0 - - OpenCV 3.0.0 - - Python 3.4.1 - -Compiling ---------- - -Open `ImageViewer.pro` and modify the variables to match with your system. For example, you might need to modify the paths for the includes and libraries especially if you're on Windows. - - INCLUDEPATH += /usr/local/include - LIBS += -L/usr/local/lib -lopencv_core -lopencv_highgui -lopencv_imgproc -lopencv_imgcodecs - -Change your working directory and compile the code by typing: - - qmake - make - -If everything is ok, it will produce an executable: `ImageViewer` (Linux), `ImageViewer.exe` (Windows), or `ImageViewer.app` (Mac). Run the executable and you will see the GUI like the screenshot above. - -Known Issues ------------- - -In `ImageViewer.cpp`, the code using relative path to locate the input image: - - img = cv::imread("../assets/flughahn.jpg"); - -If the program cannot display the image and shows the "Cannot load the input image!" warning, try to use absolute path instead. For example: - - img = cv::imread("/full/path/to/flughahn.jpg"); diff --git a/opencv-qt-integration-1/main.cpp b/opencv-qt-integration-1/main.cpp deleted file mode 100644 index 0993f8c..0000000 --- a/opencv-qt-integration-1/main.cpp +++ /dev/null @@ -1,10 +0,0 @@ -#include -#include "ImageViewer.h" - -int main(int argc, char** argv) -{ - QApplication app(argc, argv); - ImageViewer viewer; - viewer.show(); - app.exec(); -} diff --git a/opencv-qt-integration-1/python/ImageViewer.py b/opencv-qt-integration-1/python/ImageViewer.py deleted file mode 100644 index 1525f21..0000000 --- a/opencv-qt-integration-1/python/ImageViewer.py +++ /dev/null @@ -1,45 +0,0 @@ -#!/usr/bin/env python -# encoding: utf-8 - -import os -import sys - -try: - from PyQt5.QtCore import * - from PyQt5.QtGui import * - from PyQt5.QtWidgets import * - import cv2 -except ImportError: - print("Please install the required packages.") - sys.exit() - -class ImageViewer(QWidget): - - def __init__(self): - QWidget.__init__(self) - self.filename = "../../assets/flughahn.jpg" - self.setup_ui() - - def setup_ui(self): - img = cv2.imread(self.filename) - self.image_label = QLabel() - if img is None: - self.image_label.setText("Cannot load the input image.") - else: - img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) - img_ = QImage(img.data, img.shape[1], img.shape[0], QImage.Format_RGB888) - self.image_label.setPixmap(QPixmap.fromImage(img_)) - self.quit_button = QPushButton("Quit") - self.quit_button.clicked.connect(self.close) - self.main_layout = QVBoxLayout() - self.main_layout.addWidget(self.image_label) - self.main_layout.addWidget(self.quit_button) - self.setLayout(self.main_layout) - self.setWindowTitle("OpenCV - Qt Integration") - - -if __name__ == "__main__": - app = QApplication(sys.argv) - viewer = ImageViewer() - viewer.show() - app.exec_() -- cgit v1.2.3