android - How can i improve openCV people detecting algorithm -
i trying write human detector, works now, reacts on cats/boxes etc., got 5 fps. question is, how can improve algorithm better fps , detection accuracy.
i have tried use one: http://www.pyimagesearch.com/2015/11/09/pedestrian-detection-opencv/
but couldnt find way use on android.
public mat oncameraframe(cvcameraviewframe inputframe) { list<matofpoint> list = new arraylist<>(); mat frame = new mat(); mat gray = new mat(); mat hierarchy = new mat(); mat originalframe = inputframe.rgba(); imgproc.medianblur(originalframe,originalframe,3); imgproc.cvtcolor(originalframe, gray, imgproc.color_rgb2gray, 0); hogdescriptor hog = new hogdescriptor(); //Получаем стандартный определитель людей и устанавливаем его нашему дескриптору matoffloat descriptors = hogdescriptor.getdefaultpeopledetector(); hog.setsvmdetector(descriptors); matofrect locations = new matofrect(); matofdouble weights = new matofdouble(); hog.detectmultiscale(gray, locations, weights); point rectpoint1 = new point(); point rectpoint2 = new point(); point fontpoint = new point(); if (locations.rows() > 0) { list<rect> rectangles = locations.tolist(); (rect rect : rectangles) { rectpoint1.x = rect.x; rectpoint1.y = rect.y; fontpoint.x = rect.x; fontpoint.y = rect.y - 4; rectpoint2.x = rect.x + rect.width; rectpoint2.y = rect.y + rect.height; final scalar rectcolor = new scalar( 0 , 0 , 0 ); // Добавляем на изображения найденную информацию imgproc.rectangle(originalframe, rectpoint1, rectpoint2, rectcolor, 2); } } frame.release(); gray.release(); hierarchy.release(); list.clear(); return originalframe; }
you're using hog+svm approach detect people; inherently going quite slow. never less, can use of suggestions in question how speed svm.predict?
depending on problem, i.e. if camera static , pedestrians moving opt background subtraction approach efficient way bear in mind pick objects moving in scene, include thresholds remove small objects. background subtraction algorithms include mixture of gaussian (mog) or mog2 or gmg. also, important thing note these approaches rely on creating background model of scene, i.e. assume static pixels on time part of background, hence, when pedestrian stands still while in scene embedded background resulting in miss detection. there many papers out there provide potential solutions problem might want have @ them, here 1 produces decent results: static , moving object detection using flux tensor split gaussian models
additionally, opt data driven approach, either pre-trained model , detection using or train 1 using tensorflow, caffe or torch , use dnn opencv_contrib module detection.
Comments
Post a Comment