Someone tried OpenCV (Computer Vision Library) with Servoy?

Questions and answers on developing, deploying and using plugins and JavaBeans

Someone tried OpenCV (Computer Vision Library) with Servoy?

Postby ProRM » Sat Mar 16, 2019 9:43 pm

Hi,

Someone ever tried to use OpenCV in Servoy? OpenCV is an Open Source Computer Vision Library to recognize forms, colors, faces and more. It is written in C/C++ but has C++, Python and Java interfaces. We have two project that need different types of image recognition and if we can not use Servoy we should go with Python.

Regards
User avatar
ProRM
 
Posts: 63
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby sean » Mon Mar 18, 2019 3:14 pm

Hi Juan,

Anything with a Java interface should be usable in Servoy. Do you have the library as .jar files ?
Placing them in the /application_server/beans folder should make them accessible. You can call the classes directly from javascript editor (You even get code complete!)

Code: Select all
Packages.<my-package>.<my-class>

i.e.
Code: Select all
var thing = new Packages.com.uraburu.MyClass(someArg);
Software Engineer
Servoy USA
sean
 
Posts: 153
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby ProRM » Tue Mar 19, 2019 2:58 am

Hi Master Sean,

Attached please find opencv-401.jar. The installation also contains two folders x86 and x64 including the corresponding dll file as OpenCV is built in C/C++. I copied the jar and both folders into beans folder. I am trying to figure out what the name of the Package is.

Regards!
Attachments
opencv-401.jar
(452.21 KiB) Downloaded 2 times
User avatar
ProRM
 
Posts: 63
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby sean » Tue Mar 19, 2019 4:24 am

Hi Juan,

Do you have documentation or examples? (There are probably a lot of packages and classes in the jar file)
Something like this ?
https://opencv-java-tutorials.readthedo ... pencv.html
Software Engineer
Servoy USA
sean
 
Posts: 153
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby ProRM » Wed Mar 20, 2019 2:57 pm

User avatar
ProRM
 
Posts: 63
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby sean » Thu Mar 21, 2019 5:06 pm

Hi Juan,

You have to translate it into javascript wrappers which is not as hard as it sounds. And the process is the same for anybody who wants to call Java from Servoy.

1. You see the import statements at the top of the java example - those give you the java package names.
You must use these package names when you reference a class from the library, i.e.
Code: Select all
import org.opencv.core.Point


2. Whenever a java class is referenced you will use the fully qualified class name, including Packages.<package-name>.<class-name>, i.e.
Code: Select all
Point
becomes
Code: Select all
Packages.org.opencv.core.Point


3. Java requires that variables are declared with the class/type, i.e.
Code: Select all
String foo = "bar"

becomes
Code: Select all
var foo = "bar"


For example from your library:
Code: Select all
Point pt = new Point();
pt.x = 10;
pt.y = 8;


becomes:
Code: Select all
var pt = new Packages.org.opencv.core.Point();
pt.x = 10;
pt.y = 8;


hope this helps.

Best,
Sean
Software Engineer
Servoy USA
sean
 
Posts: 153
Joined: Mon May 21, 2007 6:26 pm
Location: USA

Re: Someone tried OpenCV (Computer Vision Library) with Serv

Postby ProRM » Wed Apr 03, 2019 5:04 am

You are the one Sean (and you know it!)
User avatar
ProRM
 
Posts: 63
Joined: Thu Sep 18, 2008 10:24 pm
Location: Uruguay


Return to Plugins and Beans

Who is online

Users browsing this forum: No registered users and 5 guests