Module: CVFFI::IplImageFunctions
- Included in:
- IplImage
- Defined in:
- lib/opencv-ffi-wrappers/core/iplimage.rb
Instance Method Summary collapse
- #clone ⇒ Object
- #ensure_greyscale ⇒ Object (also: #ensure_grayscale)
- #image_size ⇒ Object
- #to_IplImage ⇒ Object
- #twin(*opts) ⇒ Object
Instance Method Details
#clone ⇒ Object
16 17 18 |
# File 'lib/opencv-ffi-wrappers/core/iplimage.rb', line 16 def clone CVFFI::IplImage.new CVFFI::cvCloneImage( self ) end |
#ensure_greyscale ⇒ Object Also known as: ensure_grayscale
33 34 35 36 37 38 39 40 41 |
# File 'lib/opencv-ffi-wrappers/core/iplimage.rb', line 33 def ensure_greyscale return self if nChannels == 1 greyImg = CVFFI::cvCreateImage( CVFFI::CvSize.new( { :height => height, :width => width }), :IPL_DEPTH_8U, 1 ) CVFFI::cvCvtColor( self.to_IplImage, greyImg, :CV_BGR2GRAY ) greyImg end |
#image_size ⇒ Object
8 9 10 |
# File 'lib/opencv-ffi-wrappers/core/iplimage.rb', line 8 def image_size Size.new( self.width, self.height ) end |
#to_IplImage ⇒ Object
12 13 14 |
# File 'lib/opencv-ffi-wrappers/core/iplimage.rb', line 12 def to_IplImage self end |
#twin(*opts) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/opencv-ffi-wrappers/core/iplimage.rb', line 20 def twin( *opts ) depth,nChannels = if opts[0].is_a? Hash opts = opts.pop [opts[:depth], opts[:channels]] else opts end depth ||= self.depth nChannels ||= self.nChannels CVFFI::IplImage.new CVFFI::cvCreateImage( self.image_size.to_CvSize, depth, nChannels ) end |