Vehicle and other objects in HOGDescriptor [closed]

asked 2015-04-24 07:24:43 -0500

jacktrades gravatar image


In OpenCV cheat sheet, it describes HOGDescriptor as algorithm for detecting people, cars and other objects with well-defined silhouettes.

Using HOGDescriptors to detect people using the "setSVMDetector(HOGDescriptor.getDefaultPeopleDetector())", works fine.

I want to expand this to detect vehicles... Is there a way to download a trained SVM detector, or I have to train it myself? Can I train it in java?

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by sturkmen
close date 2020-10-07 13:07:59.896439


You will indeed need to train the model yourself, which is quite complex due to the underdeveloped SVM module. Only the hogdescriptor for pedestrians is available hardcoded in OpenCV. An example on how to train a HOG model can be found here or here. There is even an official OpenCV sample on this.

StevenPuttemans gravatar imageStevenPuttemans ( 2015-04-24 07:32:17 -0500 )edit
  • "can i train it in java ?" - unfortunately not so easily. you can compute the hog features, and also train the svm, but the final descriptor is a binary serialized svm, made from the support vectors and rho (see line 24 of the sample) and you can't get this data directly in java.
berak gravatar imageberak ( 2015-04-25 11:35:51 -0500 )edit