D-Alex / ropencv

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

HOG descriptor #17

Closed ahsandar closed 10 years ago

ahsandar commented 10 years ago

Can we have an example of how to use HogDescriptor in ropencv, as it seems in opencv hog.setSVMDetector takes HOGDescriptor::getDefaultPeopleDetector() as an argument

while in ropencv the wrappers for HOGDescriptor::getDefaultPeopleDetector() returns Std::Vector::Float while hog.setSVMDetector expects Cv::Mat

D-Alex commented 10 years ago

The HOGDescriptor getting wrapped is the one from opencv2/objedetect which has this strange behaviour. Unfortunately, there no build in conversion to convert from std::vector to cv::Mat on the ruby side. I pushed a fix to master but you can also do the conversion by yourself via:

  vec = std::Vector.new(FLOAT)
  mat = Cv::Mat.new(vec.size,1,Cv::CV_32FC1,vec.data,Cv::Mat::AUTO_STEP)
ahsandar commented 10 years ago

Thanks , but can you add an example of Hog descriptor to the Git will be really helpful, cheers