Jump to content
Compvision.ru
Smorodov

Opencv 2.3.2 + C++Builder XE2

Recommended Posts

Моя очередная химерка :)

post-1-0-43182300-1327572588_thumb.png

BCB_OpenCV.rar

Инструкции и пример проекта внутри.

UPD:

патч на opencv.org: http://code.opencv.org/issues/2057

  • Like 1

Share this post


Link to post
Share on other sites

А можете выложить так же архив с dll-ками для этих заголовочных файлов?

Share this post


Link to post
Share on other sites

Hello Smorodov,

I want to use OpenCV with C++BuilderXE.

I do not speak any Russian.

As far as I understand you use opencv with c + + BuilderXE2.

Can you give any hints?

Kinds regrads,

Oliver

Share this post


Link to post
Share on other sites

Hello Oliver,

There is a set of necessary files above (in post #1 and #3).

In post #1:

There are fixed headers , and conveterd for builder .lib files in archive.

But it'll be better if you make them by yourself from original .lib files contained in your opencv distribution using LibConverter.exe utility.

There are also very basic project for builder which you can use as template.

For compiling project without any changes in library and headers paths it will be better to put it (include, libs, modules) to folder C:\BCB_OpenCV.

And there is some strange thing: some dll files need to be renamed to something like .dl or .d. Compiled program will prompt you about it.

Arhive in post #3 contains DLL - libraries for appropriate .lib's from previous post.

Put DLL's to EXE's folder, or add to PATH DLL's folder.

In general case, you must use libraries and dll's from the same build.

Try to run it, and ask in case of any problems.

Share this post


Link to post
Share on other sites

Hello Smorodov.First of all thanks for these files.

I downloaded your project and I tried it in my c + + builder 2010, but without success. Could you help me? We'll describe below what I did:

- I created the folder c: \ bcb_opencv

- I started C + + Builder and I have created and saved a new project

- I added in the form a panel and a button

- I added to the header, the header by adding the lines:

# define _STLP_NO_CSTD_FUNCTION_IMPORTS

# define _FM_NO_REMAP

# include "opencv2/opencv.hpp"

- I have added to the project path includes C: \ bcb_opencv \ BCB_OpenCV \ include

- I copied the folder in the folder opencv2 the includes located in the module folder

Finally, I compiled the program but I get the following errors and warnings:

[bCC32 Error] operations.hpp(188): E2015 Ambiguity between 'std::abs(int) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:142' and 'std::abs(__int64) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:541'

[bCC32 Error] operations.hpp(189): E2015 Ambiguity between 'std::abs(int) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:142' and 'std::abs(__int64) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:541'

[bCC32 Error] operations.hpp(1011): E2015 Ambiguity between 'std::abs(int) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:142' and 'std::abs(__int64) at c:\program files (x86)\embarcadero\rad studio\7.0\include\stdlib.h:541'

[bCC32 Error] operations.hpp(1966): E2034 Cannot convert 'const Point2f' to 'CvPoint2D32f'

[bCC32 Error] operations.hpp(1966): E2034 Cannot convert 'const Size2f' to 'CvSize2D32f'

[bCC32 Warning] ml.hpp(990): W8022 'CvForestTree::train(CvDTreeTrainData *,const CvMat *,CvRTrees *)' hides virtual function 'CvDTree::train(CvMLData *,CvDTreeParams)'

[bCC32 Warning] ml.hpp(990): W8022 'CvForestTree::train(CvDTreeTrainData *,const CvMat *,CvRTrees *)' hides virtual function 'CvDTree::train(const cv::Mat &,int,const cv::Mat &,const cv::Mat &,const cv::Mat &,const cv::Mat &,const cv::Mat &,CvDTreeParams)'

[bCC32 Warning] ml.hpp(1195): W8022 'CvBoostTree::train(CvDTreeTrainData *,const CvMat *,CvBoost *)' hides virtual function 'CvDTree::train(CvMLData *,CvDTreeParams)'

[bCC32 Warning] ml.hpp(1195): W8022 'CvBoostTree::train(CvDTreeTrainData *,const CvMat *,CvBoost *)' hides virtual function 'CvDTree::train(const cv::Mat &,int,const cv::Mat &,const cv::Mat &,const cv::Mat &,const cv::Mat &,const cv::Mat &,CvDTreeParams)'

any ideas to solve these problems?

thanks in advance

TheFonzy

Share this post


Link to post
Share on other sites

You can try this way:

1) All

abs(val)
change to
abs((int)val)
(first 3 errors) 2) and in file operations.hpp string number 1966 I think you need componentwise assignment something like this:
CvBox2D box; box.center.x = center.x;box.center.y = center.y;
box.size.x = size.x;box.size.y = size.y; box.angle = angle;[/code]

Share this post


Link to post
Share on other sites

Hello Smorodov , thanks for your answer. I write the solution I adopted, it could help someone.

For the first 3 errors the problem is that they refer to functions that return a float:

fast_abs inline float (float v) {return std :: abs (v);}

and a cast to int could cause problems: I solved it:

fast_abs inline float (float v) {if (v> 0) return (v) else return - (v);}

For the second type of error your advice was excellent, with a slight modification:

RotatedRect CvBox2D Inline :: operator () const

{

CvBox2D box;

box.center.x = center.x;

box.center.y = center.y;

box.size.width = Size.Width;

box.size.height = Size.Height;

box.angle = angle;

return box;

}

Thanks again

  • Like 1

Share this post


Link to post
Share on other sites

Nooo!

Smorodov Please, help me once again

Now the program compiles but does not start. I added your files. Lib to the project and copied your dll inthe folder of the executable (as well as in system and system32), but the application does not start and I will return to the IDE C ++. Any suggestions?

thanks in advance

Share this post


Link to post
Share on other sites

Try to run it from outside IDE.

I think, that it need some additional dll's.

When you start it outside ide, program will prompt you the names of dll's it need.

(it may need to cut dll's extension to .dl or .d)

You can also use dependency walker

PS: it also need microsoft redistributables. You can download it from microsoft site.

Share this post


Link to post
Share on other sites

great advice!

I discovered that some dll extension should be renamed (dl instead of dll ... strange, but ok)

and I miss the library cudart32_40_17.dll.

I have a Cuda, I have to install something else? and if I had a cuda, I could use OpenCV?

thanks Smorodov, u are great!

Share this post


Link to post
Share on other sites

cudart32_40_17.dll - file from NVIDIA GPU COMPUTING TOOLKIT (CUDA 4.0, not the latest one)

if you want use another version of cuda (or turn it off), you have to rebuild opencv libraries by yourself with microsoft visual studio.

and then convert .lib files as I describe above.

Share this post


Link to post
Share on other sites

Hello Smorodov.

Your test software works great.

Now I'm trying to read a video (for now .avi, then switch to a .flv). I used a very simple code:

cv :: VideoCapture * capture;

/ / ------------------------------------------------ ---------------------------

__fastcall TForm1 :: TForm1 (TComponent * Owner)

: TForm (Owner)

{

capture = new cv :: VideoCapture (".. / bike.avi");

}

but the compiler gives me error links:

[iLINK32 Error] Error: Unresolved external 'cv :: ~ :: VideoCapture VideoCapture ()' referenced from D: \ DESKTOP \ OpenCV \ videotest \ DEBUG \ MAIN.OBJ

[iLINK32 Error] Error: Unresolved external 'cv :: fastFree (void *)' referenced from D: \ DESKTOP \ OpenCV \ videotest \ DEBUG \ MAIN.OBJ

[iLINK32 Error] Error: Unresolved external ':: cv :: VideoCapture VideoCapture (std :: basic_string <char, std :: char_traits <char>, std :: allocator <char>> &)' referenced from D: \ DESKTOP \ OpenCV \ videotest \ DEBUG \ MAIN.OBJ

could you tell me what could be the problem?

thanks in advance

Share this post


Link to post
Share on other sites

I still use C interface:

in my example from the first topic file change

capture=cvCaptureFromCAM(0);
to
capture=cvCaptureFromAVI("your_avi_filename.avi");
or
capture=cvCaptureFromFile("your_flv_filename.flv");

Share this post


Link to post
Share on other sites

works well, but it's too fast. You know a way to synchronize the frames at the frame rate? and plays the audio track of the movie? I would like to make a video player with features traking

Share this post


Link to post
Share on other sites

you can use multimedia timer event for syncronisation.

Share this post


Link to post
Share on other sites

check links from this topic:

http://www.compvision.ru/forum/index.php?showtopic=802

there are some general things.

and msdn: multimedia timers

I usualy use WinAPI timers. As far as I know, audio playng not supported by opencv. But You can use portaudio library or something similar.

Share this post


Link to post
Share on other sites

Не хотел я этого, ну да ладно :)

DLL-Debug

DLL-Release

Thank you very much for dlls, libs and example project. I now can finally run OpenCV2.3.1 in XE2!

Could you please help me resolve one more problem?

When I create a simple Project, do all the includes, set the path etc. and try to do the following:

cv::Mat m(10,10,CV_8UC1);

I get the following errors:

[iLINK32 Error] Error: Unresolved external 'cv::Mat::deallocate()' referenced from ...

[iLINK32 Error] Error: Unresolved external 'cv::fastFree(void *)' referenced from ...

[iLINK32 Error] Error: Unresolved external 'cv::Mat::create(int, const int *, int)' ...

I included all the .lib files you provided. Are there any other libs I need to have to use cv::Mat class?

Share this post


Link to post
Share on other sites

First try use something like this:

I get it from:

http://www.codeproject.com/Questions/63421/OpenCV-2-0-with-Visual-Studio-C-2008

#pragma comment (lib, "opencv_core232.lib")
...
...
[/code]

I have not installed Builder XE2 in my system now.

In my current projects I use MSVC.

I include in archive above all .lib files I found.

It may be some incompatibilities with versions files in archive from 2.3.2, but you write that you use 2.3.1.

Try to convert .lib files from 2.3.1 (with libconvert tool from archive) or build your own version by provided instructions.

PS: As I can see from post #14 there is some problems with c++ interface in Builder,

I have not used C++ in builder. It may be need more adaptation, I suspect some problems with naming conventions.

Share this post


Link to post
Share on other sites

[...] run OpenCV2.3.1 in XE2! [...]

I meant 2.3.2 - my mistake.

Thank you for your help. I'll get back to you as soon as I resolve the problem.

Share this post


Link to post
Share on other sites

Доброго времени суток! У меня следующий вопрос - у меня Builder(правда 6) ругается на один из заголовочных файлов, пришедший с OpenCV. А именно : он говорит, что отсутствует #endif. Попытки проследить вручную, какой именно блок условной компиляции не закрыт, оказываются тщетными, есть ли в Buildere возможность автоматически проследить какие места из файла он компилирует?

Так же я спокойно пользуюсь этой библиотекой в MS Studio. Мне очень нужно построить проект именно в Builder, так как именно здесь у меня все сделано для Direct3D и считывания с камеры. Помогите мне пожалуйста. А то делать "скрутку" между VS и Builder не хочется совсем :-((

Share this post


Link to post
Share on other sites

Поставьте версию opencv1pre1 под нее полно примеров на форуме (есть и заголовочники и либы и проекты).

Или удалите вручную все участки условной компиляции из файла с ошибками, которые не относятся к Вашей конфигурации проекта.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


  • Recently Browsing   0 members

    No registered users viewing this page.

×