Skip to content

Instantly share code, notes, and snippets.

View ashishrana160796's full-sized avatar
👣
Am I Blue?

Ashish Rana ashishrana160796

👣
Am I Blue?
  • Mannheim, Germany
View GitHub Profile
@ashishrana160796
ashishrana160796 / resolution_convert_util.py
Created March 10, 2019 20:06
From automatetheboringstuff.com the library pyautogui breaks when code is needed to be ported to different screen resolutions. Hence, this utility converts mouse clicks from one resolution to another resolution.
# Problem: Different Screens have different resolutions. When, it comes to GUI automation this resolution causes problem.
# Of having a different co-ordinate system for different systems. Hence, causing resolution problem issue.
# Solution: Just convert the resolution size with simple unitary formula method.
# This import is required to get the current screen size
import pyautogui
def res_convertor(wdth, hght):
@ashishrana160796
ashishrana160796 / zoomed_comparison.py
Last active January 1, 2022 22:06
Zooming in images of cells and annotation images via matplotlib on VGG Cell count dataset. It is preferred to use Python 3.6.x for replicating the implementation.
import scipy
import numpy as np
from scipy.ndimage import zoom
import matplotlib.pyplot as plt
# Reference Solution Given By: https://stackoverflow.com/users/1461210/ali-m
#
def clipped_zoom(img, zoom_factor, **kwargs):
# assumption is that zoom factor is greater than 1
h, w = img.shape[:2]
# no RGB zoom to be applied for multi-channel image,
@ashishrana160796
ashishrana160796 / repeat_gen.py
Created December 31, 2018 17:48
Combine Images(here, repeating only single image), Add Padding to them(w/ black background) with a grid formation method. Create new images for your image dataset for repeated pattern analysis.
from PIL import Image
import numpy as np
# call with pil_transform('test.jpg')
def pil_transform(image_str):
# padding process started
im_opn = Image.open(image_str)
old_sz = im_opn.size
new_sz = (old_sz[0]+30, old_sz[1]+30)
@ashishrana160796
ashishrana160796 / nac_plot.py
Last active December 27, 2018 17:21
NAC and NALU unit 3-D plot python code with matplotlib library. Can be used as a reference for plotting sigmoid, tanh function also.
'''
NAC 3-D Plot Code
'''
# import statements
from mpl_toolkits.mplot3d import Axes3D
import matplotlib.pyplot as plt
from matplotlib import cm
from matplotlib.ticker import LinearLocator, FormatStrFormatter
@ashishrana160796
ashishrana160796 / BBBC_data_preprocess.py
Last active January 1, 2022 22:07
Load Images from BBBC dataset(Here, https://data.broadinstitute.org/bbbc/BBBC005/) and Resize them with PIL python library along with changes their size & for JPEG. After, that split them into test and train directories depending on requirement add conditions for test/train sets.
# Best way to run copy and paste portions into an ipython3 shell
# 1. Import Statements
import operator
from os import listdir
from os.path import isfile, join
# 2. Select files with matching tiff extensions.
import re
@ashishrana160796
ashishrana160796 / UCSD_count_preprocess.py
Last active January 1, 2022 22:07 — forked from rkwitt/UCSD_Ped_Counting_Dataset.py
Data loading for the UCSD pedestrian counting(http://www.svcl.ucsd.edu/projects/peoplecnt/) dataset for images with their respective count from matlab scripts provided along.
import glob
import os
import scipy.io as sio
import numpy as np
import numpy as np
from PIL import *
class UCSD():
"""UCSD pedestrian counting data."""
@ashishrana160796
ashishrana160796 / LICENSE.md
Last active May 12, 2018 11:03
This license applies to all public gists https://gist.github.com/ashishrana160796
@ashishrana160796
ashishrana160796 / JavaDocCheatSheet.md
Last active February 8, 2024 21:42
JavaDoc CheatSheet : This gist contains basics of JavaDoc comments to get you up and running in no time.

JAVADOC CHEATSHEET

Introduction

The major important thing is the documentation has to be implementation independent and specification concise. Dependencies where ever necessary are allowed to be specified.
Also it is allows HTML tags to be used in between the documentation comments. Pretty much all tags are self explanatory.

Meta Annotations
@author  Ex: @author Jane Doe
@version  Ex: @version v1.0-alpha