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 www.example.com/dir1/. 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 android.hardware.camera 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=”http://schemas.android.com/apk/res/android” package=”com.knowpapa.camerademo” …. > …… <application …. …. > <activity ……… android:name=”.CameraDemoActivity” android:screenOrientation […]

Android Code to Capture Image Using the Built-In Camera App

The simplest way to capture an image is to use Android’s built-In camera app capabilities via the intent filter. The intent filter of the built in camera app is named: android.media.action.IMAGE_CAPTURE Accordingly to access this function you simply need to create an intent that would be caught by the above filter. In addition you need […]

Getting Started with LibGDX for Android Game Development

Getting the Development Environment Ready 1) Install Java Development Kit (JDK) 2) Install Eclipse 3) Install and Configure Android Software Development Kit(SDK) 4) Download Libgdx Prerequisites The tutorial will assume a certain level of familiarity with Java language. I also assume a basic level of familiarity with Android API assuming you understand basic terms like […]

Open GL Error Fix for Windows 7 and XP

So you have been playing your favorite game (Angry Birds anyone ?) in your android or iOS mobile phone and now you decided to play it on your desktop only to get an error that reads something like: OpenGL 1.x/2.0/ renderer not supported or DirectX renderer not supported ? OpenGL (Open Graphics Library) and DirectX […]

Android: using XML to Persist Data

If you have a handful of data to be stored, using SharedPreferences to persist your data may not be very convenient. Android lets you store data as XML file and then read it back into your source.Using XML you can make up your own custom tags to store data in a file that is both […]