D-Alex / ropencv

ffi ruby wrapper for opencv
Other
67 stars 14 forks source link

trackbar not wrapped? #40

Open nurettin opened 8 years ago

nurettin commented 8 years ago

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 ?

yduf commented 7 years ago

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 ?

yduf commented 7 years ago

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")