|
@@ -0,0 +1,185 @@
|
|
|
|
+{
|
|
|
|
+ "cells": [
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 18,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "from ipfml import processing, utils, metrics\n",
|
|
|
|
+ "from PIL import Image\n",
|
|
|
|
+ "from scipy import signal\n",
|
|
|
|
+ "from skimage import color\n",
|
|
|
|
+ "import scipy.stats as stats\n",
|
|
|
|
+ "import seaborn as sns\n",
|
|
|
|
+ "import cv2\n",
|
|
|
|
+ "import numpy as np\n",
|
|
|
|
+ "import matplotlib.pyplot as plt\n",
|
|
|
|
+ "import os"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 4,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "data_folder = \"../fichiersSVD_light\""
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "markdown",
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "source": [
|
|
|
|
+ "# MSCN analysis on Synthesis Images "
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "markdown",
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "source": [
|
|
|
|
+ "## Utils functions definition"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 5,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "def compute_images_path(scene, prefix, indices):\n",
|
|
|
|
+ " images_path = []\n",
|
|
|
|
+ " for index in indices:\n",
|
|
|
|
+ " path = os.path.join(data_folder, os.path.join(scene, prefix + index + \".png\"))\n",
|
|
|
|
+ " print(path)\n",
|
|
|
|
+ " images_path.append(path)\n",
|
|
|
|
+ " return images_path"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 40,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "def get_L_canal(img):\n",
|
|
|
|
+ " img_lab = metrics.get_LAB_L(img)\n",
|
|
|
|
+ " img_lab = np.asarray(img_lab, 'uint8')\n",
|
|
|
|
+ " \n",
|
|
|
|
+ " return Image.fromarray(img_lab)"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 38,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "def get_MSCN_canal(img):\n",
|
|
|
|
+ " img_mscn = processing.get_mscn_coefficients(img)\n",
|
|
|
|
+ " img_mscn = np.asarray(utils.normalize_2D_arr(img_mscn)*255, 'uint8')\n",
|
|
|
|
+ " \n",
|
|
|
|
+ " return Image.fromarray(img_mscn)"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "markdown",
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "source": [
|
|
|
|
+ "## Scenes MSCN variance analysis"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "markdown",
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "source": [
|
|
|
|
+ "### Cuisine01 scene "
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 31,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "scene_name = \"Cuisine01\"\n",
|
|
|
|
+ "prefix_name = \"cuisine01_\"\n",
|
|
|
|
+ "image_indices = [\"00050\", \"00100\", \"00200\", \"00300\", \"00500\", \"00900\",\"01200\"]"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 37,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [
|
|
|
|
+ {
|
|
|
|
+ "name": "stdout",
|
|
|
|
+ "output_type": "stream",
|
|
|
|
+ "text": [
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00050.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00100.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00200.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00300.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00500.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_00900.png\n",
|
|
|
|
+ "../fichiersSVD_light/Cuisine01/cuisine01_01200.png\n"
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ "source": [
|
|
|
|
+ "images_path = compute_images_path(scene_name, prefix_name, image_indices)"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 46,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "get_L_canal(processing.divide_in_blocks(Image.open(images_path[0]), (200, 200))[10]).save('tmp_images/cuisine01_zone10_00050_lab.png')\n",
|
|
|
|
+ "get_L_canal(processing.divide_in_blocks(Image.open(images_path[5]), (200, 200))[10]).save('tmp_images/cuisine01_zone10_01200_lab.png')"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 47,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "get_MSCN_canal(processing.divide_in_blocks(Image.open(images_path[0]), (200, 200))[10]).save('tmp_images/cuisine01_zone10_00050_mscn.png')\n",
|
|
|
|
+ "get_MSCN_canal(processing.divide_in_blocks(Image.open(images_path[5]), (200, 200))[10]).save('tmp_images/cuisine01_zone10_01200_mscn.png')"
|
|
|
|
+ ]
|
|
|
|
+ },
|
|
|
|
+ {
|
|
|
|
+ "cell_type": "code",
|
|
|
|
+ "execution_count": 49,
|
|
|
|
+ "metadata": {},
|
|
|
|
+ "outputs": [],
|
|
|
|
+ "source": [
|
|
|
|
+ "processing.divide_in_blocks(Image.open(images_path[0]), (200, 200))[10].save('tmp_images/cuisine01_zone10_noisy.png')\n",
|
|
|
|
+ "processing.divide_in_blocks(Image.open(images_path[5]), (200, 200))[10].save('tmp_images/cuisine01_zone10_ref.png')"
|
|
|
|
+ ]
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ "metadata": {
|
|
|
|
+ "kernelspec": {
|
|
|
|
+ "display_name": "thesis-venv",
|
|
|
|
+ "language": "python",
|
|
|
|
+ "name": "thesis-venv"
|
|
|
|
+ },
|
|
|
|
+ "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.6.0"
|
|
|
|
+ }
|
|
|
|
+ },
|
|
|
|
+ "nbformat": 4,
|
|
|
|
+ "nbformat_minor": 2
|
|
|
|
+}
|