GSoC: Porting KDiamond (game) to Qt Quick

Yesterday, my proposal was selected by KDE for the Google Summer of Code 2012 program. So this summer I’ll be busy working under my GSoC organisation i.e. KDE with my mentor Ian Wadham and co-mentor David Edmundson.

About my project:
My project involves the idea of porting a KDE game “KDiamond” to “Qt Quick”. Here’s the abstract from my proposal

“KDiamond is one of the addictive KDE-Games. Whilst the game is very intuitive to play, I feel that the gameplay and the user interactions can be improved to make it more complelling. My proposal is to port KDiamond to Qt Quick – which would allow me to enhance the UI for better gameplay, and with the UI capabilities of QML – give a new feel of the game to the player. I also plan to add some more UI components like – dialogs, particles effect, transitions to the game to to make it more engaging and fun to play!”

Why I chose to work with KDE-Games:
Over the past 2 years I have been working with Qt/QML. The idea of developing games using Qt Quick has always attracted me. In fact, I have already developed games using Qt Quick for mobile. In the past couple of months, I have learned about KDE development environment. Hence KDE-Games seemed the perfect category to work on!

I’ll try to post more updates about my GSoC activities here. So stay tuned!

Advertisements
Posted in Awards, Game, GSoC, KDE, Open Source, Projects | Tagged , , , , , , , | Leave a comment

Nokia Developer Champion

Nokia Developer recently announced this year’s Nokia Developer Champions and I am glad to say that I have been entitled as “Nokia Developer Champion“.

I would like to thank the Nokia Developer Community for rewarding me with such an important title and inviting me under their elite mobile developers group.

Check my Nokia Developer Wiki contibutions here.

Posted in Awards, Nokia | Tagged , , | Leave a comment

Progress with my Handwriting Recognition Project

I am back with more updates on my handwriting recognition project!

In my last post, I talked about developing Scribble-pad for accepting user input that we can process for handwriting recognition. Another way of capturing input can be by a phone camera, so the user can just click a picture of the text. I’ll post about the camera input in a separate post, but today I would like to show you how I did some image processing on the image we saved from the Scribble-pad.

Going for the complete handwritten word seemed too ambitious to me, so I’m going to start by recognizing a letter first!

Logic

First we allow the user to write a letter and save it to a file using our Scribble-pad.

A possible way to recognize the letter could be to compare the saved image with all the other english alphabets and numerals. If it matches to a threshold percentage, it’s more likely to actually be that character. There can be some errors because the style and size of the handwriting of every user would differ. We can do some amount of image processing to detect if the user’s handwriting is too small to compare and enlarge it to a working size, however nothing can be done if the user has bad handwriting. (So, my engine wouldn’t work if you have a really bad handwriting)

Implementation

So following the logic I outlined above, we would need source images of all the characters of english letters and numerals. Where do I get these from? The answer is to generate these images from Qt.

Here’s how I generated the images for upper case characters A-Z. These images were generated as follows,

ascii_counter = 65;
QFont font("Mangal",12, QFont::Bold, false);

for(int i = ascii_counter; i<91; i++)
{
QPixmap pix(20,20);
pix.fill(Qt::white);
QPainter p(&pix);
p.setPen(QColor(0,0,0));
p.setFont(font);
p.drawText(QPoint(3,18), QString(QChar(i)));
pix.toImage().convertToFormat(QImage::Format_Mono);
pix.save(FileRoot+ "img_"+ QString::number(i) +".bmp");
}

Similarly, I generated images for lower case characters a-z and numerals 0-9. I used the image size as 20x20px, just because I feel they were sufficiently good for comparison. Besides, the bigger the resolution, the bigger the size of the images!
Note, I also experimented with the font that is used to generate these images. I am using Mangal, size 12, Bold font here, but we can generate the character set for multiple fonts if we want our engine to be more efficient. For example, Lucida Console handwriting font would be good for running handwriting.

Now, to compare the user scribbled image (let’s load it in desImg) with the images that I generated. Here’s how I’ll do the comparison,

QPixmap recalculateResult()
{
QPainter::CompositionMode mode = QPainter::CompositionMode_Screen;

QPainter painter(&resImg);
painter.setCompositionMode(QPainter::CompositionMode_Source);
painter.fillRect(resImg.rect(), Qt::transparent);
painter.setCompositionMode(QPainter::CompositionMode_SourceOver);
painter.drawImage(0, 0, desImg);
painter.setCompositionMode(mode);
painter.drawImage(0, 0, sourceImg);
painter.setCompositionMode(QPainter::CompositionMode_DestinationOver);
painter.fillRect(resImg.rect(), Qt::white);
painter.end();

return QPixmap::fromImage(resImg);
}

Generated Images


Continue reading

Posted in Code Example, Nokia, Projects, Qt, Qt Quick, Symbian | Tagged , , , , , , , | Leave a comment

Scribble-pad for my Handwriting recognition project!

In my first blog post, I mentioned about my interest to work on handwriting recognition. I’ve been working on it since quite some time now, just didn’t get time to post intermittently. I thought it’s a good time to publish what I’ve been doing on this hobbistic project of mine.

In this post, I’ll share one way of accepting user input i.e. by building a scribble pad. This is one of the most intuitive ways of capturing user input for further processing.

So I decided to create a scribble-pad myself, and what better development technology could I use than Qt and QML. (Fyi, using Qt and QML in an application – gives a Qt Quick application, as they call it)  So, today I’ll be talking about this scribble-pad component in my handwriting recognition exploration.

Here’s how the scribble-pad is finally going to look like! I didn’t concentrate much on the UI part of the scribble pad, but it works well on a mobile device too – I’ve been testing it on Nokia C7.

Let’s now get into the technical implementation of the scribble-pad. The UI of the application is written with QML while some of the engine part (like saving the painted image) is done with Qt.
Continue reading

Posted in Code Example, Nokia, Projects, Qt Quick, Symbian | Tagged , , , , , , , | Leave a comment

Basic image processing – Qt to WP7 transition

This article explains the basic image processing both in Qt and Windows phone 7.

The following tasks are performed:

  1. Opening an image from the Gallery
  2. Edit the image / Adding a frame to the image
  3. Saving the modified image

Qt Implementation

To open gallery with Qt, Qt Mobility provides the gallery module which needs to be imported.

import QtMobility.gallery 1.1

The .pro file also needs the following configurations for accessing the gallery module,

CONFIG += mobility
MOBILITY = gallery

To access gallery either use QML DocumentGalleryModel Element or QDocumentGaller for Qt. The DocumentGalleryModel provides a media model to be used with one of the View elements.

GridView {
	anchors.fill: parent
	cellWidth: 128
	cellHeight: 128

	model: DocumentGalleryModel {
		rootType: DocumentGallery.Image
		properties: [ "url" ]
	}

	delegate: Image {
		source: url
		width: 128
		height: 128
		MouseArea
		{
			anchors.fill:parent
			onClicked: console.log(url)
		}
	}
}

DocumentGalleryModel also supports other media type like Audio, and it can be accessed by changing the rootType,

rootType: DocumentGallery.Image

Continue reading

Posted in Code Example, Nokia, Qt Quick, Symbian, Windows Phone 7 | Tagged , , , , , , | Leave a comment

GWhacko!

This week I have been working on a game. Finally here’s the first version of the game which I decided to call GWhacko( yeah, GWhacko!)

GWhacko is a game developed for Nokia devices. It is developed using Qt SDK 1.1 The game uses basic concepts like the Timer, image switching and view switching.

You click the bad guys and whack them while making sure you do not whack the good fellas.

Here’s a video of GWhacko in action

Posted in Game, Nokia, Symbian | Tagged , , , , , | Leave a comment

Contributor of the Month – December

Hello everyone!

Recently, Nokia Developer has selected  me as the Contributor of the Month for December for my contributions in the Nokia Maps category.

Thank you Nokia Developer for this title and the wonderful Nokia Lumia 800.

Refer to my articles: MapPlacesDemoMyMapDemo

Posted in Awards, Location, Nokia, Open Source, Projects, Qt Quick, Symbian | Tagged , , , , | Leave a comment