Mercurial Hosting > traffic-intelligence
changeset 8:59b7e3954178
renaming and added make clean
author | Nicolas Saunier <nico@confins.net> |
---|---|
date | Sat, 07 Nov 2009 23:33:51 -0500 |
parents | ffddccfab7f9 |
children | eb38637f338d |
files | Makefile c/Makefile c/main.cpp c/test-pixels.cpp |
diffstat | 4 files changed, 58 insertions(+), 48 deletions(-) [+] |
line wrap: on
line diff
--- a/Makefile Thu Nov 05 17:17:20 2009 -0500 +++ b/Makefile Sat Nov 07 23:33:51 2009 -0500 @@ -3,4 +3,7 @@ INCLUDE=./include clibrary: - @cd $(PWD)/c && make \ No newline at end of file + @cd $(PWD)/c && make + +clean: + @cd $(PWD)/c && make clean \ No newline at end of file
--- a/c/Makefile Thu Nov 05 17:17:20 2009 -0500 +++ b/c/Makefile Sat Nov 07 23:33:51 2009 -0500 @@ -16,7 +16,7 @@ endif ifeq ($(UNAME), Linux) - LINUX_BOOST_PREFIX = /usr/local + LINUX_BOOST_PREFIX = /usr/local CFLAGS += -DLINUX EXE_EXTENSION='' else # windows @@ -38,10 +38,17 @@ CXXFLAGS = $(INCLUDE) $(CFLAGS) +default: all builddir -default: main.o -# @echo "default" +all: test-pixels + +builddir: @createdirectory.sh $(BUILD_DIR) - $(CXX) $(CFLAGS) $(LIBS) $^ -o $(BUILD_DIR)/test-pixels $(LDFLAGS) -# $(CXX) $(CFLAGS) $(LIBS) $^ -o $(BUILD_DIR)/$@ $(LDFLAGS) \ No newline at end of file +test-pixels: test-pixels.o + $(CXX) $(CFLAGS) $(LIBS) $^ -o $(BUILD_DIR)/test-pixels $(LDFLAGS) +# $(CXX) $(CFLAGS) $(LIBS) $^ -o $(BUILD_DIR)/$@ $(LDFLAGS) + +clean: + rm -f *.gch */*.o *.o *.a $(BUILD_DIR)/* +# $(DISTFILE_OUTPUT)
--- a/c/main.cpp Thu Nov 05 17:17:20 2009 -0500 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,42 +0,0 @@ -#include "opencv/cv.h" -#include "opencv/highgui.h" - -#include <iostream> - -using namespace std; - -IplImage* allocateImage(const CvSize& size, const int& depth, const int& channels) { - IplImage* image = cvCreateImage(size, depth, channels); - - if (!image) { - cerr << "Error: Couldn't allocate image. Out of memory?\n" << endl; - exit(-1); - } - - return image; -} - -int main(int argc, char *argv[]) { - //cout << "Hello World" << endl; - - CvCapture *inputVideo = cvCaptureFromFile(argv[1]); - - IplImage* frame = cvQueryFrame(inputVideo); - IplImage* bwFrame = allocateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 1); - - int frameNum = 0; - while (frame) { - if (frameNum%10 == 0) - cout << frameNum << endl; - cvConvertImage(frame, bwFrame); - - for (int i=0; i<frame->height; ++i) - for (int j=0; j<frame->width; ++j) - int gray = cvGetReal2D(bwFrame, i, j); - - frame = cvQueryFrame(inputVideo); - frameNum++; - } - - return 1; -}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/c/test-pixels.cpp Sat Nov 07 23:33:51 2009 -0500 @@ -0,0 +1,42 @@ +#include "opencv/cv.h" +#include "opencv/highgui.h" + +#include <iostream> + +using namespace std; + +IplImage* allocateImage(const CvSize& size, const int& depth, const int& channels) { + IplImage* image = cvCreateImage(size, depth, channels); + + if (!image) { + cerr << "Error: Couldn't allocate image. Out of memory?\n" << endl; + exit(-1); + } + + return image; +} + +int main(int argc, char *argv[]) { + //cout << "Hello World" << endl; + + CvCapture *inputVideo = cvCaptureFromFile(argv[1]); + + IplImage* frame = cvQueryFrame(inputVideo); + IplImage* bwFrame = allocateImage(cvSize(frame->width, frame->height), IPL_DEPTH_8U, 1); + + int frameNum = 0; + while (frame) { + if (frameNum%10 == 0) + cout << frameNum << endl; + cvConvertImage(frame, bwFrame); + + for (int i=0; i<frame->height; ++i) + for (int j=0; j<frame->width; ++j) + int gray = cvGetReal2D(bwFrame, i, j); + + frame = cvQueryFrame(inputVideo); + frameNum++; + } + + return 1; +}