Sunday, May 31, 2015

Line Detection - Source Codes

These are the source codes for the previous post, "A Day with Image Processing". Remember the app we did for the line detection using OpenCV. So to run these source codes, first setup your IDE environment suitable to run the OpenCV according to the tutorial mentioned in that post.

Follows is the folder structure.



LineDetectionFrame.java


LineDetectionUtilities.java ImageViewUtilities.java ImageBrowserUtilities.java

A Day with Image Processing

Head full of Image Processing and Vision in the last day of Semester 3 to cover up the whole syllabus from 8.30 AM to the evening. At the end we had to present a little application we had to implemented on following topics.

1. Vehicle Number Plate Detection and Recognition
2. Eye Detection and Sleepiness detection
3. Steganography
4. Panoramic scene creation
5. Human face matching using SIFT/SURF features.
6. Palm based mobile authentication using Scale Invariant Features (eg. SIFT, SURF)
7. Suit recognition of a card pack.
8. Video compression using similarity of frames
9. Eye based mobile interface
10. Expression detection happy, sad, angry.
11. Line detection of an image
12. Any other image based application (need to get approval).

So this is about Line Detection of an Image which is the easiest among all. :) This was implemented by using the library OpenCV for Java in the Eclipse environment. Addition to the jar file library, it comes with a DLL file. So you have to follow its tutorial to find out how to setup your Eclipse environment. Even though it works perfectly in Eclipse after configuration, still I couldn't been able to findout a way to export the application as a runnable jar due to this DLL issue. (Please direct me if you find a properway :) )





Most of the important facts about the technique which used to do the line detection is explained in the slide. Therefore here I will give you few of the screenshots of the application.

Load an image to the application


Images can be either *.jpg, *jpeg or an *.png formats. OpenCV handle these images very easily. I didn't had time to search how to deal with other image formats like *.tiff and *.gif. Hope there is a way to do with them too with a little bit of more coding.

All of the techniques used below are in more detail in the OpenCV turorial for image processing. Have a check in there.


Line Detection


What you see with red colored in the image are lines which have been detected. I limited the lines upto a certain limit. Because sometimes if you do not optimize your image as a better image feed to the Hough line transformation (Not Blurring the image), then it would detect unnecessary lines too. So better to have a limit. See the below screenshot that captured without using the blurring step and see how the lines have been detected unnecessarily.


Edge Detection 

Every image cannot be feed into the Hough transformation. You have to feed an edge detected image. Where the white line represent the edges and black area shows the non-edges. Then what happened is described in the slides.



Blurring the Image

The edge detection plays a important role in here. If we didn't do a good edge detection then the line detection would totally go wrong. So first thing you have to do is optimize the image that feed into the edge detection. One thing you could do is remove the effect of the noisy pixels. That can be done with blurring the image.


To blur the image you have to findout a good sigma value for the blurring. That means how much of blurring would do a good job in edge detection. Well.... too much of blurring would give the following result.


So don't use too much of blurring. Also you had seen what would happened if you don't use the blurring. Therefore best thing to do is use blurring, with less amount. In OpenCV you do not necessarily need to specify the Kernal size 3 x 3 or 5 x 5.... It would automatically select according to your sigma level.

Grayscale

With the results I got this option is really not necessary. But sometimes you may find it valuable.


Finally, let's try another image of a road.


Thursday, May 21, 2015

Can You Remind Everything?

There is no way that you can remind everything that you have read. Specially the things that you have read in the web. 

The tool which is I'm gonna talk about is really helps me to do my project to solve the problem regarding the above matter. You know there are lot of stuff to read when doing a masters project. It's a good tool which keep everything in-order. That keeps everything what you have read in the web in a manageable way, so you can later look back and put on to your minds again. 

Before moving on I would like to share the first advice we received from our supervisor.

"Pl continue reading the related literature (research papers, phd thesis etc) related to your topic. if reading a PhD thesis reading the introduction, literature review, design  and evaluation chapters would help in understanding the related past work. 

Also you need to create a private blog or a google site for the project. Keep updating   important URLs, reflections, critical reviews, design-implementation- evaluation design decisions  etc as it is useful in compiling the dissertation subsequently."

So you know, I'm posting this thing because of the later part of the above paragraph. Anyway in a someday this might be helpful for another student to carry on with the project.



Zotero, the tool that keeps every URL in a better way to look back again. There are lot of tools that do the same thing. But now I'm used to Zotero so I'm moving with it. It's freely available and a software that comes with a browser plug-in which ever you prefer. I use Chrome and Firefox, so do not have any issues up to now. 

After installing it you just need to create the folder structure in the software as you preferred. Thereafter whenever you thinks that the web page that you are reading would be useful and that need to reminded for any future use, you just need to right click on the web page. With the menu appears you can simply select to save the web page on Zotero.



Today reading the article to get to know about Research Methods.

Wednesday, May 20, 2015

MCS Final Year Project Journal

Started to work on the final year project of masters. Hope this post would make the motivation to end up it in this year.


Device is ready, Proposal is ready and here we goes with the Journal Day 1.


The Problem

Most of the educationists all over the world suggest that, for a kindergartener, the first tool that should be used to teach writing, more specifically the letters in the alphabet, must not be a pencil, pen, marker or a crayon. What they recommend is child should use their fingers first. And that’s why in Sri Lankan culture they had this tool called “valipilla” (වැලිපිල්ල) to teach how to write. It’s an ideal multi sensory approach to teach the alphabet because the muscle movement help children to process what they are writing and make it more likely to stick in their mind. But in this way there need to be always an instructor behind the child to provide the guidance how to write.

The recent technologies in vision based sensors are competent enough to capture the finger positions and movements. So if a computer system could track this finger movement trajectory precisely, we can use this trajectory input, to recognize as an alphabetical character in real time when someone writes with a finger. So with this approach we could easily replace the physical instructor and provide a finger gesture based virtual platform for the child, to improve his writing ability all by his own. In other means it will add a higher value to the child education system by having an automated application to check whether the child has written the letters in the alphabet in correct way and by that provide the guidance to write it correctly.


Objective of Project

The main objective of this project is to research on a way to implement an accurate virtual platform to practice in writing English alphabetical letters using finger gesture and provide a developed tool as the concept of proof. Also it is expected that this proposed tool would be a supportive platform in the child education system to improve their writing ability.


Related Projects

There are lot of approaches to recognize handwritten characters. The challenging part of this is combining those approaches to recognize something written in the air with finger gesture, and also capturing those finger gesture trajectories by accurately identifying the start and end of the letter stroke. Still the related works carried out in the research space are lacking of its accuracy, and the performance depends on the used recognition technique and letter strokes capturing mechanism. Following are some of the related research projects which have used different recognition techniques and capturing mechanisms. But the focus of these projects was to build up an air handwriting recognition tool, and not to make it as a supportive tool for improve children’s writing ability.


Scope of Project

The development scope of the project is bound to the following areas mainly targeting on implementing an interactive finger gesture based learn to write tool for English alphabet.

Capturing: 
Develop a process to efficiently capture the index finger gesture movements and correctly identify gesture pauses in letter strokes. It is expected to use the Leap Motion Controller device with its API as the main sensor device to capture the finger gesture. 
Recognition: 
Develop a process to match the finger gesture input trajectory data with the expected trajectory in real time. It is expected to find a suitable character recognition technique from the literature survey.
Writing: 
Make an interactive user interface with a drawing area to interact using index finger gesture.
Display Results: 
Provide feedback to the child, whether he has written the character correctly or not.

Saturday, May 16, 2015

Front Line Messages

When I was a kid, after coming home from the Montessori or the primary school;that I couldn't exactly remember; I used to listen to a program on the radio aired in some Sinhala SLBC channel called "Ranabimen Niwahanata" and "Nivahanen Ranabimata" (රණබිමෙන් නිවහනට නිවහනින් රණබිමට). Which means "From battlefield to home" and "From home to battlefield". Actually I didn't followed the program, that station was worked 24/7 hours at our home when I was a kid (regime of CBK) even no one was there to listen; that I don't know why :D

In the Niwahanen Ranabimata නිවහනින් රණබිමට segment, the announcer aunty;don't know her name, I guess she is still there at SLBC; read the messages of war hero families sent to their beloved who is battling at the field. And the Ranabimen Niwahanata රණබිමෙන් නිවහනට segment, someone at the battlefield; with disturbed noisy transmission; read the messages of the heroes in the battlefield that need to sent for their beloved families. Even though there was no one to send me a message or that I could send a message, I used to listen to that program. Actually it was there so that I heard it. 

I was really very wondered in those days while listening to this program, why on earth they didn't directly send those messages to their beloveds rather than making it to tell publicly to everyone. You know, these messages were not only best wishes or good lucks. Really really homey stuff. So.... it took me donkey's years to understand why they couldn't do it. Actually after watching the movie Border (1997)


Remember, in those days there were no mobile phones, no internet, no communication centers, having a land phone was even not affordable for middle income society. So for a letter, it will take good many days or months to send or receive to and from the front line battlefield. So this program was a collaboration between the army post and the SLBC to bridge the gap and make families more nearer. 

It is not good to peep into other people stuff. But I can remember, I really liked to listen to those messages and tried to get that feeling at their homes. (Like as it mentions in the "Wav bandi Rajje Sawaariyak" වැව් බැඳි රාජ්ජේ සවාරියක් book.) Actually all I wanted was, to grab the positions of their names. I could remember most of the positions of those messages are address to and from the positions of "Samanya Sebala" සාමන්‍ය සෙබළ. With that position, both the announcers she and he in the two ends read a number. May be the numbers that soldiers held in their necks. I really liked the rhythm both the announcers had, when telling the whole thing. And yeah, there were corporals and lance corporals too if could remember. So... now I know they are the lower ranks and you can realize the whole scenario with the support of the following extract.

අසූව දශකකයේ අග භාගයේදී යාපනය කල්මුණේ තුඩුවට පහළින් පිහිටි  කෝමාරි තුඩුවේ වේග ප්‍රහාරක යාත්‍රාවක සේවයේ යෙදී සිටි අවධියේ. මම එතකොට ප්‍රහාරක යාත්‍රාවක අණදෙන නිලධාරියා. ඔතැන නාන ළිඳක් තිබුණා. අපි නෑවේ කාල සටහනකට අනුව. මුලින්ම නාන්නේ ඉහළ නිලධාරීන්, ඊට පස්සේ සැරයන්වරුන්. ඊටත් පස්සේ සෙසු නිලධාරීන්. අන්තිමට නාන්නේ කනිෂ්ඨ නිලධාරීන්. දවසක් ඔය ළිඳට නාන්න යද්දි මම දැක්කා කාල සටහනට පහළ අඟුරු කෑල්ලකින් මෙන්න මෙහෙම කවියක් ලියලා තියෙනවා. 


උඩ වතුර තරු වලට

මැද වතුර පටි වලට

මඩ වතුර පොඩි අපට

කොටි ගහල මදි තොපිට


මේක දැකල අනිත් උසස් නිලධාරීන්ට නම් තරහත් යන්න ඇති. නමුත් මට නම් හිනා ගියා. මට හිතුණේ මේ කවිය මොන තරම් නිර්මාණශීලී ද කියලා. පසුව මම ඒක කොළයක ලියා ගත්තා. මෙවැනි බොහෝ හැඟීම් දනවන කවි තැන් තැන්වල බංකර බිත්තිවල දකින්නට තිබුණා. ඒවා හරිම ලස්සනයි.

බොහොමයක් පිටපත්කර ගත්ත ද පසුව ඇති යූදමය වාතාවරණය සමඟ ඒවා සුරක්ෂිතව තබා ගැනීමට නොහැකි වුණා. ඒ දවස්වල අපට ජංගම දුරකථන, ඩිජිටල් කැමරා තිබුණේ නැහැ. එවැනි දියුණු තාක්ෂණික උපකරණ එදා තිබුණා නම් මෙවැනි බොහෝ කවි නිර්මාණ දැකගන්නට ඉඩ ලැබෙන්නට තිබුණා.

මේ දේවල් සොල්දාදුවෝ නිර්මාණය කළ කවි. සොල්දාදුවන්ගේ නිර්මාණශීලිත්වය පෙන්වන්නට කදිම නිදසුන්. ඒ වගේමයි අලංකාර චිත්‍ර පවා දක්නට තිබුණා. නමුත් අපිට ඒවා සුරැකීමට තාක්ෂණය තිබුණේ නැහැ. එසේ වූවා නම් යුද සාහිත්‍යයේ නිර්මාණ එළි දකින්නට ඉඩ තිබුණා.
නාවික හමුදාපති වයිස් අද්මිරාල් සෝමතිලක දිසානායක -

Even though this program bridge the gap, the families nor our heroes know whether their beloveds had heard the message. There is no way to confirm it. Maybe sometimes their dearest is at the front line duty and not free to listen to it or sadly already died at the field. I remember there were phrases similar to asking his friends who are listening, to give him the message in Niwahanen Ranabimata නිවහනින් රණබිමට segment, or saying that his friend had gave the message in Ranabimen Niwahanata රණබිමෙන් නිවහනට segment.

So now, before the ending of the post, I should mention what is the cause of this post. It is Harshana's next song I'm going to give you. I do not know whether the heroes who send and receive messages through that program, or the names I heard are still live up to today. It's almost more than 20 years back and there were so much battles during these years. I loosed focus of this program there after I went to upper school I guess. Because the program was over when I came home from school or they might have found a better way to have that communication effectively; I do not know. Anyway this song bring back me all that childhood memories of those days with රණබිමෙන් නිවහනට නිවහනින් රණබිමට after so many years. So that's what I'm gonna share with you.

තාත්ත රට රැක ගන්නට ගිය හැටි
තෑගිත් අරගෙන ළඟදිම එන හැටි
ආච්චි කිව් විදියට ලිව්වා
මගෙ රචනෙයි පළවෙනි අම්මේ

තාත්තගේ පින්තූරෙට අම්මේ
ඇයි වතුසුදු මල් මාලය දැම්මේ
තාත්තගේ සුවඳයි මල් සුවඳයි
මට දැන් ටික ටික පැටලෙන ගානයි

දැනගන්නට මං කරන හපන්කම්
තාත්තටත් රචනය පෙන්වන්නම්
කඳුළු බින්දු අම්මේ ඇයි මෙතරම්
තාත්ත මගෙ ළඟදී එනවානම්






Lyrics : Admiral Somathilaka Dissanayaka
Music : Lakshman Wijesekara
Singer : Childish voice of Harshana Dissanayaka


Wednesday, May 13, 2015

Sihinayaki Ra - සිහිනයකි රෑ

Last Sunday 10th May I accidentally saw this musical program "Sihinayaki Raa" (සිහිනයකි රෑ) on National Television (ජාතික රූපවාහිණිය - Sri Lanka Rupavahini Corporation SLRC) presented by ජාතික රූපවාහිණි Mahesh. (couldn't remember the full name but like most of his programs and the presenting)

So this episode it was Sanath Gunathilake(one of my favo actor in childhood, hahaa. - but not now) and Lakshman Wijesekara(One of favo singers still today). There it goes this wonderful song which was requested by Sanath and sang by Lakshman. He does his best to perform it and I like it at the first place. Original song was sung by Milton Perera.