{
  "cells": [
    {
      "cell_type": "code",
      "execution_count": null,
      "metadata": {
        "_cell_guid": "4f69c0c7-0583-4441-6abf-3c644151db67"
      },
      "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",
        "\n",
        "import cv2\n",
        "import numpy as np # linear algebra\n",
        "import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv)\n",
        "from matplotlib import pyplot as plt\n",
        "import 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",
        "\n",
        "from 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",
        "\n",
        "ftdata=[]\n",
        "clsdata=[]\n",
        "\n",
        "def feature_extract(filename):\n",
        "    global ftdata\n",
        "    global clsdata\n",
        "    \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",
        "\n",
        "for 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": "e70cd02f-b581-92fd-8e34-a690b27dfae7"
      },
      "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
}