opencv in lazaus lazarus / 39-Graphics ---------------------------------------------------------------------- podak · 2010-06-25 04:28 hi , it' s my first post in this forum Someone know if exists any pascal unit or lazarus lcl with the same (or similar) function of the opencv library for the c/c++ language??? Sorry for my bad english but I' m an Italian student ---------------------------------------------------------------------- podak · 2010-06-25 05:09 searching on the net i found this package of component for delphi http://www.mitov.com/html/visionlab.html  ....can I use them in lazarus too? How? ---------------------------------------------------------------------- theo · 2010-06-25 05:19 What about this? http://code.google.com/p/opencvdelphi/source/browse/#svn/trunk/opencvd elphi%3Fstate%3Dclosed I looks a bit abandoned and it's for Delphi, but maybe you can make it work for lazarus. ---------------------------------------------------------------------- marcov · 2010-07-05 11:56 The guy from Mitov has FPC/Lazarus experience. One could simply ask him. ---------------------------------------------------------------------- avra · 2012-08-08 23:28 C DLL seams to be deprecated by dev team and lacks modern features from C++ version. Too bad that www.swig.org doesn't support Pascal). Maybe wrapping OpenCvSharpExtern.dll which supports latest OpenCV features might be the solution? Can someone tell me if using a wrapper DLL intended for C# can be used for FreePascal too (of course by building an appropriate wrapper)? Quote===== OpenCvSharpExtern.dll ===== OpenCvSharpExtern.dll is not .NET binary but native binary. This is to invoke C++ functions and classes from managed code. When you use Blob, MachineLearning, and CPlusPlus namespaces, you need to put a OpenCvSharpExtern.dll into the executable directory (ex. bin/Debug). The standard OpenCvSharpExtern.dll is compiled by VS2008. When you yourself compile OpenCV's DLLs by VS2010  use an alternative DLL which is in the "OpenCvSharpExtern.dll built by VC++2010" directory instead. https://code.google.com/p/opencvsharp/source/browse/#svn%2Ftrunk%2F2.4 %2FOpenCvSharpExtern https://opencvsharp.googlecode.com/files/OpenCvSharp-2.4-x86- 20120801.zip https://opencvsharp.googlecode.com/files/OpenCvSharp-2.4-x64- 20120801.zip ---------------------------------------------------------------------- BigChimp · 2012-08-11 10:41 Quote from: avra on August 09, 2012, 01:28:20 amC DLL seams to be deprecated by dev team and lacks modern features from C++ version. Too bad that www.swig.org doesn't support Pascal). Maybe wrapping OpenCvSharpExtern.dll which supports latest OpenCV features might be the solution? Can someone tell me if using a wrapper DLL intended for C# can be used for FreePascal too (of course by building an appropriate wrapper)? I suspect a C# wrapper would not work for FreePascal... As for swig: apparently somebody has at least written an ObjectPascal implementation but that was not committed to swig trunk: see one of the answers here: http://stackoverflow.com/questions/2559995/create-an-instance-of-an- exported-c-class-from-delphi Haven't ever used swig, but having an ObjectPascal implementation might be very, very useful... ---------------------------------------------------------------------- avra · 2012-08-15 17:36 Quote from: BigChimp on August 11, 2012, 12:41:53 pmQuote from: avra on August 09, 2012, 01:28:20 amC DLL seams to be deprecated by dev team and lacks modern features from C++ version. Too bad that www.swig.org doesn't support Pascal). Maybe wrapping OpenCvSharpExtern.dll which supports latest OpenCV features might be the solution? Can someone tell me if using a wrapper DLL intended for C# can be used for FreePascal too (of course by building an appropriate wrapper)? I suspect a C# wrapper would not work for FreePascal... That one is not a standard C# wrapper. Read the quote: QuoteOpenCvSharpExtern.dll is not .NET binary but native binary. This is to invoke C++ functions and classes from managed code. When you use Blob, MachineLearning, and CPlusPlus namespaces, you need to put a OpenCvSharpExtern.dll into the executable directory (ex. bin/Debug). The standard OpenCvSharpExtern.dll is compiled by VS2008. I am not an expert but at first sight this looks doable for Pascal wrapper around it since C++ seams already wrapped: https://code.google.com/p/opencvsharp/source/browse/trunk/2.4/OpenCvSh arpExtern/CvBoost.h ---------------------------------------------------------------------- marcov · 2012-08-15 19:13 I'm a bit curious about this. I have translated code of opencv several times, and nearly always they were littered with templates. ---------------------------------------------------------------------- BigChimp · 2012-08-15 20:00 Quote from: avra on August 15, 2012, 07:36:15 pmQuote from: BigChimp on August 11, 2012, 12:41:53 pmQuote from: avra on August 09, 2012, 01:28:20 amC DLL seams to be deprecated by dev team and lacks modern features from C++ version. Too bad that www.swig.org doesn't support Pascal). Maybe wrapping OpenCvSharpExtern.dll which supports latest OpenCV features might be the solution? Can someone tell me if using a wrapper DLL intended for C# can be used for FreePascal too (of course by building an appropriate wrapper)? I suspect a C# wrapper would not work for FreePascal... That one is not a standard C# wrapper. Read the quote: QuoteOpenCvSharpExtern.dll is not .NET binary but native binary. This is to invoke C++ functions and classes from managed code. When you use Blob, MachineLearning, and CPlusPlus namespaces, you need to put a OpenCvSharpExtern.dll into the executable directory (ex. bin/Debug). The standard OpenCvSharpExtern.dll is compiled by VS2008. I am not an expert but at first sight this looks doable for Pascal wrapper around it since C++ seams already wrapped: https://code.google.com/p/opencvsharp/source/browse/trunk/2.4/OpenCvSh arpExtern/CvBoost.h Neither am I an expert, but wouldn't it still be C++ code then with objects etc? Apparently these can't be used by FPC/Delphi directly; you'd have to have a procedural interface (like C code). Of course, it could be procedural code that just happens to compile with C... in which case we'd be lucky... Who knows. I'd still love a swig port though - apparently that allows you to just import C++ code as objects into FPC/Delphi.... ---------------------------------------------------------------------- sergioantonio · 2012-10-19 08:45 I like pascal, algorithms in pascal are more readable than its equivalent in other languages. I program in pascal for fun. obviously its a c/c++ world. but why do bindings or use some dll written in C, why not implement a pure pascal version of openCV. cant be that hard. Sergio www.dominicanvoice.com ---------------------------------------------------------------------- BigChimp · 2012-10-19 09:20 @sergio: would you also rewrite an FPC .dll/.so/.dylib? If so, why or why not? I'd rather build on proven code than repeat work that's already been done.... but if you want to, go ahead, I can find a use for a native FPC opencv equivalent! ---------------------------------------------------------------------- sergioantonio · 2012-10-19 09:31 I assumed that opencvsharpextern.dll was written in something other than pascal, are you saying its a fpc dll? I'll google it. if your are always doing wrappers around libraries written in c, instead of porting to pascal. then why just not forget about pascal and code using gcc. allot more code out there for c anyway. again, I assumed that opencvsharpextern.dll was not written in pascal. I did not read all the post above. Sergio www.dominicanvoice.com ---------------------------------------------------------------------- sergioantonio · 2012-10-19 09:41 first search I did for OpenCvSharp in google says its a wrapper written in C#. again, just me. but why use pascal at all, just use C then gcc is free anyway. just my way of thinking. as to building on proven code. porting the code instead of building wrappers, the result is the same, since the original code is open source porting it should not be that hard. and the benefit would be the write once compile anyway concept. you want to to run in all the platform supported by freepascal, then just recompile. you wont have to worry about wrapper for all these platform. Sergio www.dominicanvoice.com ---------------------------------------------------------------------- BigChimp · 2012-10-19 10:17 @Sergio: you didn't get my point about FPC dlls. My point was that using dlls can be useful whatever language they're written in as long as they're good. I disagree that porting code to FPC results in the same result. It's still a rewrite which takes time and effort and can (probably will) lead to bugs. Even if it is a perfect translation of the original, you'd have to keep up with bug fixes and new functionality etc, or in effect fork your code. The amount of people working on your FPC fork will probably be lower than those working on the original. So you lose a lot of advantages. ---------------------------------------------------------------------- anis2505 · 2012-10-19 11:08 Hi, A Freepascal OpenCV version would be a great thing Even Python's OpenCV binding is based on these c++ dll it's just interacting with these dlls. So we need a Freepascal developper to make such binding. Honestly I only succeeded to make opencv works with Visual Studio 2010 c++ ---------------------------------------------------------------------- sergioantonio · 2012-11-09 17:20 @BigChimp: its actually not that difficult to do a port, I write compilers often, and you can automate most of the process of converting C code to pascal. by building a compiler that instead of taking the C code and producing assembly code will produce pascal code. I've actually done this with some open source c code and have had not problems. in fact after the conversion to pascal from C, when I compile the pascal source code and use the strip.exe, I often get more compact executable than the original C code. the point: the conversion process of OpenCV to pascal can be automated, and again once you have the pascal version, you get all the benefits of just recompiling the code to all the platforms supported by FPC. its probably just my way of thinking, but I also think one of the reasons why the C type languages are more popular than pascal is because there is just allot of open source C code available.   having as much open source projects available in native pascal not only give you the write once compile anywhere benefit, but I will also let people known that hey, the pascal programming language is all you need for you programming projects, and you will probably recruit back some programmers to pascal. but then  again its just my way of thinking. Sergio www.dominicanvoice.com ---------------------------------------------------------------------- ludob · 2012-11-10 06:09 Quote from: sergioantonio on November 09, 2012, 06:20:19 pm@BigChimp: its actually not that difficult to do a port, I write compilers often, and you can automate most of the process of converting C code to pascal. by building a compiler that instead of taking the C code and producing assembly code will produce pascal code. I've actually done this with some open source c code and have had not problems. in fact after the conversion to pascal from C, when I compile the pascal source code and use the strip.exe, I often get more compact executable than the original C code. Finally! The man the FPC community has been waiting for all this time has surfaced. Converting automatically C code to Pascal has been many FPC developer's wet dream for ages. The only thing missing now is that you share your C to FPC converter which I guess is no problem since it was so easy to do. AFAIK all open source C compilers are GPL'ed so according to the licence all code derived from it should be published anyways once you talk publicly about it. Thanks in advance! ---------------------------------------------------------------------- avra · 2013-04-08 10:58 I have just bumped into FreePascal OpenCV headers that I would like to share with everyone: http://gidesa.altervista.org/camshiftdemo.php ---------------------------------------------------------------------- avra · 2013-06-08 20:54 There is another new Delphi wrapper for OpenCV 2.4.5 https://github.com/Laex/Delphi-OpenCV ---------------------------------------------------------------------- sergioantonio2013 · 2013-10-20 14:38 this is for ludob: I´m going to say something that is probably not going to be very popular. but, although freepascal is free and lazarus is also free. we programmers make a living programming. so, you say finally, someone who can build a program that takes C code and converts it to pascal. why dont you do share the code. the answer, because I dont program for free. I can absolutly build a compiler that will take any C or C++application and convert it object pascal code that can be compiled with freepascal and lazarus. however, I still dont see any benefits to doing something for free. sorry. if anyone is willing to pay for me to build it, I will gladdly do it. and I really dont understand why other programmer think its so hard. by the way i´m the same sergio Fernandez as above I´m just  logging  from a different acount. Sergio Fernandez www.facebook.com/sergio.fernandez.756