Controller Ipynb
Controller Ipynb
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Controller"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"This notebook is responsible for integrating all the notebooks present in this
project\n",
"\n",
"When executed, this notebook automaticall runs all other notebooks
sequantially."
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Importing important libraries\n",
"\n",
"import cv2\n",
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"from skimage.metrics import structural_similarity as ssim\n",
"\n",
"#Resizing the Plots\n",
"plt.rcParams[\"figure.figsize\"] = (12, 12)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -z # Deleting all pre- stored variables"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# Running gui_1.ipynb\n",
"\n",
"%run ./gui_1.ipynb"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"# The GUI file produces and then stores the variables path and option\n",
"# Reading the stored variables\n",
"\n",
"%store -r selectedImage\n",
"%store -r path\n",
"%store -r option\n",
"\n",
"print('Image selected: ', selectedImage)\n",
"print('Path: ', path)\n",
"print('Currency type: ', option)"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"if selectedImage == True:\n",
" if option == 1: # For 500 currency note\n",
" %run ./500_Testing.ipynb\n",
" elif option == 2: # For 2000 currency note\n",
" %run ./2000_Testing.ipynb"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"if selectedImage == True:\n",
" # The above file produces and stores result_list variable\n",
" # Reading the variable\n",
" %store -r result_list\n",
"\n",
" # Showing the results\n",
" # The result list variable is a list of lists and each list conatins
details about each feature\n",
" for x in result_list:\n",
" if x[0] is not None: \n",
" plt.imshow(x[0]) # Showing images\n",
" plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"\n",
"if selectedImage == True:\n",
"# Show output in GUI\n",
"\n",
" %run ./gui_2.ipynb"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"%store -z # Deleting all pre- stored variables"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.3"
}
},
"nbformat": 4,
"nbformat_minor": 4
}