0
@@ -2,76 +2,76 @@ from opencv import *
0
from opencv.highgui import *
0
- def __init__(self, name="Main Window"):
0
- def show(self, image):
0
- cvShowImage(self.name, image.image)
0
- cvDestroyWindow(self.name)
0
+ def __init__(self, name="Main Window"):
0
+ def show(self, image):
0
+ cvShowImage(self.name, image.image)
0
+ cvDestroyWindow(self.name)
0
- def __init__(self, id):
0
- self.capture = cvCreateCameraCapture(id)
0
- return Image(cvQueryFrame(self.capture))
0
+ def __init__(self, id):
0
+ self.capture = cvCreateCameraCapture(id)
0
+ return Image(cvQueryFrame(self.capture))
0
- def __init__(self, image):
0
- self.size = cvSize(image.width, image.height)
0
- if self and self.image:
0
- cvReleaseImage(self.image)
0
- def grayscale(self, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvCvtColor(self.image, result, CV_RGB2GRAY)
0
+ def __init__(self, image):
0
+ self.size = cvSize(image.width, image.height)
0
+ if self and self.image:
0
+ cvReleaseImage(self.image)
0
+ def grayscale(self, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvCvtColor(self.image, result, CV_RGB2GRAY)
0
- def threshold(self, threshold, max_value=255, mode=CV_THRESH_BINARY, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvThreshold(self.image, result, threshold, 255, mode)
0
- def add(self, anotherImage, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvAdd(self.image, anotherImage, result)
0
+ def threshold(self, threshold, max_value=255, mode=CV_THRESH_BINARY, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvThreshold(self.image, result, threshold, 255, mode)
0
+ def add(self, anotherImage, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvAdd(self.image, anotherImage, result)
0
- def sub(self, anotherImage, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvSub(self.image, anotherImage.image, result)
0
+ def sub(self, anotherImage, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvSub(self.image, anotherImage.image, result)
0
- def xor(self, anotherImage, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvXor(self.image, anotherImage, result)
0
- def _and(self, anotherImage, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvAnd(self.image, anotherImage, result)
0
- def _not(self, channels=1):
0
- result = cvCreateImage(self.size, self.image.depth, channels)
0
- cvNot(self.image, result)
0
+ def xor(self, anotherImage, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvXor(self.image, anotherImage, result)
0
- def invert(self, channels=1):
0
- return self._not(channels)
0
- def nand(self, anotherImage, channels=1):
0
- return self._not(self.image)._and(anotherImage)
0
+ def _and(self, anotherImage, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvAnd(self.image, anotherImage, result)
0
- return cvWaitKey(10) == '\x1b'
0
+ def _not(self, channels=1):
0
+ result = cvCreateImage(self.size, self.image.depth, channels)
0
+ cvNot(self.image, result)
0
+ def invert(self, channels=1):
0
+ return self._not(channels)
0
+ def nand(self, anotherImage, channels=1):
0
+ return self._not(self.image)._and(anotherImage)
0
+def getKeyPressed(wait=10):
0
+ return cvWaitKey(wait)
Comments
No one has commented yet.