{"cells":[{"cell_type":"markdown","metadata":{"_cell_guid":"fd8c5e18-47d4-068e-b8ce-6f5d986f6802"},"source":""},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"c493fd6b-63e9-e28c-ed3e-4f9367bbf695"},"outputs":[],"source":"# This Python 3 environment comes with many helpful analytics libraries installed\n# It is defined by the kaggle/python docker image: https://github.com/kaggle/docker-python\n# For example, here's several helpful packages to load in \n\nimport numpy as np # linear algebra\nimport pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\nimport cv2\nimport glob\n\n# Input data files are available in the \"../input/\" directory.\n# For example, running this (by clicking run or pressing Shift+Enter) will list the files in the input directory\n\nfrom subprocess import check_output\n#print(check_output([\"ls\", \"../input\"]).decode(\"utf8\"))\n#print(check_output([\"ls\", \"../input/train\"]).decode(\"utf8\"))\n\n#My code begins here.... vnt.....\n\nftdata=[]\nclsdata=[]\n\ndef feature_extract(filename):\n    global ftdata\n    #Reading images\n    image = cv2.imread(filename)    \n    \n    # Initiate SIFT detector\n    sift = cv2.xfeatures2d.SIFT_create()\n\n    # find the keypoints and descriptors with SIFT\n    kp, des = sift.detectAndCompute(image,None)\n    ftdata.append(des)\n    if (filename.find(\"cat\")>-1):\n        clsdata.append(1)   # 1 is for cat\n    else:\n        clsdata.append(0)  # 0 is for dog\n\n\nfor image_file in glob.iglob('../input/train/*.jpg'):\n        feature_extract(image_file)\n        if (i>10):\n            break\n         "},{"cell_type":"code","execution_count":null,"metadata":{"_cell_guid":"dd1d6be0-873b-ee57-7fdd-4dc514f1c4c2"},"outputs":[],"source":""}],"metadata":{"_change_revision":0,"_is_fork":false,"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.6.0"}},"nbformat":4,"nbformat_minor":0}