Ask Your Question

HOG descriptor (descripe shape and motion)

asked 2013-04-26 06:39:13 -0500

amira gravatar image

updated 2013-04-26 07:24:57 -0500

can anyone help me please,i use hog descriptor to descripe detected interest poins ,

hog descriptor steps:

  • take image and compute gradient of graysacle input image
  • then descripe it

How can i update it to compute HOF (histogram of optical flow)??

As the ouput of optical flow is gradient magnitudes from optical flow fields , so really i compute gradient for optical flow, so i don't need to compute gradient again in embeded code of HOG

keypoints = cv.FAST(im,'Threshold',30,'NonMaxSupression',1);
hog = cv.HOGDescriptor('WinSize',[16,16],'BlockSize',[8,8],'BlockStride',[4,4],'CellSize',[4,4] );
descriptors = hog.compute(im, 'Locations', {});

first shape decriptor

prevIm = cv.cvtColor(imread('test\img1.jpeg'),'RGB2GRAY');
nextIm = cv.cvtColor(imread('test\img2.jpeg'),'RGB2GRAY');
flow = cv.calcOpticalFlowFarneback(prevIm, nextIm);

magnitudeImage   = (Fx.^2 + Fy.^2 ).^0.5;
descriptors2 = hog.compute(im2uint8(magnitudeImage) , 'Locations', {});???????????/is this true

second motion descriptor

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2013-04-26 07:28:46 -0500

I think you are mixing up both concepts.

HOG is a descriptor that uses the gradient image of a single frame. Optical flow uses also the gradient images, but it calculates a relation between the gradients in subsequent frames to give a flow of motion. The output is NOT the same as needed for the HOG descriptor, I would not mix them up.

edit flag offensive delete link more


thanks for ur reply but i know the difference between but i want to implement HoF descriptor using implemented code of hog descriptor function but with different input parameter so i will passes the gradient of optical flow (result from 2 consective frame)to cv.hogdescriptor fuction (is this true or not ) as i mentioned in last line of my code .

amira gravatar imageamira ( 2013-04-26 07:37:10 -0500 )edit

Excuse me for misunderstanding, but yes this is possible. The hogdescriptor doesn't mind which kind of gradient information it gets. It just uses the gradient input. As the optical flow does provide this, the resulting output descriptors will be correct for that set of gradients.

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-26 07:46:32 -0500 )edit

the last thing i want to ask about that ,i must compute the gradient of graysacle image using function [grad, angleOfs] = hog.computeGradient(im); before i passe it to descriptors = hog.compute(grad, 'Locations', {}); or use image directly and passes it to hog.compute(image) function

amira gravatar imageamira ( 2013-04-26 08:56:38 -0500 )edit

I would calculate it directly on the image :)

StevenPuttemans gravatar imageStevenPuttemans ( 2013-04-26 15:16:33 -0500 )edit

Question Tools


Asked: 2013-04-26 06:39:13 -0500

Seen: 1,551 times

Last updated: Apr 26 '13