Skip to content

Instantly share code, notes, and snippets.

@kashimAstro
Created January 25, 2017 11:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kashimAstro/4833be6dee0de94133e734cb257182b3 to your computer and use it in GitHub Desktop.
Save kashimAstro/4833be6dee0de94133e734cb257182b3 to your computer and use it in GitHub Desktop.
extract fhog with dlib and openframeworks
void drawFHOG(ofPixels store, int x, int y)
{
ofPixels pix;
ofImage debug;
ofPushMatrix();
array2d<matrix<float,31,1> > hog;
array2d<rgb_pixel> img;
toDLib(store,img);//<-- view ofxDLib
extract_fhog_features(img, hog);
matrix<unsigned char> df = draw_fhog(hog);
int hf = df.nr();
int wf = df.nc();
pix.allocate(wf, hf, OF_IMAGE_COLOR);
for(int r = 0; r < hf; r++)
{
for(int c = 0; c < wf; c++)
{
pix.setColor(c, r, ofColor(df(r,c)));
}
}
debug = pix;
debug.draw(x,y);
ofPopMatrix();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment