Permalink
Browse files

Blahh

  • Loading branch information...
1 parent 32ecbae commit 669a9fedefabab7eeae5a71c76e5a6571ec6d71a @ethanbishop ethanbishop committed Apr 27, 2012
Showing with 795 additions and 0 deletions.
  1. +223 −0 Makefile
  2. +19 −0 MyCameraWindow.cpp
  3. +26 −0 MyCameraWindow.h
  4. +63 −0 QOpenCVWidget.cpp
  5. +25 −0 QOpenCVWidget.h
  6. +12 −0 QtOpenCV.pro
  7. +4 −0 makefile
  8. +69 −0 moc_MyCameraWindow.cpp
  9. +225 −0 qmakefile
  10. BIN robot_test
  11. +93 −0 vision.cpp
  12. +11 −0 vision.h
  13. +25 −0 vision_test.cpp
View
@@ -0,0 +1,223 @@
+#############################################################################
+# Makefile for building: QtOpenCV
+# Generated by qmake (2.01a) (Qt 4.7.4) on: Fri Apr 27 11:46:49 2012
+# Project: QtOpenCV.pro
+# Template: app
+# Command: /usr/bin/qmake -o Makefile QtOpenCV.pro
+#############################################################################
+
+####### Compiler, tools and options
+
+CC = gcc
+CXX = g++
+DEFINES = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
+CFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+CXXFLAGS = -m64 -pipe -O2 -Wall -W -D_REENTRANT $(DEFINES)
+INCPATH = -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -I/usr/include/qt4/QtCore -I/usr/include/qt4/QtGui -I/usr/include/qt4 -I.
+LINK = g++
+LFLAGS = -m64 -Wl,-O1
+LIBS = $(SUBLIBS) -L/usr/lib/x86_64-linux-gnu -lcv -lhighgui -lQtGui -lQtCore -lpthread
+AR = ar cqs
+RANLIB =
+QMAKE = /usr/bin/qmake
+TAR = tar -cf
+COMPRESS = gzip -9f
+COPY = cp -f
+SED = sed
+COPY_FILE = $(COPY)
+COPY_DIR = $(COPY) -r
+STRIP = strip
+INSTALL_FILE = install -m 644 -p
+INSTALL_DIR = $(COPY_DIR)
+INSTALL_PROGRAM = install -m 755 -p
+DEL_FILE = rm -f
+SYMLINK = ln -f -s
+DEL_DIR = rmdir
+MOVE = mv -f
+CHK_DIR_EXISTS= test -d
+MKDIR = mkdir -p
+
+####### Output directory
+
+OBJECTS_DIR = ./
+
+####### Files
+
+SOURCES = vision_test.cpp \
+ QOpenCVWidget.cpp \
+ MyCameraWindow.cpp moc_MyCameraWindow.cpp
+OBJECTS = vision_test.o \
+ QOpenCVWidget.o \
+ MyCameraWindow.o \
+ moc_MyCameraWindow.o
+DIST = /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/release.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+ QtOpenCV.pro
+QMAKE_TARGET = QtOpenCV
+DESTDIR =
+TARGET = QtOpenCV
+
+first: all
+####### Implicit rules
+
+.SUFFIXES: .o .c .cpp .cc .cxx .C
+
+.cpp.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cc.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.cxx.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.C.o:
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o "$@" "$<"
+
+.c.o:
+ $(CC) -c $(CFLAGS) $(INCPATH) -o "$@" "$<"
+
+####### Build rules
+
+all: Makefile $(TARGET)
+
+$(TARGET): $(OBJECTS)
+ $(LINK) $(LFLAGS) -o $(TARGET) $(OBJECTS) $(OBJCOMP) $(LIBS)
+
+Makefile: QtOpenCV.pro /usr/share/qt4/mkspecs/linux-g++-64/qmake.conf /usr/share/qt4/mkspecs/common/g++.conf \
+ /usr/share/qt4/mkspecs/common/unix.conf \
+ /usr/share/qt4/mkspecs/common/linux.conf \
+ /usr/share/qt4/mkspecs/qconfig.pri \
+ /usr/share/qt4/mkspecs/modules/qt_webkit_version.pri \
+ /usr/share/qt4/mkspecs/features/qt_functions.prf \
+ /usr/share/qt4/mkspecs/features/qt_config.prf \
+ /usr/share/qt4/mkspecs/features/exclusive_builds.prf \
+ /usr/share/qt4/mkspecs/features/default_pre.prf \
+ /usr/share/qt4/mkspecs/features/release.prf \
+ /usr/share/qt4/mkspecs/features/default_post.prf \
+ /usr/share/qt4/mkspecs/features/warn_on.prf \
+ /usr/share/qt4/mkspecs/features/qt.prf \
+ /usr/share/qt4/mkspecs/features/unix/thread.prf \
+ /usr/share/qt4/mkspecs/features/moc.prf \
+ /usr/share/qt4/mkspecs/features/resources.prf \
+ /usr/share/qt4/mkspecs/features/uic.prf \
+ /usr/share/qt4/mkspecs/features/yacc.prf \
+ /usr/share/qt4/mkspecs/features/lex.prf \
+ /usr/share/qt4/mkspecs/features/include_source_dir.prf \
+ /usr/lib/x86_64-linux-gnu/libQtGui.prl \
+ /usr/lib/x86_64-linux-gnu/libQtCore.prl
+ $(QMAKE) -o Makefile QtOpenCV.pro
+/usr/share/qt4/mkspecs/common/g++.conf:
+/usr/share/qt4/mkspecs/common/unix.conf:
+/usr/share/qt4/mkspecs/common/linux.conf:
+/usr/share/qt4/mkspecs/qconfig.pri:
+/usr/share/qt4/mkspecs/modules/qt_webkit_version.pri:
+/usr/share/qt4/mkspecs/features/qt_functions.prf:
+/usr/share/qt4/mkspecs/features/qt_config.prf:
+/usr/share/qt4/mkspecs/features/exclusive_builds.prf:
+/usr/share/qt4/mkspecs/features/default_pre.prf:
+/usr/share/qt4/mkspecs/features/release.prf:
+/usr/share/qt4/mkspecs/features/default_post.prf:
+/usr/share/qt4/mkspecs/features/warn_on.prf:
+/usr/share/qt4/mkspecs/features/qt.prf:
+/usr/share/qt4/mkspecs/features/unix/thread.prf:
+/usr/share/qt4/mkspecs/features/moc.prf:
+/usr/share/qt4/mkspecs/features/resources.prf:
+/usr/share/qt4/mkspecs/features/uic.prf:
+/usr/share/qt4/mkspecs/features/yacc.prf:
+/usr/share/qt4/mkspecs/features/lex.prf:
+/usr/share/qt4/mkspecs/features/include_source_dir.prf:
+/usr/lib/x86_64-linux-gnu/libQtGui.prl:
+/usr/lib/x86_64-linux-gnu/libQtCore.prl:
+qmake: FORCE
+ @$(QMAKE) -o Makefile QtOpenCV.pro
+
+dist:
+ @$(CHK_DIR_EXISTS) .tmp/QtOpenCV1.0.0 || $(MKDIR) .tmp/QtOpenCV1.0.0
+ $(COPY_FILE) --parents $(SOURCES) $(DIST) .tmp/QtOpenCV1.0.0/ && $(COPY_FILE) --parents QOpenCVWidget.cpp MyCameraWindow.h vision.h vision.cpp .tmp/QtOpenCV1.0.0/ && $(COPY_FILE) --parents vision_test.cpp QOpenCVWidget.cpp MyCameraWindow.cpp .tmp/QtOpenCV1.0.0/ && (cd `dirname .tmp/QtOpenCV1.0.0` && $(TAR) QtOpenCV1.0.0.tar QtOpenCV1.0.0 && $(COMPRESS) QtOpenCV1.0.0.tar) && $(MOVE) `dirname .tmp/QtOpenCV1.0.0`/QtOpenCV1.0.0.tar.gz . && $(DEL_FILE) -r .tmp/QtOpenCV1.0.0
+
+
+clean:compiler_clean
+ -$(DEL_FILE) $(OBJECTS)
+ -$(DEL_FILE) *~ core *.core
+
+
+####### Sub-libraries
+
+distclean: clean
+ -$(DEL_FILE) $(TARGET)
+ -$(DEL_FILE) Makefile
+
+
+check: first
+
+mocclean: compiler_moc_header_clean compiler_moc_source_clean
+
+mocables: compiler_moc_header_make_all compiler_moc_source_make_all
+
+compiler_moc_header_make_all: moc_MyCameraWindow.cpp
+compiler_moc_header_clean:
+ -$(DEL_FILE) moc_MyCameraWindow.cpp
+moc_MyCameraWindow.cpp: QOpenCVWidget.h \
+ MyCameraWindow.h
+ /usr/bin/moc-qt4 $(DEFINES) $(INCPATH) MyCameraWindow.h -o moc_MyCameraWindow.cpp
+
+compiler_rcc_make_all:
+compiler_rcc_clean:
+compiler_image_collection_make_all: qmake_image_collection.cpp
+compiler_image_collection_clean:
+ -$(DEL_FILE) qmake_image_collection.cpp
+compiler_moc_source_make_all:
+compiler_moc_source_clean:
+compiler_uic_make_all:
+compiler_uic_clean:
+compiler_yacc_decl_make_all:
+compiler_yacc_decl_clean:
+compiler_yacc_impl_make_all:
+compiler_yacc_impl_clean:
+compiler_lex_make_all:
+compiler_lex_clean:
+compiler_clean: compiler_moc_header_clean
+
+####### Compile
+
+vision_test.o: vision_test.cpp QOpenCVWidget.h \
+ MyCameraWindow.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o vision_test.o vision_test.cpp
+
+QOpenCVWidget.o: QOpenCVWidget.cpp QOpenCVWidget.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o QOpenCVWidget.o QOpenCVWidget.cpp
+
+MyCameraWindow.o: MyCameraWindow.cpp MyCameraWindow.h \
+ QOpenCVWidget.h
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o MyCameraWindow.o MyCameraWindow.cpp
+
+moc_MyCameraWindow.o: moc_MyCameraWindow.cpp
+ $(CXX) -c $(CXXFLAGS) $(INCPATH) -o moc_MyCameraWindow.o moc_MyCameraWindow.cpp
+
+####### Install
+
+install: FORCE
+
+uninstall: FORCE
+
+FORCE:
+
View
@@ -0,0 +1,19 @@
+#include "MyCameraWindow.h"
+#include "vision.h"
+
+MyCameraWindow::MyCameraWindow(CvCapture * cam, QWidget * parent) : QWidget(parent) {
+ camera = cam;
+ QVBoxLayout * layout = new QVBoxLayout;
+ cvwidget = new QOpenCVWidget(this);
+ layout->addWidget(cvwidget);
+ setLayout(layout);
+ resize(500, 400);
+
+ startTimer(100); // 0.1-second timer
+}
+
+void MyCameraWindow::timerEvent(QTimerEvent *) {
+ IplImage * image = vision_getframe();
+ cvwidget->putImage(image);
+}
+
View
@@ -0,0 +1,26 @@
+#ifndef MYCAMERAWINDOW_H_
+#define MYCAMERAWINDOW_H_
+
+#include <QWidget>
+#include <QVBoxLayout>
+#include "QOpenCVWidget.h"
+#include <opencv/cv.h>
+#include <opencv/highgui.h>
+
+
+class MyCameraWindow : public QWidget
+{
+ Q_OBJECT
+ private:
+ QOpenCVWidget *cvwidget;
+ CvCapture *camera;
+
+ public:
+ MyCameraWindow(CvCapture *cam, QWidget *parent=0);
+
+ protected:
+ void timerEvent(QTimerEvent*);
+};
+
+
+#endif /*MYCAMERAWINDOW_H_*/
View
@@ -0,0 +1,63 @@
+#include <stdio.h>
+#include "QOpenCVWidget.h"
+
+// Constructor
+QOpenCVWidget::QOpenCVWidget(QWidget *parent) : QWidget(parent) {
+ layout = new QVBoxLayout;
+ imagelabel = new QLabel;
+ QImage dummy(100,100,QImage::Format_RGB32);
+ image = dummy;
+ layout->addWidget(imagelabel);
+ for (int x = 0; x < 100; x ++) {
+ for (int y =0; y < 100; y++) {
+ image.setPixel(x,y,qRgb(x, y, y));
+ }
+ }
+ imagelabel->setPixmap(QPixmap::fromImage(image));
+
+ setLayout(layout);
+}
+
+QOpenCVWidget::~QOpenCVWidget(void) {
+
+}
+
+void QOpenCVWidget::putImage(IplImage *cvimage) {
+ int cvIndex, cvLineStart;
+ // switch between bit depths
+ switch (cvimage->depth) {
+ case IPL_DEPTH_8U:
+ switch (cvimage->nChannels) {
+ case 3:
+ if ( (cvimage->width != image.width()) || (cvimage->height != image.height()) ) {
+ QImage temp(cvimage->width, cvimage->height, QImage::Format_RGB32);
+ image = temp;
+ }
+ cvIndex = 0; cvLineStart = 0;
+ for (int y = 0; y < cvimage->height; y++) {
+ unsigned char red,green,blue;
+ cvIndex = cvLineStart;
+ for (int x = 0; x < cvimage->width; x++) {
+ // DO it
+ red = cvimage->imageData[cvIndex+2];
+ green = cvimage->imageData[cvIndex+1];
+ blue = cvimage->imageData[cvIndex+0];
+
+ image.setPixel(x,y,qRgb(red, green, blue));
+ cvIndex += 3;
+ }
+ cvLineStart += cvimage->widthStep;
+ }
+ break;
+ default:
+ printf("This number of channels is not supported\n");
+ break;
+ }
+ break;
+ default:
+ printf("This type of IplImage is not implemented in QOpenCVWidget\n");
+ break;
+ }
+ imagelabel->setPixmap(QPixmap::fromImage(image));
+}
+
View
@@ -0,0 +1,25 @@
+
+#ifndef QOPENCVWIDGET_H
+#define QOPENCVWIDGET_H
+
+#include <opencv/cv.h>
+#include <QPixmap>
+#include <QLabel>
+#include <QWidget>
+#include <QVBoxLayout>
+#include <QImage>
+
+class QOpenCVWidget : public QWidget {
+ private:
+ QLabel *imagelabel;
+ QVBoxLayout *layout;
+
+ QImage image;
+
+ public:
+ QOpenCVWidget(QWidget *parent = 0);
+ ~QOpenCVWidget(void);
+ void putImage(IplImage *);
+};
+
+#endif
View
@@ -0,0 +1,12 @@
+######################################################################
+# Automatically generated by qmake (2.01a) Tue Jul 8 19:59:30 2008
+######################################################################
+
+TEMPLATE = app
+TARGET =
+DEPENDPATH += .
+LIBS += -lcv -lhighgui
+
+SOURCES += vision_test.cpp QOpenCVWidget.cpp MyCameraWindow.cpp
+HEADERS += QOpenCVWidget.cpp MyCameraWindow.h vision.h vision.cpp
+
View
@@ -7,6 +7,10 @@ robot_test: robot_test.o robot.o delay.o
robot_cmd: robot_cmd.o robot.o delay.o cbuffer.o
gcc robot_cmd.c robot.c delay.c cbuffer.c -o robot_cmd -lpthread
+vision_test:
+ qmake -o qmakefile QtOpenCV.pro
+ make -f qmakefile
+
robot.o: robot.c delay.o
gcc -c robot.c delay.c
Oops, something went wrong. Retry.

0 comments on commit 669a9fe

Please sign in to comment.