I'm stuck badly in the code given below....i need to apply guassain filter in my results for good video result ?

asked 2016-10-07 14:15:08 -0600

updated 2020-09-22 14:00:40 -0600

import cv2

def inside(r, q): rx, ry, rw, rh = r qx, qy, qw, qh = q return rx > qx and ry > qy and rx + rw < qx + qw and ry + rh < qy + qh

def draw_detections(img, rects, thickness = 1): for x, y, w, h in rects: # the HOG detector returns slightly larger rectangles than the real objects. # so we slightly shrink the rectangles to get a nicer output. pad_w, pad_h = int(0.15w), int(0.05h) cv2.rectangle(img, (x+pad_w, y+pad_h), (x+w-pad_w, y+h-pad_h), (0, 255, 0), thickness)

if __name__ == '__main__':

optical flow algorithm

hog = cv2.HOGDescriptor()
hog.setSVMDetector( cv2.HOGDescriptor_getDefaultPeopleDetector() )
cap=cv2.VideoCapture(0)
while True:
    _,frame=cap.read()
    found,w=hog.detectMultiScale(frame, winStride=(8,8), padding=(32,32), scale=(1.05))
    draw_detections(frame,found)
    cv2.imshow('feed',frame)
    ch = 0xFF & cv2.waitKey(1)
    if ch == 27:
        break
cv2.destroyAllWindows()
edit retag flag offensive close merge delete

Comments

1

hog != optical flow. (it seems, you blindly c/p code snippets)

berak gravatar imageberak ( 2016-10-07 14:54:25 -0600 )edit

no i cant understand why my code is diviided into optical flow alo.

Huzaifa007 gravatar imageHuzaifa007 ( 2016-10-07 16:02:48 -0600 )edit
1

there is no optical flow in your code.

berak gravatar imageberak ( 2016-10-07 16:34:21 -0600 )edit

let's not talk about your current code - what are you trying to achieve ?

berak gravatar imageberak ( 2016-10-08 00:17:10 -0600 )edit

kindly give me your email id so that i can take help from you ... i shall be very thankful to you.

Huzaifa007 gravatar imageHuzaifa007 ( 2016-10-08 07:30:30 -0600 )edit

sorry, but no, let's keep it on this site.

again, what are you trying to do ?

berak gravatar imageberak ( 2016-10-08 07:37:47 -0600 )edit

ok umm im trying to detect the people and for this reson i want clear result for which i have to go for guasssain filter....which is making me a problem....secondly in some people i want to detect specfic people on the baises of people clothes colour.

Huzaifa007 gravatar imageHuzaifa007 ( 2016-10-08 11:53:18 -0600 )edit
  1. yes, maybe a bit of blurring helps
  2. hog works on grayscale, (basically, it's some sort of edge/orientation filter) it can never determine colours. - if that's your objective - again, you're doing it wrong entirely.
berak gravatar imageberak ( 2016-10-08 12:08:26 -0600 )edit

thanks for your useless help

Huzaifa007 gravatar imageHuzaifa007 ( 2016-10-11 05:12:10 -0600 )edit