Home > Back-end >  C builder6 with new OPENCV can use
C builder6 with new OPENCV can use

Time:09-23

Because want to use version 2.4 of OPENCV cascade classifier, but BUILDER supports only 1.0 version of the OPENCV, is there any solution?

CodePudding user response:

OpenCV2.1

Transfer: http://blog.163.com/super_may/blog/static/28544532008101584612266/

C + + Builder to use OpenCV
<1> Transformation of the original.lib file
To establish the following batch file:
Coff2omf - lib: ms lib \ CV lib BCB \ CV lib
Coff2omf - lib: ms lib \ cvaux lib BCB \ cvaux lib
Coff2omf - lib: ms lib \ cvcam lib BCB \ cvcam lib
Coff2omf - lib: ms lib \ cvhaartraining lib BCB \ cvhaartraining lib
Coff2omf - lib: ms lib \ cxcore lib BCB \ cxcore lib
Coff2omf - lib: ms lib \ CXTS lib BCB \ CXTS lib
Coff2omf - lib: ms lib \ highgui lib BCB \ highgui lib
Coff2omf - lib: ms lib \ ml lib BCB \ ml lib

<2> OPENCV in WINDOWS system variable to add for X: \ \ Program Files \ OPENCV, add the search path X: \ \ Program Files \ OPENCV \ bin
<3> CB IDE Settings "tool" - & gt;" Environment variables "- & gt;" Library "in the" library path "add
Tools - & gt; The Options - & gt; The Environment Options - & gt; C + + Options Paths and Directories to add (CB2007)
$(OPENCV) \ BCB; $(OPENCV) \ bin

<4> Create a new console project C, don't support the VCL, and then select "project" - & gt;" Added to the project, "translate just good. The lib files are added to the project,
In the inside of the Directories/Conditonals Include Path to add
$(OPENCV), CV and include; $(OPENCV) \ cxcore \ include; $(OPENCV) \ otherlibs \ highgui;
$(OPENCV) \ cvaux \ include; $(OPENCV) \ otherlibs \ cvcam \ include
OpenCV2.0 only a directory $(OPENCV)/include/OPENCV

In the Library Path to add $(OPENCV) \ BCB
General Compilation of the Calling Convention is changed to C
Add SKIP_INCLUDES Conditional Defines


<5> Edit your code, and add the corresponding LIB files, debugging allowed:

Example application:
Read Lena. JPG image and display:
-- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
#include
#include
#include
#include

# pragma comment (lib, "CV. Lib")
# pragma comment (lib, "cxcore. Lib")
# pragma comment (lib, "highgui. Lib")

Int main (int arg c, char * argv [])
{
Img=cvLoadImage IplImage * (" Lena. JPG ");
CvNamedWindow (" Image ", 1);
CvShowImage (" Image ", img);

CvWaitKey ();
CvDestroyWindow (" Image ");
CvReleaseImage (& amp; Img);

return 0;
}

1, OpenCV2.1 CMAKE2.8 as VS2005 configure, in VS2005 compiler to generate libraries success;
2, use COFF2OMF convert the OpenCV library;
3, add the OpenCV CB2007 include path, lib path;
4, modify highgui. J h, the file about the New interface finally part # include "highgui. HPP," under the CB2007 if contains the highgui HPP will compile failure, in fact is not needed, so the following revision (add two lines of conditional statements, if is the CB environment does not contain) :
The # include "highgui. HPP, modification for the following
# # ifndef __BORLANDC__
# include "highgui. HPP
"# endif
5, new construction in CB2007, # include & lt; CV. H> #include , other what all don't write;
6, in the Project - & gt; Conditional Paths of the Options and Defines Options add SKIP_INCLUDES and Defines _FM_NO_REMAP, when adding the Build Configuration advised to choose a Base;
7, CB2007 compile Error: [BCC32 Error] complex (194) : E2316 '_fm_atan2l' is not a member of 'STD'
Modify fastmath. H file

Began to change for the

# ifdef __cplusplus
The namespace STD {
# endif
# ifdef __cplusplus
Extern "C" {
# endif

End is modified to

# ifdef __cplusplus
}//extern
}//STD
# endif


Note: cannot be used in the BCB cvGetSize, oneself write a cvGetSize function instead of OpenCV libraries will go wrong cvGetSize function
The function of writing refer to http://www.opencv.org.cn/index.php/BCB%E4%B8%AD%E4%BD%BF%E7%94%A8OpenCV
Replace the reason please refer to http://www.opencv.org.cn/forum/viewtopic.php? F=1 & amp; T=3424 & amp; P=34604 & amp; Hilit=bcb# p34604
Now I have a preliminary tests pass,

The support of OpenCV2.1 under CBXE

CBXE coff2omf can't use, will go wrong, but you can use RAD2007,

CodePudding user response:

reference 1st floor u010165006 response:

of OpenCV2.1
Transfer: http://blog.163.com/super_may/blog/static/28544532008101584612266/

C + + Builder to use OpenCV
<1> Transformation of the original.lib file
To establish the following batch file:
Coff2omf - lib: ms lib \ CV lib BCB \ CV lib
Coff2omf - lib: ms lib \ cvaux lib BCB \ cvaux lib
Coff2omf - lib: ms lib \ cvcam lib BCB \ cvcam lib
Coff2omf - lib: ms lib \ cvhaartraining lib BCB \ cvhaartraining lib
Coff2omf - lib: ms lib \ cxcore lib BCB \ cxcore lib
Coff2omf - lib: ms lib \ CXTS lib BCB \ CXTS lib
Coff2omf - lib: ms lib \ highgui lib BCB \ highgui lib
Coff2omf - lib: ms lib \ ml lib BCB \ ml lib

<2> OPENCV in WINDOWS system variable to add for X: \ \ Program Files \ OPENCV, add the search path X: \ \ Program Files \ OPENCV \ bin
<3> CB IDE Settings "tool" - & gt;" Environment variables "- & gt;" Library "in the" library path "add
Tools - & gt; The Options - & gt; The Environment Options - & gt; C + + Options Paths and Directories to add (CB2007)
$(OPENCV) \ BCB; $(OPENCV) \ bin

<4> Create a new console project C, don't support the VCL, and then select "project" - & gt;" Added to the project, "translate just good. The lib files are added to the project,
In the inside of the Directories/Conditonals Include Path to add
$(OPENCV), CV and include; $(OPENCV) \ cxcore \ include; $(OPENCV) \ otherlibs \ highgui;
$(OPENCV) \ cvaux \ include; $(OPENCV) \ otherlibs \ cvcam \ include
OpenCV2.0 only a directory $(OPENCV)/include/OPENCV

nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  • Related