Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8642803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T11:52:19+00:00 2026-06-12T11:52:19+00:00

I think my question is pretty basic. I was trying to get Open CV

  • 0

I think my question is pretty basic. I was trying to get Open CV to install on my OSX Lion. I had followed all the steps recommended on this link http://tilomitra.com/opencv-on-mac-osx/

However, when I run the C++ code recommended on the website in Xcode, it fails to load an image with the cvLoadImage( ) function. I have placed my image in the project folder (as recommended). Here is the code I was running:

// Example showing how to read and write images
#include <opencv2/opencv.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <opencv/cvaux.hpp>

int main(int argc, char** argv)
{
IplImage * pInpImg = 0;

// Load an image from file - change this based on your image name
pInpImg = cvLoadImage("my_image.jpg", CV_LOAD_IMAGE_UNCHANGED);
if(!pInpImg)
{
 fprintf(stderr, "failed to load input image\n");
 return -1;
}

// Write the image to a file with a different name,
// using a different image format -- .png instead of .jpg
if( !cvSaveImage("my_image_copy.png", pInpImg) )
{
 fprintf(stderr, "failed to write image file\n");
}

// Remember to free image memory after using it!
cvReleaseImage(&pInpImg);

return 0;
}

So during execution, the code builds successfully, but always ends up in the following loop and halts execution:

    if(!pInpImg)
{
 fprintf(stderr, "failed to load input image\n");
 return -1;
}

Has anyone faced such a problem before? How could I solve this?

(During installation of ‘Macports’ and ‘Cmake’, I had received an alert saying that Xcode was not installed or was installed without ‘Command Line Tools’. But as per another thread on this forum, I had installed these from the Xcode–>Preferences–>Downloads folder on installing Xcode.
However, still during installation, ‘Macports’ and ‘Cmake’ gave me warnings, but installed anyway. But could this be the issue? )

Thank you!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T11:52:20+00:00Added an answer on June 12, 2026 at 11:52 am

    The problem is that you’re putting the image into the project folder instead of the folder containing your executable. You can either put the image file in the folder with the executable or put the full path to the image in the call to cvLoadImage.

    Older versions of Xcode put the executable in either the build/Debug or build/Release folder in the project folder. Newer versions of Xcode put the build products in the project folder in the DerivedData folder. You can find the DerivedData folder by going to File -> Project Settings… and clicking the arrow next to the folder path:

    DerivedData screenshot

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

(I think this is a pretty basic question on OOP, but unfortunately I wasn't
I think this is a pretty basic question, but after Googling around I can't
I think the question is pretty simple, do I need all the rest of
I think this is a pretty basic question, but here it is anyway. I
I feel like I am asking a pretty basic question, and I think I
I'm afraid this question is pretty basic, but I think it's relevant to a
I think this is a pretty basic question, but I'm finding it hard to
Pretty basic question I think - I'm performing this function: private double convertMetersToFeet(double meters)
I know this is a pretty basic question, and I think I know the
I think this is a pretty basic question. I am currently writing a file

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.