{"id":26519696,"url":"https://github.com/ycc789741ycc/hog-bgr-with-visualization","last_synced_at":"2025-07-20T15:32:25.884Z","repository":{"id":48745145,"uuid":"401240073","full_name":"ycc789741ycc/HOG-BGR-with-visualization","owner":"ycc789741ycc","description":"HOG feature descriptor, the kind of feature transform before we put our image into SVM. This repository also provides hog visualization both before and after doing block normalization.","archived":false,"fork":false,"pushed_at":"2021-08-30T11:04:40.000Z","size":2448,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-28T18:06:11.031Z","etag":null,"topics":["computer-vision","hog-features","hog-features-extraction","numpy","opencv","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ycc789741ycc.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-08-30T06:32:22.000Z","updated_at":"2024-01-20T22:25:03.000Z","dependencies_parsed_at":"2022-08-26T23:10:24.495Z","dependency_job_id":null,"html_url":"https://github.com/ycc789741ycc/HOG-BGR-with-visualization","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ycc789741ycc/HOG-BGR-with-visualization","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycc789741ycc%2FHOG-BGR-with-visualization","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycc789741ycc%2FHOG-BGR-with-visualization/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycc789741ycc%2FHOG-BGR-with-visualization/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycc789741ycc%2FHOG-BGR-with-visualization/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ycc789741ycc","download_url":"https://codeload.github.com/ycc789741ycc/HOG-BGR-with-visualization/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ycc789741ycc%2FHOG-BGR-with-visualization/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266151524,"owners_count":23884436,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["computer-vision","hog-features","hog-features-extraction","numpy","opencv","python"],"created_at":"2025-03-21T11:23:20.922Z","updated_at":"2025-07-20T15:32:25.868Z","avatar_url":"https://github.com/ycc789741ycc.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# HOG-BGR-with-visualization\r\nHOG feature descriptor, a kind of feature transform before we put our image into SVM or NN.  \r\n  \r\nIn this API, I split hog feature into BGR channel respectively, it's a little different from hog in skimage, but this API still support grayscale image.  \r\nThis API divides orients of gradient into 9 bins and each bin represent 0 20 40 60 ... 160.  \r\n  \r\nFurthermore, due to hog's performance has some relationship with tuning parameters, so this repository provides hog visualization both before and after doing block normalization. \r\n  \r\n## Environment\r\nPython\u003e=3.9.1  \r\nnumpy\u003e=1.20.0  \r\nopencv-python\u003e=4.5.1.48  \r\n\r\n## Installation  \r\n```\r\npip install hogBGR  \r\n```\r\n\r\n## Demo\r\nOriginal Picture  \r\n\u003cimg src=\"https://github.com/ycc789741ycc/HOG-BGR-with-visualization/blob/master/hogBGR/example/rose.png\" alt=\"Cover\" width=\"50%\"/\u003e  \r\n\r\n```\r\nimport cv2\r\nfrom hogBGR import HOG\r\nfrom hogBGR import HOGvisualized\r\nfrom hogBGR import util\r\n```\r\n\r\n### HOG  \r\n\u003e Let's create a 16x16 (pixels) cell, 2x2 (cells) block hog image.  \r\n```\r\nimg = cv2.imread(r'hogBGR/example/rose.png')\r\ncell_hogfeature = HOG.Cell_HOG(img,cell_size=(16,16))\r\nhog = HOG.BlockNorm_HOG(cell_hogfeature,block_size=(2,2))\r\n```\r\nor\r\n```\r\nimg = cv2.imread(r'hogBGR/example/rose.png')\r\nhog = HOG.HOGfeature(img,cell_size=(16,16),block_size=(2,2),flatten=False)\r\n```\r\n\u003e Take a visualization\r\n```\r\nres = HOGvisualized.visualize_HOG(hog[:,:,:,0,0,:],15)\r\ncv2.imshow(\"HOG feature with block normaliztion\",res)\r\n```\r\nor  \r\n```\r\nutil.BlockNormaliztionHOG_Show(img,one_cell=True)\r\n```\r\n\u003e Below shows hog image in each cell of blocks. (First method would only show first cell of blocks)  \r\n\u003cimg src=https://github.com/ycc789741ycc/HOG-BGR-with-visualization/blob/master/READMEpics/blocknorm.png alt=\"Cover\" width=\"200%\"/\u003e  \r\n\r\n### HOG without block normalization\r\n\u003e Let's create a 16x16 (pixels) cell hog image.  \r\n```\r\nimg = cv2.imread(r'hogBGR/example/rose.png')\r\ncell_hogfeature = HOG.Cell_HOG(img,cell_size=(16,16))\r\n```\r\n\u003e Take a visualization\r\n```\r\nres = HOGvisualized.visualize_HOG(cell_hogfeature,15)\r\ncv2.imshow(\"part1 - HOG feature without block normaliztion\",res)\r\n```\r\nor\r\n```\r\nutil.NonBlockNormaliztionHOG_Show(img)\r\n```\r\n\u003e Below shows hog image before block normalization\r\n\u003cimg src=https://github.com/ycc789741ycc/HOG-BGR-with-visualization/blob/master/READMEpics/non-blocknorm.png alt=\"Cover\" width=\"50%\"/\u003e  \r\n\r\n### Gray scale input image is also supported\r\nOrginal Picture  \r\n\u003cimg src=https://github.com/ycc789741ycc/HOG-BGR-with-visualization/blob/master/READMEpics/grayrose.png alt=\"Cover\" width=\"50%\"/\u003e  \r\n  \r\nVisualization  \r\n\u003cimg src=https://github.com/ycc789741ycc/HOG-BGR-with-visualization/blob/master/READMEpics/grayhog.png alt=\"Cover\" width=\"100%\"/\u003e  \r\n  \r\n### Simplified visualization\r\n\u003e You can try the result with yourself if you want a faster visualization.\r\n```\r\nres = HOGvisualized.Fast_visualize_HOG(hogfeature,7)\r\n```\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycc789741ycc%2Fhog-bgr-with-visualization","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fycc789741ycc%2Fhog-bgr-with-visualization","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fycc789741ycc%2Fhog-bgr-with-visualization/lists"}