Ask Your Question

How to make reusable code for multiplatform projects (iOS)

asked 2015-02-06 05:38:18 -0500

LivingSparks gravatar image

Hi i'm trying to write some opencv class code reusable on different platform. I followed this guide and actually managed to get my project work.

BUT Now I am to trying to integrate other classes from an external projects and I'm full of these kinds of errors.

cv::remap(src,dst,_mapx,_mapy,CV_INTER_LINEAR); return;

Use of undeclared identifier 'CV_INTER_LINEAR'; did you mean 'cv::INTER_LINEAR'?


if(var < 1.0e-10)vec_ = cvScalar(0); else vec_ /= sqrt(var);

Use of undeclared identifier 'cvScalar'

if I "translate" the whole class with cv :: Scalar or cv::INTER_LINEAR everything continues to run. But these are classes and projects that are compiled into other systems.

Do not want to re-translate everything.

Where am I doing wrong in this integration? I'm working in iOS environment.

thanks in advance

edit retag flag offensive close merge delete



OpenCV is going to pass to the C++ version, so no more C stuffs, like CV_SOETHING and CvClass or cvFunction, so it si better to do the changes now than later. The C version is deprecated

thdrksdfthmn gravatar imagethdrksdfthmn ( 2015-02-06 06:22:39 -0500 )edit

"I'm working in iOS environment."

it's not related to that (for a change...)

also, please, don't follow guides from 2011...

"Now I am to trying to integrate other classes from an external project "

if they're full of outdated constructs, clear sign that they're badly (or not at all) maintained. be sceptic of that.

like said above, do a big cleanup, and remove all outdated c-api things.

berak gravatar imageberak ( 2015-02-06 06:37:07 -0500 )edit

Thank You! What I did not understand, my ignorance, was that outdated constructs came from C!

LivingSparks gravatar imageLivingSparks ( 2015-02-06 08:38:48 -0500 )edit

Is there a better "Updated" way than this to make the integration of cross-platform code with iOS?

LivingSparks gravatar imageLivingSparks ( 2015-02-06 08:40:06 -0500 )edit

1 answer

Sort by ยป oldest newest most voted

answered 2015-02-06 08:08:18 -0500

AlexanderShishkov gravatar image

Firstly please don't use C interface in iOS environment. C++ environment is more convenient.

It is possible to use C interface. Please add more headers with _c appendix:

#include "opencv2/imgproc/types_c.h" 
#include "opencv2/imgproc/impgroc_c.h"

Recommended way is to use the following header:

#ifdef __cplusplus
#include <opencv2 opencv.hpp="">
edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2015-02-06 05:38:18 -0500

Seen: 136 times

Last updated: Feb 06 '15