Blindsist – Assisting Visually Impaired People using IBM Bluemix Visual Recognition

This blog post will cover how I developed Blindsist app for Xhacknight.

The app was developed using Xamarin.Forms, targeting 3 major platforms (iOS, Android and Windows Phone) same time.

Blindsist is a simple one page application. Objective of the application is taking a photo using Smartphone, The photo is then uploaded to IBM Bluemix using REST Api. IBM Bluemix returns the data in Json format, which will be parsed and spoken out using Native Text to Speech services.

Open a new Xamarin.Forms Portable Class Project.

Right click on the Project Blindsist (Portable), click Add new Item, Select Forms Xaml Page, name it ScanPage.xaml

Update the XAML content in ScanPage as below

What it basically does is create a Button Called “ScanButton” which on click trigger event handler called “ScanButtonClicked”.

Let us look to ScanPage.xaml.cs for C# code!

In the constructor ScanPage() write following Code.

For this to work, we have to add a awesome library developed by JamesMontemagno.

It can be found here

To install, right click project, Manage Nuget Package, Search for Xam.Plugins.TextToSpeech, install it in every individual projects.

So when the app starts up, It starts speaking introduction to visually impaired user.

Next is adding Button Clicked event. Just copy this code in your ScanPage.xaml.cs

Now right click your Portable class project, right click, add new item. Add new class file, name it Library.cs

Add following data members.

Now add a Member function GetImage() for Getting Image from Camera, The specialty of coming code is that it works in all 3 platforms with single code. Thanks to another library, which is available in Nuget. Search for Xam.Plugin.Media and install in every projects.

It will check whether Camera is available, if not available return a null object with error message embedded.

Else it will create a file, takes a photo from Camera and store as byte[] format, if file is OK, it returns the Image, with Image Url, and Image in byte[] format.

Now add a member function ProcessImage() to process the image by sending to Bluemix Watson Service.

Each line is commented for understanding what happens there. Atlast we get string bb with Json formatted data from IBM Bluemix with possible results in order of priority.

Now revisit ScanPage.xaml.cs, We have to add “GetPicture()” function on button click. Copy the following code.

Now string temp has the json data, we have to parse it to get the results. Add new class file called Classify.cs in PCL project.

Using we can generate class required for parsing json data from IBM Bluemix service.

To parse json data, again there is a good library called NetwonSoft.Json, obtain it from Nuget, and add it to all projects.

Now we need a simple function to perform deserializing json data.

Create a static class Operations, and a function GetMatch()

Now back to ScanPage.xaml.cs, We have temp ready with Json string. Just pass it to Operations.GetMatch() to get the required data back. Add following codes to where you stopped earlier.

That’s all.. Try Building and running the project. If you face any errors it might be due to not adding Nuget Package mentioned in this post for all projects, or some other errors. Feel free to ask. Together we can build this project to perfection.

The project is in github,

Feel free to fork, modify, report errors, ask doubts and do whatever you want with the project for the sake of learning.

Please assist me to add Image Compression, because the image upload to Watson Service and getting response back is taking hell of time now.


How to develop a Xamarin.Forms Hello World Application – Xamarin.Forms Series Part 1

Xamarin.Forms a quick Introduction

Today, we will learn how to develop a cross platform Hello World application using Xamarin.Forms.

Xamarin.Forms is not the final word for Cross platform Mobile app development. It is best for getting started with Xamarin, and targetting 3 major platform by sharing 99% Code.

Xamarin.Android or Xamarin.iOS is best for application dealing with high device specific API  usage like geolocation, and other such capabilities. Through Xamarin.Android or Xamarin.iOS a C# developer can share the business logic among Projects and design Native UI’s and make use of Device specific capabilities for 3 platforms independently.

Xamarin.Forms on other hand can be used for simple application where there is less Platform specific API usage.

Xamarin.Forms is great for prototyping or making a quick prototype application. And after you’ve done that, you might just find that you can continue using Xamarin.Forms features to build the entire application.

Hello World using Xamarin.Forms

To get started you must have Installed latest version of Xamarin, I am using Visual Studio for developing the Hello World application so that I can target 3 platform. But I wont be showing iOS screenshots because I don’t have an Apple device in my network. But don’t worry, all the implementations we do here will hopefully work in iOS device.

Hello World! The first application you probably create when you learn new language or start using new development tool.

I am not covering everything in detail, like the basic C# concepts, or Xamarin.Forms complete capabilities.  This tutorial is intended for Getting started with Xamarin.Forms, everything in detail can be learned from Creating Mobile Apps with Xamarin.Forms Book Preview 2 by Charles Petzold

Open Visual studio, and Create new project.

Select Xamarin.Forms Portable Class Library Project (PCL).  As Xamarin Documentation suggests to go for shared if our Project contains XAML (Extensible Markup language, usually pronounced Zammel), in which we will be developing from now on.

For Xamarin.Forms solutions that contain XAML, we recommend using the Xamarin.Forms Portable Class Library (PCL) template rather than using Shared Asset Projects (SAP). The PCL approach isolates Xamarin.Forms code in a separate DLL, while the SAP shares code directly among the three platforms. Before using XAML with the Shared Asset Project (SAP) template read the details below on enabling experimental XAML support in SAPs.

Xamarin.Forms PCL New Project in VS2015
Create Xamarin.Forms PCL New Project in VS2015.

Xamarin.Forms Projects

The Xamarin.Forms Blank template will set up projects for iOS, Android and Windows Phone 8.0. Feel free to delete any project if you are not going to target it.

Right click the solution, click Build Solutions and Run the project in platform of your choice by setting startup project.

Hint for beginners: Startup Project can be changed by right clicking desired Project in Solution, and Selecting “Set as startup project”.

Screenshot with Blank Template

You can see that app is generated as above screenshot.

Now let us dig deep, so we can understand what is happening.

Each Projects in the solution has

  1. iOS – AppDelegate.cs
  2. Android – MainActivity.cs
  3. Windows Phone – MainPage.xaml.cs

These three files are the starting points of respective platforms. All these files contain a line

Here HelloWorld is our Project Shared, App is the entry point (App.cs) in our PCL Project.

This line invokes the App.cs in the main HelloWorld Project which is where we write code to Share among three platform, which contains

MainPage is the entry point of your app, the first page displayed in app. Why I love programming with help of XAML is that I can write the complex parts like the new ContentPage{ … part in above code in more understandable form.

So We just want to create a new entry page. Right Click HelloWorld (Portable) Project, Click Add new Item.

Select Forms Xaml Page, and give it a name FirstPage.xaml. We will use this project as continuation for next tutorial in the series, navigation of pages in Xamarin.Forms.


In FirstPage.xaml, write the code as below

<?xml version=”1.0″ encoding=”utf-8″ ?>
<ContentPage xmlns=””
<StackLayout VerticalOptions=”Center” HorizontalOptions=”Center” >
<Label Text=”I love XAML” />

Now we will compare with the first set of code we wrote (or was there in default in App.cs).

new ContentPage { is a main node <ContentPage> in xml format

new StackLayout { is a child node <StackLayout> under <ContentPage>

new Label { is again a child node <Label> under <StackLayout>.

In my view this is simpler than coding it in C#. You can code in the way you want.

Now we want this FirstPage.xaml loaded in startup. Just a small changes in App.cs will get it done.

and comment out the rest of part so that you can compare and study.

Now Build the project and run again.

Voila! The new Xaml Page loads in startup.


So in our First Series, we have learned bit more than a simple Hello World app.

We covered

  1. Creating Xaml.Forms New PCL Project.
  2. Building it and Running.
  3. Coding UI in C# and XAML.
  4. Loading any Xamarin.Form Page as MainPage.

Shout out your suggestions, feedbacks and doubts in comment section below. To be frank this is the first time I am writing tutorial, so your suggestions will help me improve my self.

The HelloWorld Solution can be downloaded from my Github (not a good Project to share, still you guys can fork it and start building on it in case of any issues)

Xamarin Students Offer

Hey Guys,

I have been long since I have blogged. Sorry for being away. I think I am the laziest person in this world.

Today I have something to share  with you guys.

Hope you all know about Xamarin, Xamarin is a cross platform mobile application development tool, Which lets you create applications for major platforms such as iOS, Android and Windows Phone. I will be blogging about developing cross platform application using Xamarin. So this tool is sooooooo costly that we students, or startup can’t afford.

Wait, But what if they want you to develop something great? Yea.. Xamarin is free for students, you can apply for a Students license which will let you develop iOS, Android application using Visual Studio or Xamarin Studio.

It is very easy to apply for Xamarin Student License.  Just mail your student ID card scanned copy or some document to verify that you are student to student – at – xamarin dot com.

For more details visit

Sit tight and we will start developing cross platform application from next post onward.