OpenCV closes my FreeCAD

Need help, or want to share a macro? Post here!
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
wmayer
Founder
Posts: 20307
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: OpenCV closes my FreeCAD

Post by wmayer »

I had a look to the changelog of OpenCV and it mentions there Qt support of the highgui package
highgui
Experimental Qt backend for OpenCV has been added as a result of GSoC 2010 project, completed by Yannick Verdie. The backend has a few extra features, not present in the other backends, like text rendering using TTF fonts, separate "control panel" with sliders, push-buttons, checkboxes and radio buttons, interactive zooming, panning of the images displayed in highgui windows, "save as" etc. Please, check the youtube videos where Yannick demonstrates the new features: http://www.youtube.com/user/MrFrenchCookie#p/u
The new API is described here: http://opencv.itseez.com/modules/highgu ... tions.html To make use of the new API, you need to have Qt SDK (or libqt4 with development packages) installed on your machine, and build OpenCV with Qt support (pass -DWITH_QT=ON to CMake; watch the output, make sure Qt is used as GUI backend)
16-bit and LZW-compressed TIFFs are now supported.
You can now set the mode for IEEE1394 cameras on Linux.
Unfortunately, removing opencv-highgui without python-opencv is not possible.
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: OpenCV closes my FreeCAD

Post by microelly2 »

wmayer wrote: Unfortunately, removing opencv-highgui without python-opencv is not possible.
We do not realy need cv2 for the shoe project (at the moment), so I have replaced the one method from cv2 by some code. :)
Leatherman
Posts: 155
Joined: Thu Feb 02, 2017 2:49 pm

Re: OpenCV closes my FreeCAD

Post by Leatherman »

Unfortunately, removing opencv-highgui without python-opencv is not possible.
But building FreeCAD around QT5 is still possible isn't it?
Thank you for your advice
Andre
Leatherman
Posts: 155
Joined: Thu Feb 02, 2017 2:49 pm

Re: OpenCV closes my FreeCAD

Post by Leatherman »

wmayer wrote:No it looks you have installed the correct package. But I wonder where is the file cv2.py (or cv2.so) is located. To find this out open a terminal and start python and then enter:

Code: Select all

import cv2
cv2.__file__

Code: Select all

andre@Andre-PC:~$ python
Python 2.7.12 (default, Nov 19 2016, 06:48:10) 
[GCC 5.4.0 20160609] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2.__file__
'/usr/local/lib/python2.7/dist-packages/cv2.so'
>>> 
User avatar
microelly2
Veteran
Posts: 4688
Joined: Tue Nov 12, 2013 4:06 pm
Contact:

Re: OpenCV closes my FreeCAD

Post by microelly2 »

I have installed a newer version of cv2 and it works fine for me:

steps from :
http://docs.opencv.org/2.4/doc/tutorial ... stall.html


1. downloaded: opencv-2.4.13.zip von http://opencv.org/releases.html
2. unzipped to opencv-2.4.13

$ cd opencv-2.4.13
$ mkdir BUILDDIR
$ cd BUILDDIR

$ cmake ..

$ make
# taks some minutes ...
$ sudo make install


$ python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import cv2
>>> cv2
<module 'cv2' from '/usr/local/lib/python2.7/dist-packages/cv2.so'>
>>> cv2.__version__
'2.4.13'

no crash, methods work in FreeCAD.
Leatherman
Posts: 155
Joined: Thu Feb 02, 2017 2:49 pm

Re: OpenCV closes my FreeCAD

Post by Leatherman »

It didn't work for me. Here is the log file from my terminal:

https://www.dropbox.com/s/sqcb8us1htd6s ... lease?dl=0

It shows no errors on installation, but finally with "import CV2" in python, it says no module cv2. Same with FreeCAD (which is certainly the idea of this project here). As a none experienced user, I think it should only my handling error, kindly advice me on this final step.
Regards
Andre
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: OpenCV closes my FreeCAD

Post by looo »

Code: Select all

-- Up-to-date: /usr/local/python/2.7/cv2.so
To me it seems likecv is installed to a wrong location.
Leatherman
Posts: 155
Joined: Thu Feb 02, 2017 2:49 pm

Re: OpenCV closes my FreeCAD

Post by Leatherman »

looo wrote:

Code: Select all

-- Up-to-date: /usr/local/python/2.7/cv2.so
To me it seems likecv is installed to a wrong location.
okay, it says "command not found"
I have never done cmake installation before.


Pls advice,
regards
User avatar
looo
Veteran
Posts: 3941
Joined: Mon Nov 11, 2013 5:29 pm

Re: OpenCV closes my FreeCAD

Post by looo »

What other libraries are installed there?

Code: Select all

ls /usr/local/python/2.7
Also you can show the output of sys.path
In python console:

Code: Select all

import sys
sys.path
Leatherman
Posts: 155
Joined: Thu Feb 02, 2017 2:49 pm

Re: OpenCV closes my FreeCAD

Post by Leatherman »

looo wrote:What other libraries are installed there?

Code: Select all

ls /usr/local/python/2.7

Code: Select all

ls /usr/local/python/2.7
cv2.so
Also you can show the output of sys.path
In python console:

Code: Select all

import sys
sys.path

Code: Select all

import sys
>>> sys.path
['', '/usr/lib/python2.7', '/usr/lib/python2.7/plat-x86_64-linux-gnu', '/usr/lib/python2.7/lib-tk', '/usr/lib/python2.7/lib-old', '/usr/lib/python2.7/lib-dynload', '/usr/local/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages', '/usr/lib/python2.7/dist-packages/PILcompat', '/usr/lib/python2.7/dist-packages/gtk-2.0']
I have to admit that I really don't understand what is going on. May be somebody can make out something out of this.
Regards
Andre
Post Reply