Install OpenCV python module

Discuss questions and projects related to processing of imaging data here
user-6193
Posts: 5
Joined: Thu Jan 01, 1970 1:00 am

Install OpenCV python module

Post by user-6193 »

Hi,
I'm working on image registration.
I would like to install the OpenCV module to do image processing.
Is it possible ?

Kind regards,
Thomas
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Hi,
OpenCV doesn't work with ironpython, try Emgu CV instead. Emgu CV is a cross platform .Net wrapper to the OpenCV image processing library.

Kind regards
Fredrik Olsson
user-6193
Posts: 5
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6193 »

Thanks for your answer.
I didn't knew it wasn't compatible with ironpython.

I never installed an external module to work with Zen.
All I need to do is download the .exe avaible on their website and install it ?

Kind regards,
Thomas
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Hi,
I have only tried it in an environment not connected to Zen. I think even with Zen you need a to make a separate installation of ironpython. The installation of EmguCv was quite straight forward but then it took some time to get the dependecies right since the ironpython guide referers to an old and obsolete version. You need to add OpenCV x86 and x64 dlls (included in the EmguCV installation) into the folder of the executable. Add reference to your Emgu.CV.World.dll, the full path and also Emgu.CV.UI.dll. Then import Emgu.CV.UI, Emgu.CV and Emgu.CV.Structure.

Kind regards,
Fredrik
user-6193
Posts: 5
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6193 »

Hi,
Thanks for the explanation,
I will try to install it soon.

Kind regards,
Thomas
user-6193
Posts: 5
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6193 »

Hi, thanks to you I managed to install EmguCV

After copying all the dlls (EmguCV + Opencv) in the same folder,

I used the following code to add references to EmguCv dlls and import it :

Code: Select all

import os
import clr
from System import *

#Create the reference to EmguCV
clr.AddReferenceToFileAndPath("D:\\Users\\zeiss\\Desktop\\EmguCv Opencv dlls\\Emgu.CV.World.dll")
clr.AddReferenceToFileAndPath("D:\\Users\\zeiss\\Desktop\\EmguCv Opencv dlls\\Emgu.CV.UI.dll")

#Import Emgu CV
from Emgu.CV import *
from Emgu.CV.UI import *
from Emgu.CV.Structure import *

#Creation of an image to test if EmguCV works well
image = Image[Gray, Byte](640, 480)
image.SetRandNormal(MCvScalar(100), MCvScalar(100))
ImageViewer.Show(image)
user-6033
Posts: 89
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6033 »

Great!

BR
Fredrik
user-3622
Posts: 10
Joined: Thu Jan 01, 1970 1:00 am

import OPen CV - -cool

Post by user-3622 »

Sounds pretty cool,
would this allow to use a lot of cameras with ZEN, which are not supported bei ZEISS MIC?
user-6533
Posts: 1
Joined: Thu Jan 01, 1970 1:00 am

Post by user-6533 »

Thanks for the information.
CarlZeissMicroscopy3
Posts: 180
Joined: Wed May 20, 2020 10:10 am

Re: Install OpenCV python module

Post by CarlZeissMicroscopy3 »

Please also have a look at this contribution concerning OpenCV.

viewtopic.php?t=2993
Post Reply