projects
/
ozzloy@gmail.com
/
oble
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
21323a9
)
making separate IplImage to hold mirrored image. this avoids flickering
author
ozzloy
<ozzloy+github_com@gmail.com>
Mon, 9 Feb 2009 09:09:37 +0000
(
01:09
-0800)
committer
ozzloy
<ozzloy+github_com@gmail.com>
Mon, 9 Feb 2009 09:09:37 +0000
(
01:09
-0800)
hello-world.cpp
patch
|
blob
|
blame
|
history
diff --git
a/hello-world.cpp
b/hello-world.cpp
index 62f59fa2a662fffb3a09193c689893676b839684..f72a54794ea3459eabd8484a439bef71d1f8507d 100644
(file)
--- a/
hello-world.cpp
+++ b/
hello-world.cpp
@@
-21,6
+21,9
@@
#include <highgui.h>
#include <stdio.h>
#include <highgui.h>
#include <stdio.h>
+// argument for cvFlip(src, dest, FLIP_TYPE)
+#define VERTICAL_FLIP 1
+
CvHaarClassifierCascade* load_object_detector(const char* cascade_path)
{
return (CvHaarClassifierCascade*)cvLoad(cascade_path);
CvHaarClassifierCascade* load_object_detector(const char* cascade_path)
{
return (CvHaarClassifierCascade*)cvLoad(cascade_path);
@@
-80,10
+83,18
@@
int main(int argc, char** argv)
// Create a window in which the captured images will be presented
cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);
// Create a window in which the captured images will be presented
cvNamedWindow("mywindow", CV_WINDOW_AUTOSIZE);
+ IplImage* frame = cvQueryFrame(capture);
+ if(!frame) {
+ fprintf(stderr, "ERROR: frame is null...\n");
+ getchar();
+ return -1;
+ }
+ IplImage* flipped =
+ cvCreateImage(cvGetSize(frame), frame->depth, frame->nChannels);
// Show the image captured from the camera in the window and repeat
while(1) {
// Get one frame
// Show the image captured from the camera in the window and repeat
while(1) {
// Get one frame
-
IplImage*
frame = cvQueryFrame(capture);
+ frame = cvQueryFrame(capture);
if(!frame) {
fprintf(stderr, "ERROR: frame is null...\n");
getchar();
if(!frame) {
fprintf(stderr, "ERROR: frame is null...\n");
getchar();
@@
-91,10
+102,10
@@
int main(int argc, char** argv)
}
//flip the image so displayed right/left corresponds to physical right/left
}
//flip the image so displayed right/left corresponds to physical right/left
- cvFlip(frame, f
rame, 1
);
+ cvFlip(frame, f
lipped, VERTICAL_FLIP
);
- detect_and_draw_objects(f
rame
, cascade, 1);
- cvShowImage("mywindow", f
rame
);
+ detect_and_draw_objects(f
lipped
, cascade, 1);
+ cvShowImage("mywindow", f
lipped
);
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
// Do not release the frame!
//If ESC key pressed, Key=0x10001B under OpenCV 0.9.7(linux version),
@@
-105,5
+116,6
@@
int main(int argc, char** argv)
// Release the capture device housekeeping
cvReleaseCapture(&capture);
cvDestroyWindow("mywindow");
// Release the capture device housekeeping
cvReleaseCapture(&capture);
cvDestroyWindow("mywindow");
+ cvReleaseImage(&flipped);
return 0;
}
return 0;
}