{"metadata":{"kernelspec":{"language":"python","display_name":"Python 3","name":"python3"},"language_info":{"pygments_lexer":"ipython3","nbconvert_exporter":"python","version":"3.6.4","file_extension":".py","codemirror_mode":{"name":"ipython","version":3},"name":"python","mimetype":"text/x-python"}},"nbformat_minor":4,"nbformat":4,"cells":[{"cell_type":"code","source":"!apt-get install zip","metadata":{"execution":{"iopub.status.busy":"2022-01-24T12:07:39.117655Z","iopub.execute_input":"2022-01-24T12:07:39.117921Z","iopub.status.idle":"2022-01-24T12:07:42.101586Z","shell.execute_reply.started":"2022-01-24T12:07:39.117874Z","shell.execute_reply":"2022-01-24T12:07:42.100871Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import numpy as np\nimport pandas as pd \nfrom skimage.transform import resize\n\nimport os\nprint(os.listdir(\"../input/train_images\"))\nIMG_SIZE = 512\n","metadata":{"_uuid":"8f2839f25d086af736a60e9eeb907d3b93b6e0e5","_cell_guid":"b1076dfc-b9ad-4769-8c92-a6c4dae69d19","execution":{"iopub.status.busy":"2022-01-24T12:07:45.559752Z","iopub.execute_input":"2022-01-24T12:07:45.560059Z","iopub.status.idle":"2022-01-24T12:07:46.779463Z","shell.execute_reply.started":"2022-01-24T12:07:45.56001Z","shell.execute_reply":"2022-01-24T12:07:46.778624Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"list = os.listdir(\"../input/train_images\")\nnp.size(list)","metadata":{"_cell_guid":"79c7e3d0-c299-4dcb-8224-4455121ee9b0","_uuid":"d629ff2d2480ee46fbb7e2d37f6b5fab8052498a","execution":{"iopub.status.busy":"2022-01-24T12:07:52.809475Z","iopub.execute_input":"2022-01-24T12:07:52.809792Z","iopub.status.idle":"2022-01-24T12:07:52.822708Z","shell.execute_reply.started":"2022-01-24T12:07:52.809738Z","shell.execute_reply":"2022-01-24T12:07:52.821766Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!mkdir grayscale","metadata":{"_uuid":"30e147acc85e435a4ac6ceb0301a543548743f25","execution":{"iopub.status.busy":"2022-01-24T12:07:54.288088Z","iopub.execute_input":"2022-01-24T12:07:54.288404Z","iopub.status.idle":"2022-01-24T12:07:54.940219Z","shell.execute_reply.started":"2022-01-24T12:07:54.288349Z","shell.execute_reply":"2022-01-24T12:07:54.939368Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"import cv2\nimport matplotlib.pyplot as plt\nfor file in list:\n    base = os.path.basename(\"../input/train_images/\" + file)\n    fileName = os.path.splitext(base)[0]\n    img = cv2.imread(\"../input/train_images/\" + file, cv2.IMREAD_GRAYSCALE)   \n    cv2.imwrite(\"./grayscale/\" +  fileName + \".jpeg\",img)","metadata":{"_uuid":"9d2105dd7bfb42c19040d3f295639496a0c221e4","execution":{"iopub.status.busy":"2022-01-24T12:07:56.563467Z","iopub.execute_input":"2022-01-24T12:07:56.563768Z","iopub.status.idle":"2022-01-24T12:16:19.929046Z","shell.execute_reply.started":"2022-01-24T12:07:56.563709Z","shell.execute_reply":"2022-01-24T12:16:19.928142Z"},"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!zip grayscale.zip grayscale/","metadata":{"_uuid":"fbfa026f01eedc592cf074280abb036dd0f9ef80","trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!rm -r grayscale","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"!ls grayscale","metadata":{"trusted":true},"execution_count":null,"outputs":[]},{"cell_type":"code","source":"","metadata":{"trusted":true},"execution_count":null,"outputs":[]}]}