This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from skimage import color | |
from skimage.io import imsave | |
lab_img = color.rgb2lab(cimage) | |
copy_img = np.copy(cimage) | |
L_img = lab_img[:, :, 0] | |
A_img = lab_img[:, :, 1] | |
B_img = lab_img[:, :, 2] | |
# green a > -35 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from skimage import color | |
from skimage.io import imsave | |
lab_img = color.rgb2lab(cimage) | |
copy_img = np.copy(cimage) | |
L_img = lab_img[:, :, 0] | |
A_img = lab_img[:, :, 1] | |
B_img = lab_img[:, :, 2] | |
x,y,z = lab_img.shape | |
for xi in range(x): | |
for yi in range(y): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// the code will also try to center the element on the page. | |
var ElementScrollTo = { | |
documentVerticalScrollPosition: function() { | |
if (self.pageYOffset) return self.pageYOffset; // Firefox, Chrome, Opera, Safari. | |
if (document.documentElement && document.documentElement.scrollTop) return document.documentElement.scrollTop; // Internet Explorer 6 (standards mode). | |
if (document.body.scrollTop) return document.body.scrollTop; // Internet Explorer 6, 7 and 8. | |
return 0; // None of the above. | |
}, | |
viewportHeight: function() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The sequence of steps lets me download an APK of any app I have downloaded from the playstore. | |
1. install the app from playstore in the app or emulator. example instagram | |
2. get the name of the package of the app I am interested in, this can also be taken from the playstore URL, | |
``adb shell pm list packages | grep instagram`` | |
3. get the location of the apk in the phone | |
``adb shell pm path com.instagram.android`` | |
4. download the app to the local system | |
``adb pull /data/app/com.instagram.android-XJc0EbhiBn-d0G4UmdnmgQ==/base.apk`` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# A list of the keys of dictionary | |
list_keys = [ k for k in dict ] | |
# or a list of the values | |
list_values = [ v for v in dict.values() ] | |
# or just a list of the list of key value pairs | |
list_key_value = [ [k,v] for k, v in dict.items() ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
X = [0,0,0,0,0,0,0,0,0,1,1,1,1,1,0,0,0,1,0,1,1,1,1,0,0,0,1,1,1,0,0,0,0,1] | |
def run_length_smoothing(X, run_length_width): | |
block = [] | |
for index, intensity in enumerate(X): | |
if intensity == 1 and len(block) <= run_length_width: | |
for j in block: | |
X[j] = 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import requests | |
img_to_upload = '/Users/muthukrishnan/Pictures/15566790261881556159500299IMG_20190330_120119.jpg' | |
url = "http://localhost:5000/api/document/page-extract" | |
uploaded_img_path = '' | |
with open(img_to_upload, 'rb') as img: | |
name_img = os.path.basename(img_to_upload) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
%matplotlib inline | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import pandas as pd | |
from sklearn.datasets.samples_generator import make_blobs | |
class K_Means: | |
def __init__(self, k=3, max_iterations = 500): | |
self.k = k |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: "ACCESS_KEY", | |
secretAccessKey: "SECRET_ACCESS_KEY" | |
}); | |
// Create an S3 client | |
var s3 = new AWS.S3(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var q = require('q'); | |
var AWS = require('aws-sdk'); | |
AWS.config.update({ | |
accessKeyId: "131231", | |
secretAccessKey: "23135124" | |
}); | |
// Create an S3 client | |
var s3 = new AWS.S3(); |
NewerOlder