If you have questions, skim through the comments because many people have posted their solutions. Unfortunately, it’s been a long time since I looked into OpenCV so I don’t remember the details anymore. Please read before commenting: Hey guys – thanks a lot for all the comments on this thread. On that note, here is a good OpenCV Tutorial.Įdit: Oops, looks like that link is dead now. Hopefully, this helps save you some time. If it’s not, leave a comment below with the error you get and I’ll try looking into it for you. Remember to free image memory after using it!Īnd there you go. If( !cvSaveImage("my_image_copy.png", pInpImg) )įprintf(stderr, "failed to write image file\n") Write the image to a file with a different name,
PInpImg = cvLoadImage("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED) įprintf(stderr, "failed to load input image\n") Load an image from file - change this based on your image name
Example showing how to read and write images This is where the header files for OpenCV were built.
This will go fetch cmake and its dependencies and install them onto your system.
Unzip it after you download it into a folder. You can check to see if it installed successfully by opening your terminal and typing port. Also you will need XCode installed for any of this to work (but you knew that, right?) Also, I tested this on OSX Lion, but it should apply to Snow Leopard or Leopard. Note: This method does not set up the Python bindings for OpenCV (still working on that). Now that I’ve got it set up, I decided to write this little post to explain to others how to go about setting it up. There are various ways to install it – through package managers such as Homebrew or Macports, or through the tarball + cmake. I had to look through a whole bunch of different sites to figure out what to do. I’m using OpenCV for my 4th year design project and setting it up was a huge pain.