0

I am developing a solution using a comercial computer vision software called Halcon. I am thinking on migrating or convert my solution to OpenCV in Python. I will like to start developing my other computer vision solution in Halcon because the IDE is incredible, and them generate a script to migrate them to OpenCV.

Does anyone know any library for this task?

I will like to start developing an open source SDK to convert Halcon to OpenCV. I and thinking to start developing all internal function from Halcon to Python. Any advice?

Aitul
  • 2,982
  • 2
  • 24
  • 52
  • 1
    If you want to know `How OpenCV-Python bindings are generated? How to extend new OpenCV modules to Python?` Then refer to this link https://docs.opencv.org/3.0-beta/doc/py_tutorials/py_bindings/py_bindings_basics/py_bindings_basics.html – Kinght 金 Jan 10 '18 at 14:25
  • No, I want to migrate my Halcon program to OpenCV. – Aitul Jan 10 '18 at 14:32
  • 1
    Define your `migrate`. Generally write ones' code by the format of the line, then put them into the contrib directory, add some cmake file, re-cmake. – Kinght 金 Jan 10 '18 at 14:46
  • I do not know if "migrate" is a good word for my question, I think that convert or translate could be better. I have a code written in Halcon. I need to convert to OpenCV. – Aitul Jan 10 '18 at 15:16
  • 1
    Halcon has a lot of functions that can be made with OpenCV, but are not done (high level ones) the other ones that can be done have a lot of parameters possible that may be hard to figure out which ones are used by halcon (unless they have the same arguments), anyway I think it is quite a hard task to do an automatic tool for it. (both libraries are huge) and AFAIK there is none available :( – api55 Jan 11 '18 at 12:24

3 Answers3

5

I wouldn't invest time in such an effort. These are some reasons:

  • For simple functions (blur, erode, dilate) Halcon and OpenCV have different implementations of the same function and probably you will have slightly different outputs (one may round up and the other round down, for example). A complex program that runs properly in Halcon may fail in OpenCV for these small differences (a butterfly effect).

  • Probably there are complex functions (pattern matching algorithms, deep learning), that exist in one environment and don't exist in the other.

  • OpenCV users typically don't have Halcon IDE. I like OpenCV because it is open source and free, I won't consider using Halcon IDE because it is not. Moreover OpenCV has many functions and it improves very fast (I don't know Halcon). If Halcon was much better than OpenCV (more popular, faster, cross platform, with all OpenCV functions implemented in Halcon) and my project had the money, I would use Halcon IDE for development and I would use it in production as well (and completely ignore OpenCV). In either case, I wouldn't use a tool that converts one to the other. It is like writing the Linux kernel with Visual Studio, maybe someone does it, but I guess it is not the majority.

If I had to spend time in an open source project, I would write a better OpenCV interface (as Vladimir Perković suggests). There are some efforts in that direction (probably there is something else if you search):

user2518618
  • 1,360
  • 13
  • 32
2

It depends on which Halcon functionalities are you using and why you want to do it. The question appears to be very general. I would recommend you to convert your Halcon Program to C++ and write a wrapper function to pass arguments to/from your openCV program.This would be the simplest option to provide interaction between your opencv and halcon program. Hope it helps.

Robionic
  • 315
  • 4
  • 14
  • Yes, I was thinking to to something in that way. I know that it is almost impossible to develop something to work in an "automatic" way, but I think that wit the general functions it can be possible. – Aitul Jan 17 '18 at 16:04
2

This is unfortunately not possible because Halcon itself is not an open source library and every single function is locked.

The reason behind is runtime licencing.

Vladimir Perković
  • 1,351
  • 3
  • 12
  • 30
  • I am not agree with you, there are some function that are very general. Some filter as Gauss or Sobel and simple thresholding functions are easy to migrate with different parameters. – Aitul Jan 17 '18 at 16:07
  • 2
    Of course, but you would have to write very extensive test with random data for each function, which would prove that your function delivers same output with the same input. What would be the point? Wouldn't it be easier to create better user interface for OpenCV? – Vladimir Perković Jan 17 '18 at 16:20
  • The idea behind their function may be the same. But the algorithms they use could be completely different. Halcon uses its patent algorithms to achieve a better and faster ouput. And that's why they take your money. – joe Apr 27 '18 at 01:47