[mousetrap/ng] General commit
- From: Flavio Percoco <flaper src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [mousetrap/ng] General commit
- Date: Sat, 2 Jan 2010 09:36:39 +0000 (UTC)
commit 968d4195129aba4586b8dbe369bb948ab5a00c96
Author: Flavio Percoco Premoli <flaper87 gmail com>
Date: Sat Jan 2 11:51:39 2010 +0100
General commit
src/mousetrap/ocvfw/.cproject | 1 +
src/mousetrap/ocvfw/dev/MtpCamera.cpp | 66 +--------------
src/mousetrap/ocvfw/dev/MtpCamera.h | 69 ---------------
src/mousetrap/ocvfw/dev/MtpCapture.cpp | 8 ++
src/mousetrap/ocvfw/dev/MtpCapture.h | 138 ------------------------------
src/mousetrap/ocvfw/dev/PyMtpCapture.cpp | 12 +++
src/mousetrap/ocvfw/dev/setup.py | 27 ------
7 files changed, 22 insertions(+), 299 deletions(-)
---
diff --git a/src/mousetrap/ocvfw/.cproject b/src/mousetrap/ocvfw/.cproject
index db482e3..594272e 100644
--- a/src/mousetrap/ocvfw/.cproject
+++ b/src/mousetrap/ocvfw/.cproject
@@ -35,6 +35,7 @@
<listOptionValue builtIn="false" value="/usr/include/python2.6"/>
<listOptionValue builtIn="false" value="/usr/include/glibmm-2.4"/>
<listOptionValue builtIn="false" value="/usr/include/glib-2.0"/>
+<listOptionValue builtIn="false" value=""${workspace_loc:/ocvfw/include}""/>
</option>
<inputType id="cdt.managedbuild.tool.gnu.c.compiler.input.430443262" superClass="cdt.managedbuild.tool.gnu.c.compiler.input"/>
</tool>
diff --git a/src/mousetrap/ocvfw/dev/MtpCamera.cpp b/src/mousetrap/ocvfw/dev/MtpCamera.cpp
index 1029df4..431ce0c 100644
--- a/src/mousetrap/ocvfw/dev/MtpCamera.cpp
+++ b/src/mousetrap/ocvfw/dev/MtpCamera.cpp
@@ -19,73 +19,9 @@
* along with Ocvfw. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <assert.h>
-#include <math.h>
-#include <float.h>
-#include <limits.h>
-#include <time.h>
-#include <ctype.h>
-#include "cv.h"
-#include "highgui.h"
#include "MtpCamera.h"
-static IplImage * orginalFrame=0;
-IplImage * frame=0;
-IplImage * frame_copy=0;
-/**
- * Image Width of Webcam
- */
-#define IMAGE_WIDTH 320
-/*
- * Image Height of Webcam
- */
-#define IMAGE_HEIGHT 240
-
-MtpCamera::MtpCamera()
-{
-
-}
-
-void MtpCamera::stopCamera()
-{
- if(capture!=0)
- cvReleaseCapture( &capture );
-}
-int MtpCamera::startCamera(int idx)
-{
- capture = cvCaptureFromCAM(idx);
-
- if(capture==0)
- return 0;
- else
- return 1;
-}
-
-IplImage *MtpCamera::queryFrame()
-{
- orginalFrame = cvQueryFrame( capture );
- if (orginalFrame==NULL)
- return 0;
-
- frame = cvCreateImage( cvSize(IMAGE_WIDTH,IMAGE_HEIGHT),IPL_DEPTH_8U, orginalFrame->nChannels );
- cvResize(orginalFrame,frame, CV_INTER_LINEAR);
-
- if ( !frame )
- return 0;
-
- frame_copy = cvCreateImage( cvSize(frame->width,frame->height),IPL_DEPTH_8U, frame->nChannels );
-
- if ( frame->origin == IPL_ORIGIN_TL )
- cvCopy( frame, frame_copy, 0 );
- else
- cvFlip( frame, frame_copy, 0 );
-
- cvReleaseImage(&frame);
-
- return frame_copy;
+MtpCamera::MtpCamera(){
}
diff --git a/src/mousetrap/ocvfw/dev/MtpCapture.cpp b/src/mousetrap/ocvfw/dev/MtpCapture.cpp
index edfe434..42b0714 100644
--- a/src/mousetrap/ocvfw/dev/MtpCapture.cpp
+++ b/src/mousetrap/ocvfw/dev/MtpCapture.cpp
@@ -95,6 +95,14 @@ IplImage *MtpCapture::color(int channel, int new_color, bool copy) {
return tmp;
}
+void MtpCapture::flip(int flip) {
+ if (flip <= 1)
+ cvFlip(this->img, this->img, 1);
+
+ if (flip >= 1)
+ cvFlip(this->img, this->img, 0);
+}
+
IplImage *MtpCapture::resize(int width, int height, bool copy) {
IplImage *tmp;
diff --git a/src/mousetrap/ocvfw/dev/PyMtpCapture.cpp b/src/mousetrap/ocvfw/dev/PyMtpCapture.cpp
index 8ed32a8..c1682a4 100644
--- a/src/mousetrap/ocvfw/dev/PyMtpCapture.cpp
+++ b/src/mousetrap/ocvfw/dev/PyMtpCapture.cpp
@@ -119,6 +119,17 @@ Capture_set_async(Capture *self, PyObject *args, PyObject *keywds) {
}
static PyObject *
+Capture_flip(Capture *self, PyObject *args, PyObject *keywds) {
+ int flip;
+
+ PyArg_ParseTuple(args, "i", &flip);
+
+ cap.flip(flip);
+ return Py_None;
+}
+
+
+static PyObject *
Capture_new(PyTypeObject *type, PyObject *args, PyObject *kwds) {
Capture *self;
self = (Capture *) type->tp_alloc(type, 0);
@@ -148,6 +159,7 @@ static PyMethodDef Capture_methods[] = {
{ "image", (PyCFunction) Capture_image, METH_NOARGS, PyDoc_STR("Returns the current IplDict object.") },
{ "resize", (PyCFunction) Capture_resize, METH_KEYWORDS, PyDoc_STR("Resizes the current image and returns it.") },
{ "rect", (PyCFunction) Capture_rect, METH_KEYWORDS, PyDoc_STR("Returns the required rectangle of the image.") },
+ { "flip", (PyCFunction) Capture_flip, METH_VARARGS, PyDoc_STR("Flips the image") },
{ "color", (PyCFunction) Capture_color, METH_KEYWORDS, PyDoc_STR("Returns the pointer to the converted image.") },
{NULL } /* Sentinel */
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]