Commit ca91d9b2 authored by Sushil BHATTACHARJEE's avatar Sushil BHATTACHARJEE

removed checkpoint files

parent e3e1a843
Pipeline #25609 failed with stage
in 3 seconds
{
"cells": [],
"metadata": {},
"nbformat": 4,
"nbformat_minor": 2
}
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## MMU2 Dataset -- Multimedia University\n",
"\n",
"* 100 subjects\n",
"* 995 iris images (5 per eye) \n",
" * 5 images excluded due to cataract\n",
"* 199 unique iris-identities\n",
"* Capture device: Panasonic BM-ET100US camera\n",
" * Near-Infrared (NIR) wavelength band\n",
" * Resolution: 320 $\\times$ 240\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from matplotlib.patches import Circle\n",
"import matplotlib.pyplot as plt\n",
"from matplotlib.patches import Circle\n",
"import cv2\n",
"from lib.segment import segment\n",
"from lib.normalize import normalize\n",
"from lib.encode import encode\n",
"\n",
"import os\n",
"from scipy import misc\n",
"\n",
"\n",
"\n",
"#######\n",
"# Segmentation parameters\n",
"eyelashes_thres = 80\n",
"\n",
"# Normalisation parameters\n",
"radial_res = 20\n",
"angular_res = 240\n",
"\n",
"# Feature encoding parameters\n",
"minWaveLength = 18\n",
"mult = 1\n",
"sigmaOnf = 0.5\n",
"\n",
"#######\n",
"\n",
"#probe_dir = '../MMU1/1/left'\n",
"probe_dir = \"data/MMU1/1/left\"\n",
"probe_file = 'aeval1.bmp'\n",
"#probe_dir = 'data/MMU2'\n",
"#probe_file = '990201.bmp'\n",
"\n",
"probe_img_file = os.path.join(probe_dir, probe_file)\n",
"#probe_img_file = 'data/MMU1/3/right/chingycr1.bmp'\n",
"\n",
"print('Loading probe image: %s' % probe_img_file)\n",
"eye_im = plt.imread(probe_img_file, format='bmp')\n",
"probe_im = eye_im[:,:,0]\n",
"cv2.imwrite(\"images/probe_image.png\", probe_im)\n",
"print('probe image dims: ', probe_im.shape)\n",
"#plt.imshow(eye_im[:,:,0])\n",
"#assert 0>1, 'stop'\n",
"\n",
"ciriris, cirpupil, imwithnoise = segment(probe_im, eyelashes_thres, False)\n",
"print(ciriris)\n",
"print(cirpupil)\n",
"\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Probe image\n",
"![](images/probe_image.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"ref_im = plt.imread('images/probe_image.png', format='png')\n",
"print('ref_im shape:', ref_im.shape)\n",
"#assert 0>1, 'stop'\n",
"line_width = 2\n",
"\n",
"cv2.circle(eye_im,(cirpupil[1], cirpupil[0]), cirpupil[2], (255,255,255), line_width)\n",
"cv2.circle(eye_im,(ciriris[1], ciriris[0]), ciriris[2], (255,255,255), line_width)\n",
"\n",
"cv2.imwrite(\"images/iris_det.png\", eye_im)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Iris Detection\n",
"![](images/iris_det.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import os, sys\n",
"import numpy as np\n",
"import scipy.io as sio\n",
"\n",
"# Perform normalization\n",
"polar_array, noise_array = normalize(imwithnoise, ciriris[1], ciriris[0], ciriris[2],\n",
" cirpupil[1], cirpupil[0], cirpupil[2],\n",
" radial_res, angular_res)\n",
"\n",
"print(imwithnoise.shape)\n",
"cv2.imwrite('images/iris_noisy.png', imwithnoise)\n",
"\n",
"print(type(polar_array[0,0]))\n",
"print(np.amax(polar_array))\n",
"#equ = cv2.equalizeHist(polar_array)\n",
"#cv2.imwrite('images/iris_polar.png', equ) #polar_array)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"![](images/iris_noisy.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Perform feature encoding\n",
"probe_iris_code, probe_mask = encode(polar_array, noise_array, minWaveLength, mult, sigmaOnf)\n",
"cv2.imwrite('images/iris_code.png', probe_iris_code)\n",
"cv2.imwrite('images/iris_mask.png', probe_mask)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"'Probe IrisCode' | 'Probe Mask'\n",
"------------------------------|-------------------------\n",
"![](images/iris_code.png) | ![](images/iris_mask.png)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"temp_dir = 'templates/MMU2'\n",
"enrolled_template_file = '010101.bmp.mat'\n",
"enrol_template = sio.loadmat(os.path.join(temp_dir, enrolled_template_file))\n",
"#enrol_template = sio.loadmat('%s%s'% (temp_dir, enrolled_template_file))\n",
"enrol_iris_code = enrol_template['template']\n",
"enrol_mask = enrol_template['mask']\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"from fnc.matching_singlethread import calHammingDist\n",
"# Calculate the Hamming distance\n",
"hm_dist = calHammingDist(probe_iris_code, probe_mask, enrol_iris_code, enrol_mask)\n",
"#return (file_temp_name, hm_dist)\n",
"print(hm_dist)\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 2
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython2",
"version": "2.7.14"
}
},
"nbformat": 4,
"nbformat_minor": 2
}
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