Skip to content

Instantly share code, notes, and snippets.

@rishimukherjee
rishimukherjee / flipmoball.py
Created December 8, 2012 09:49
FlipKart All Mobile Scraper
import bs4
import re
import urllib2
import sys
from collections import defaultdict
start = 1
link = 'http://www.flipkart.com/mobiles/pr?p[0]=sort%3Dprice_asc&sid=tyy%2C4io&layout=grid&start={0}'.format(start)
response = urllib2.urlopen(link)
thePage = response.read()
@rishimukherjee
rishimukherjee / flipKart.py
Created December 7, 2012 20:28
flipKart Scraper
import bs4
import re
import urllib2
import sys
item = sys.argv[1:]
item = '+'.join(item)
link = 'http://www.flipkart.com/search/a/all?query={0}&vertical=all&dd=0&autosuggest[as]=off&autosuggest[as-submittype]=entered&autosuggest[as-grouprank]=0&autosuggest[as-overallrank]=0&autosuggest[orig-query]=&autosuggest[as-shown]=off&Search=%C2%A0&otracker=start&_r=YSWdYULYzr4VBYklfpZRbw--&_l=pMHn9vNCOBi05LKC_PwHFQ--&ref=a2c6fadc-2e24-4412-be6a-ce02c9707310&selmitem=All+Categories'.format(item)
response = urllib2.urlopen(link)
thePage = response.read()
path = '/home/rishi/Documents/'
fname = 'MyImg'
#fname = ''
if path:
import glob, re, os, tempfile
if fname:
if os.path.exists(path):
if path[-1]!='/': path+='/'
gpath = path + fname + "*.png"
current_images = glob.glob(gpath)
import scipy.ndimage as ndi
import scipy
import numpy
import Image
import math
sigma = 1.4
f = 'lena_std.tif'
img = Image.open(f).convert('L') #grayscale
imgdata = numpy.array(img, dtype = float)
@rishimukherjee
rishimukherjee / transform.py
Created April 4, 2012 20:07
Image transform
from SimpleCV import *
import cv2
import cv
import numpy as np
img1 = Image("s.jpg")
img1cv = cv.imread("s.jpg")
img2 = Image("t.jpg")
img2cv = cv.imread("t.jpg")
dst = Image((1600, 1200))
from SimpleCV import *
import cv2
import cv
import numpy as np
img1 = Image("s.jpg")
img1cv = cv.imread("s.jpg")
img2 = Image("t.jpg")
img2cv = cv.imread("t.jpg")
dst = Image((1600, 1200))
@rishimukherjee
rishimukherjee / facepass.py
Created March 27, 2012 21:13
Example of use of SimpleCV. This creates a face recognized password.
#!/usr/bin/python
import time
from SimpleCV import Color, Image, np, Camera
cam = Camera() #initialize the camera
quality = 400
minMatch = 0.3
try:
password = Image("password.jpg")
@rishimukherjee
rishimukherjee / demoappanorama
Created March 22, 2012 15:23
Demo Application Panorama
from SimpleCV import *
import cv2
import cv
import numpy as np
img1 = Image("t.jpg")
img2 = Image("s.jpg")
src = img1.copy()
dst = Image((1600, 1200))
ofimg = img1.findKeypointMatch(img2)