sid-kumar-iyer / internship_at_iitk Goto Github PK
View Code? Open in Web Editor NEWResearch internship @ IITK during summer 2018
Research internship @ IITK during summer 2018
When interpolating the pixel intensity based on area, your code does not check for the sanity of input. You may either:
import numpy as np
import math
def spatial_interpolation(image, p) :
## sanity check
if (np.any(np.array(p) < 0) or
np.any(np.array(p[::-1]) >= image.shape)) :
raise IndexError('%s: [LB: 0 UB): %s', p[::-1], image.shape)
x, y = p
dx, dy = p - np.floor(p)
# lg.debug((x, y, dx, dy))
I = np.array([[
image[int(math.floor(y)), int(math.floor(x))],
image[int(math.floor(y)), int(math.floor(1 + x))]
],[
image[int(math.floor(1 + y)), int(math.floor(x))],
image[int(math.floor(1 + y)), int(math.floor(1 + x))]
]])
A = np.matmul(
np.array([[1 - dy, dy]]).T,
np.array([[1 - dx, dx]])
)
value = np.sum(I * A)
# lg.debug((I, A, value))
return value
This piece of code raises exception... The caller is responsible to handle the exception
internship_at_IITK/snapping.py
Line 31 in 57e53b6
internship_at_IITK/snapping.py
Line 217 in 57e53b6
Instead of hardcoding the memory allocation, you may:
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.