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 6638405
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T23:25:55+00:00 2026-05-25T23:25:55+00:00

First, I apology for this newbie question. I’m new in Objective C and OpenCV

  • 0

First, I apology for this newbie question. I’m new in Objective C and OpenCV

the normal method declaration in Objective-C is like that

Function functionName = [[Function alloc] init];

but when I use OpenCV class it says (for example CvMat) receiver type is not an Objective C class.

or am I suppose to write the code in C++ syntax ?

  • 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-05-25T23:25:55+00:00Added an answer on May 25, 2026 at 11:25 pm

    You write the code in C++ syntax. Objective-C is actually a superset of C++ which means that any C++ program is also a valid Objective-C program (well in most cases anyway). Objective-C just adds a whole lot of functionality to what already exists in C++.

    When I was developing an openCV app for iOS, here were the main stumbling blocks:

    • Compiling OpenCV as a static library. It’s the only way to use OpenCV in iOS, and is not an easy task if you’ve never done anything similar before. There are a couple of great blog posts about how to do it, such as this one.

    • Armv6 and armv7 – make sure you have static libraries compiled for both (or a universal binary), as iOS runs on both.

    • When you’re coding, just code as you would for c++. Here’s a chunk of example code you can refer to.

      // NOTE you SHOULD cvReleaseImage() for the return value when end of the code.
      - (IplImage *)CreateIplImageFromUIImage:(UIImage *)image {
        // Getting CGImage from UIImage
        CGImageRef imageRef = image.CGImage;
      
        CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
        // Creating temporal IplImage for drawing
        IplImage *iplimage = cvCreateImage(
          cvSize(image.size.width,image.size.height), IPL_DEPTH_8U, 4
        );
        // Creating CGContext for temporal IplImage
        CGContextRef contextRef = CGBitmapContextCreate(
          iplimage->imageData, iplimage->width, iplimage->height,
          iplimage->depth, iplimage->widthStep,
          colorSpace, kCGImageAlphaPremultipliedLast|kCGBitmapByteOrderDefault
        );
        // Drawing CGImage to CGContext
        CGContextDrawImage(
          contextRef,
          CGRectMake(0, 0, image.size.width, image.size.height),
          imageRef
        );
        CGContextRelease(contextRef);
        CGColorSpaceRelease(colorSpace);
      
        // Creating result IplImage
        IplImage *ret = cvCreateImage(cvGetSize(iplimage), IPL_DEPTH_8U, 3);
        cvCvtColor(iplimage, ret, CV_RGBA2BGR);
        cvReleaseImage(&iplimage);
      
        return ret;
      }
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First let me say that I really feel directionless on this question. I am
First off, an apology as I am sure this is question's answer is quite
First of all, I am sorry if this question doesn't belong to SO since
My Question is little bit bigger so apology for that. Now my problem is
First, my question might sound like a duplicate, but I have been going through
First of all, this is not a dupe of this question . You'll see
First of all this is not a question about how can I use http
First up, this might be the wrong place to ask this question.. So, sincere
First off, this is my first project using SQLAlchemy, so I'm still fairly new.
First method $start = microtime(true); // code $end = microtime(true); echo 'This page loaded

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.