D-Alex / ropencv

ffi ruby wrapper for opencv

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

trackbar not wrapped?

nurettin opened this issue · comments

Hi, this is a great tool for teaching. Thanks for that.

I am unable to find a way to access the gui trackbar, is there a function for that? If not, how can I implement it ?

commented

I am encountering the same issue:
in gems/ropencv-0.0.21/lib/ropencv/ropencv_types.rb
I can see get_trackbar_pos and set_trackbar_pos but not createTrackbar.
An issue with rbind filtering it based upon callback type ?

From the documentation it seems that none of this pointer are required, so in the end if it wasn't filtered, it could perhaps still be useful using get_trackbar_pos to get the value.

Is there any easy way to not filter it ?

commented

A workaround, to access the createTrasckbar function, by calling it trhough ffi;

require 'ffi'
module OpenCV
  extend FFI::Library
  ffi_lib 'libopencv_highgui.so'
  attach_function :cvCreateTrackbar, :cvCreateTrackbar,[ :string, :string, :pointer, :int, :pointer ], :int
end

Then it can be used as described above:

cv::namedWindow("LLines", 1);
cvCreateTrackbar( "trackbarname", "LLines", valuep = nil, count = 200, onChange=nil)
value = cv::getTrackbarPos( "trackbarname", "LLines")