Visualizing Musical Scales: Music is Mathematics all the Way

If you love music, you are a born mathematician. Music is inherently mathematical. If you love music, don’t let your maths teacher or maths score make you believe that you are not good at maths. If you can tell the difference between a melody and out of tune note, you have mastered or even better […]

Open Source Android App to Calculate Sunrise Sunset Time

I recently did this app in free time. It lets you calculate sunrise and sunset time at any given location. I have used the library by Mike Reedell to do the astronomical calculations.(corrected one rounding off error in the original library). The app can pick locations from a MAP or from GPS or you can […]

Android: Adding Glow Effect to UI elements

Here’s the secret recipe for making your UI Glow like the moon, and the stars, and the sun. The secret to glow lies in the shadows. You heard that right…The bigger the darkness, the easier it is to spot your little light. You can achieve different glow effects playing with the following xml shadow options […]

OpenCV: Interlacing Two Images

The code defines two method 1) interlace_two_images(img1, img2) 2) main() – which calls the above method to interlace two images named circle.jpg and polygon.jpg import sys, os import numpy as np import cv2 def interlace_two_images(img1, img2): interlacedimg = np.zeros((img1.shape[0]+img2.shape[0], img1.shape[1],img1.shape[2]), dtype=np.uint8) interlacedimg[0::2,:,:]=img1 interlacedimg[1::2,:,:]=img2 return interlacedimg def main(): imagesdirectory = os.path.join(‘knowpapa’) print “Interlace images circle.jpg and […]

OpenCV:Convert an Image to GreyScale

The code below is commented and self explanatory. It converts all images in a folder “images>knowpapa” to its equivalent greyscale image and appends the word ‘grey’ to the original image name. import sys import os import numpy as np import cv2 def greyscale(img): ”’Convert an image to greyscale. image – a numpy array of shape […]

OpenCV: Split target image into its red, green and blue channels

The code speaks for itself: import sys import os import numpy as np import cv2 def split_into_rgb_channels(image): ”’Split the target image into its red, green and blue channels. image – a numpy array of shape (rows, columns, 3). output – three numpy arrays of shape (rows, columns) and dtype same as image, containing the corresponding […]

Android Gesture Detector Demo

Android provides a dedicated GestureDetector class to detect common gestures. It implements a SimpleOnGestureListener which can be used to detect the following gestures: onDoubleTap(MotionEvent e) onDoubleTapEvent(MotionEvent e) onDown(MotionEvent e) onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) onLongPress(MotionEvent e) onScroll(MotionEvent e1, MotionEvent e2, float distanceX, float distanceY) onShowPress(MotionEvent e) onSingleTapConfirmed(MotionEvent e) onSingleTapUp(MotionEvent e) Let us […]

Download All Images from a Remote Directory : Python Script

Here’s a quick Python script which you can use to download all images from a remote directory say from I have used beautiful soup to do all the heavy-lifting. from BeautifulSoup import BeautifulSoup as bs import urlparse from urllib2 import urlopen from urllib import urlretrieve import os import sys def main(url, out_folder=”D:/deckfinal/”): soup = […]

Free Blue Corporate Style CSS Web Template | Knowpapa Giveaway of the Week

The Free Blue Corporate Style CSS Web Template giveaway of the week by designer/author: Sangita Chaudhary License You are granted the use license which enables you to use this template FREE of charge. Because this is released under Creative commons license, You can modify the theme in any way you like and even use it […]

Capture Image using android.hardware module

The module provides a direct access to camera API and is the preferred method of taking pictures when you need a finer control over various camera parameters. The first step involves adding the following to your AndroidManifest.xml <?xml version=”1.0″ encoding=”utf-8″?> <manifest xmlns:android=”” package=”com.knowpapa.camerademo” …. > …… <application …. …. > <activity ……… android:name=”.CameraDemoActivity” android:screenOrientation […]