Today I found an easy way to start using OpenCV in Blender without any (manual) compilation steps. The easiest way is with pip, which you can install on Blender's bundled python according to these instructions. Note that you do need to install Numpy on the bundled python first. This is probably avoidable through some changes to the build phase but since everything works it doesn't bother me too much. It works, although there's a warning about a missing camera file libdc1394 error: Failed to initialize libdc1394. Ln -s /usr/local/lib/python3.4/dist-packages/ cv2.so cd /opt/blender/2.78/python/lib/python3.5/site-packages I later had to create a symlink to the cv2.so file from the first (standard) compilation directory to the bundled python's include library. D PYTHON_NUMPY_INCLUDE_DIR=/opt/blender/2.78/python/lib/python3.5/site-packages/numpy/core/include \ D PYTHON_PACKAGES_PATH=/opt/blender/2.78/python/lib/python3.5/site-packages \ D PYTHON_LIBRARY=/opt/blender/2.78/python/lib/python3.5 \ D PYTHON_INCLUDE=/opt/blender/2.78/python/include \ D PYTHON_EXECUTABLE=/opt/blender/2.78/python/bin/python3.5m \ D CMAKE_INSTALL_PREFIX=/opt/blender/2.78/python \ In the 2nd compilation, I used the following cmake configuration (build) command, which pointed out to the correct blender installation dir on this machine and the respective bundled python libraries and binaries: cmake -D CMAKE_BUILD_TYPE=RELEASE \ The first time I compiled it to the locally installed python 3 exactly according to instructions. I compiled openCV according to these instructions ( and these ones) with some changes: To get this to work on an Ubuntu 16.04.1 machine with Blender 2.78, Anyway if anyone has got this working or has made more progress than me it would be great to hear from you. Also I wondering why both blender and opencv rely on libgcc_s.so, is it something to do with pthreads?. So I am a bit out of ideas at this point. but both cv2.so and the blender binary seem to use the same. This is the log file if run using LD_DEBUG=files blender -python script.py > blender.log 2>&1 as I saw on another link about segfaults in blender that I have now lostģ2577: opening file=/lib/x86_64-linux-gnu/libgcc_s.so.1 direct_opencount=2Īfter reading and I wrote a little python script to diff the output of ldd for both the cv2.so and the blender binary to see if I could see any miss matched shared libraries. Then blender immediately segfaults and dumps a crash report file with the following backtraceīlender(BLI_system_backtrace+0x30) The following executes without error python3 -c "import cv2 cv2.imread('img.png')"īut if I enter the same thing into the blender python console, or call it from within a script and run that script using blender -python I have installed opencv with the python 3 cv2 library. I am trying to use the python opencv (cv2) module from within blender to do some image processing on a texture. I am using stock Ubuntu 16.04, blender 2.76 install.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |