Up | OpenCV 2.3 | OpenCV 2.2 | OpenCV 1.1

 

  

 
OpenCV 1.1

Requirements to use OpenCV with Scorpion 8

To use OpenCV in Scorpion Vision you must follow the Python 2.6 installation guide.

OpenCV 1.1 setup

There are some additional requirements for OpenCV 1.1

OcvImage - Scorpion helper class to use OpenCV 1.1

The OcvImage python module is located here for OpenCV 1.1

Sample profiles with OpenCV 1.1

Example 1 (OpenCV 1.1): ScriptTool cvAdaptiveThreshold

from OcvImage import OcvImage
import ctypes_opencv

objectImage = OcvImage(GetTool(GetCurSource()).imageNo)
object = objectImage.GetCvImage()

try:
  #Example of a useful transform - adaptive threshold
  #cvAdaptiveThreshold(im,im2,max_value,adaptive_method,threshold_type,block_size,offset)
  #apply to OpenCV image, can be done in place
  ctypes_opencv.cvAdaptiveThreshold(object,object,125,ctypes_opencv.CV_ADAPTIVE_THRESH_MEAN_C,ctypes_opencv.CV_THRESH_BINARY_INV,7,10)

  #can apply morphology if desired,
  # - again safe to do in place or could make second image
  ctypes_opencv.cvDilate(object,object,None,1)

  # ctypes_opencv.cvErode(object,object,None,2)

  OcvImage().Assign(object, "Output")
except Exception, msg:
  print msg

Example 2 (OpenCV 1.1): Adding Canny Filter

#the script reside inside a Scorpion ScriptTool
from OcvImage import OcvImage
import ctypes_opencv

objectImage = OcvImage(GetTool(GetCurSource()).imageNo)
object = objectImage.GetCvImage()

try:
  ctypes_opencv.cvCanny(object, object,40, 60,3)
  OcvImage().Assign(object, "Output")
except Exception, msg:
  print msg

Scorpion Vision Version XII : Build 646 - Date: 20170225
Scorpion Vision Software® is a registered trademark of Tordivel AS.
Copyright © 2000 - 2017 Tordivel AS.