Posts
Showing posts from 2013
Web GL
- Get link
- X
- Other Apps
I have recently started learning Web-GL. I found one Web-GL course on Udacity.com, here is the link: https://www.udacity.com/course/cs291 I found this course amazing not only from Web-GL point of view but it also gives you a good understanding of rendering-concepts. And while looking at different Web-GL examples, I found following link which has some great physics simulation examples. http://lonely-pixel.com And this presentation gives you a good idea of different rendering styles : http://acko.net/files/fullfrontal/fullfrontal/webglmath/online.html
Bounding Box in PIL (Python Image Library)
- Get link
- X
- Other Apps
Bounding Box in PIL(Python Image Library) : Bounding Box function of PIL can be very useful for removing unused pixels from an image. Eg. If we want to remove unused pixels based on alpha channel of an image, we can use following code. im = Image.open(imagePath) r,g,b,a = im.split() left,upper,right,lower = a.getbbox() tempImage = im.crop((left,upper,right,lower)) newPath = imagePath.split(".")[0]+"_Cropped" + "." + imagePath.split(".")[1] tempImage.save(newPath) To understand which values, getbbox() function returns and what do they look like on an image, I created an image showing the values returned by the function. left,upper,right,lower = image.getbbox() Suppose you have a point in an original image and you want to find out the new position of the same point in the cropped image, lets see how we can do it. Suppose the point is at (300,450) position in an original image, so after cr...
Dynamically Generating Curves
- Get link
- X
- Other Apps
These are few lines of code to generate dynamic curves in Maya. I wrote this code while researching about effect of different trigonometrical function on a curve. import math,maya.cmds as cmds,maya.mel as mel points ="[" x= 0 for i in xrange(50): x+=i points = points + ("("+str(x)+","+ str(math.sin(i*10)*10) +",0),") points = points.rstrip(",")+"]" cmds.curve(p=eval(points))