KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I installed opencv from Macports and it is in /opt/local/include I tried to compile basic OPENCV code from Terminal by giving the following commands, but it doesn't getting compiled: g++ example.cpp -o example -I /usr/local/include/opencv/ -L /usr/local/lib/ -lopencv_highgui -lopencv_calib3d -lopencv_legacy g++ example.cpp -o example -I /opt/local/include/opencv/ -L /opt/local/lib/ -lopencv_highgui -lopencv_calib3d -lopencv_legacy Can anyone tell me the right Terminal command to compile given below opencv program for Mac OS X 10,7? I was trying to compile the simple example given on this link: http://www.cs.iit.edu/~agam/cs512/lect-notes/opencv-intro/ Edit: Here is the code I am trying to compile: //////////////////////////////////////////////////////////////////////// // // hello-world.cpp // // This is a simple, introductory OpenCV program. The program reads an // image from a file, inverts it, and displays the result. // //////////////////////////////////////////////////////////////////////// #include <stdlib.h> #include <stdio.h> #include <math.h> #include <cv.h> #include <highgui.h> int main(int argc, char *argv[]) { IplImage* img = 0; int height,width,step,channels; uchar *data; int i,j,k; if(argc<2){ printf("Usage: main <image-file-name>\n\7"); exit(0); } // load an image img=cvLoadImage(argv[1]); if(!img){ printf("Could not load image file: %s\n",argv[1]); exit(0); } // get the image data height = img->height; width = img->width; step = img->widthStep; channels = img->nChannels; data = (uchar *)img->imageData; printf("Processing a %dx%d image with %d channels\n",height,width,channels); // create a window cvNamedWindo
Tags (comma-separated)
Save Edits
Cancel