Commit 661b93e8 authored by giwi97's avatar giwi97

color histogram

parent 637bf351
{
"git.ignoreLimitWarning": true
}
\ No newline at end of file
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -35,6 +35,30 @@
" cells_per_block=(1, 1), visualize=True, multichannel=False)\n",
" return ftr"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def FtrExtractColorHist(img):\n",
" chans = cv2.split(img)\n",
" colors = (\"h\", \"s\", \"v\")\n",
" features = []\n",
"\n",
" for (chan, color) in zip(chans, colors):\n",
" hist = cv2.calcHist([chan], [0], None, [256], [0, 256])\n",
" features.extend(hist)\n",
" return np.array(features).flatten()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
......@@ -2,7 +2,7 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
......@@ -22,7 +22,7 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
......@@ -35,6 +35,30 @@
" cells_per_block=(1, 1), visualize=True, multichannel=False)\n",
" return ftr"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [],
"source": [
"def FtrExtractColorHist(img):\n",
" chans = cv2.split(img)\n",
" colors = (\"h\", \"s\", \"v\")\n",
" features = []\n",
"\n",
" for (chan, color) in zip(chans, colors):\n",
" hist = cv2.calcHist([chan], [0], None, [256], [0, 256])\n",
" features.extend(hist)\n",
" return np.array(features).flatten()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment