Showing posts with label project. Show all posts
Showing posts with label project. Show all posts
Project can be categorized to my free lancer career. Identifying the distance of a object by using image processing is currently on research level when we considering very accurate value. In this project I have succeed to measure a distance of a object by mapping to points get by user inputs. I used python as a programming language and opencv as a framework for image processing.

Use cases are shown below to measure a distance of two points.

  • Image should be added as a input
  • User should be clicked to point if he/she wants to measure length     
When a user clicks a point its coordinates can be get using image processing techniques. It's not that much difficulty to locate. Image can be considered as a 2d matrix. That means if it is a pixel * b pixel image it can be represented as a a * b matrix. When a user clicks a point its coordinates can be identified by using above mentioned matrix.       

Example

[  .  ] 
[ . . ]
[. . .]

        This image can be represented as a matrix by assigning 255 for black dot and 0 for white dot. According to the above definition image can be represented as below.

[0 0 255 0 0]
[0 255 0 255 0]
[255 0 255 0 255]

Hope you get the better idea about that. So after user clicks two point I calculated the euclidean distance of those two points. Then by using that how can we calculate the actual length.

I solved it using pre-defined value. In order to calculate it I followed below steps.

  • Camera to object distance should be a constant (2 m). I will explain it later.
  • Capture a image of a object.
  • Measure a length of known two points. 
  • Entered above captured image as a input to the program.
  • Calculate its euclidean distance.     
Then we can define a small equation for known euclidean distance. Below variables can be used to represented it.

a - Actual length of known two points
e - Euclidean distance of known two points calculated from the image array (Describe above)
y-  Euclidean distance of unknown two points calculated from the image array 
x - Length of unknown two points 

Equation can be generated according to the above variables.

a / e = x / y

Therefore, x = y * ( a / e )

The value of ( a / e ) is a constant.
So , ( a / e ) = c

x = y * c

If you carefully read my article you are able to realized that you can get very accurate distance for this image.
But the problem is how can we use this equation and the constant for all images that input for the application. 
We defined above constant using a ratio. It's depend on distance of the camera and the object. In order to use this constant for all the images distance of camera to object should be a constant.
That's why I mentioned it above.

Now you should have a problem about this. In order to get the euclidean distance each pixel should be represented to the user to get input click. The problem is if user inputs a image with large number of pixels (Ex - 2000 * 3000) screen is not enough to represent it.

As a solution for the above problem I had to reduced the pixel size of the input image. But this can be harm for our constant. So when you define the constant this step should be added to the above flow too. And the import thing is this reducing factor should be a constant for all the input images. Otherwise our constant not be a constant any more. 

By using below link you can download my source code from GitHub and you can test it using your own input images.
But there is a problem which still not solved. I used a decimal factor for the reducing image pixel size because most of the images lay with 2000 * 3000 pixel size. That's a assumption. So If you input a image with low pixel size my calculations can be wrong. So when you input a image please remember to re-size it to above mentioned pixel size.         

Complete Application - youtube
The requirement of the project is to create a blogging platform that allows users (admins) to create & manage content,
approve public comments and track site statistics

Design
The major specifications were:

  • Admin is able to register/create new users/admins
  • Links to the most recent posts (10 or so) are shown in the homepage
  • Admin can create and edit posts
  • A post contains a title, post text and a unique id, which corresponds to its direct URL
  • The comments added by the public and approved by any admin will be shown in the post
The Design


We used JSON files for each post to store their titles, text, comments, author names and view counts. These were
accessed and viewed (and changed) through servlets and JSPs as needed.
The required core functions were completed. Also the statistics for each post can be viewed.
Form based authentication (instead of Basic auth at its simplest level) was used so that it would be easier to the user
and can be changed to fit the appearance of the site while the credentials can be accessed through JavaScript.

Implementation
Workflow

URL Handler Auth Functionality
/ index.jsp None Shows the posts (10 max) in reverse order. Has buttons for logging-in, adding posts, viewing statistics
/ClickedPost?id=19 ClickedPost (servlet) None Shows the plaintext (or HTML) of the post with title and a comment box
/PendingComments PendingComments (servlet) None Stores the new comment in the corresponding JSON file but does not show it yet in the post
/newpost/approval.jsp approval.jsp FORM Shows the list of posts which point to the comments-approval page
/newpost/Approval?id=19 Approval (servlet) FORM (above) Shows the authoring admin name, a button to view the pending comments and a link to edit the post
/ index.jsp None Shows the posts (10 max) in reverse order. Has buttons for logging-in, adding posts, viewing statistics
/ index.jsp None Shows the posts (10 max) in reverse order. Has buttons for logging-in, adding posts, viewing statistics
/newpost/commentsApproval commentsApproval (servlet) FORM (above) Shows the list of approval-pending comments with checkboxes to approve and a submit button
/newpost/edit editPost (servlet) FORM(above) Shows textboxes to edit the current title and text of the post with a submit button
/newpost/commentsApproval commentsApproval (servlet) FORM (above) Shows the list of approval-pending comments with checkboxes to approve and a submit button
/statPost?id=19 statPost (servlet) None Shows the corresponding post’s title, its total view count and the number of comments
Security


Authentication
We used form authentication to authorize the admins/writers at the loggin-in page (see above). The admins need to

add the entry for the users at tomcat-users.xml.

Non-standard Libraries Used

  • json-simple/simple-json was used for accessing (change & read) post JSONs
  • As the name suggests and with similar requirements of the system, this seemed sufficient
  • Plaintext or CSV files and even XML formats were considered, but eventually this was selected becuase it seemedmuch more simpler

GIT- https://github.com/tharinda221/BloggingSystem

Our Project


Using Android devices communication can be done with 2 or more parties using this application. This project is on developing an android “walkie talkie” app to send voice to other android devices using multicast methods.

How it’s done



This is our design structure. We added five classes. There are shown in the bottom level. Initially the devices you want to communicate should be connected to the same wi-fi network before opening the app. If not the application would not work. All the devices which are in the wifi network and running the app are able to hear and talk.
This is one – to many broadcasting mode.One to one transmitting is simply can be done using above mode.


Record- Records audio and puts it to a queue. Interrupts and waits if pauses.
Play- Plays the audio. Interrupts and waits if pauses.
Client- Receives multicast packets. Resolves and takes to a queue. Makes the stream.
Server- Creates packets to send with the maximum buffer size.Uses multicasts the packets. Uses thread to create and send packets.
AudiocastActivity-Handles the ui Opens new threads for play.java and record.java when buttons are pushed and starts receiving and playing.

Future development.

  •  As the core implementation is successful future development mostly developing the ui class.
  • Developing a Nicer interface.
  • Developing interface such that it works as an actual walkie talkie.      
  • actual walkie talkie enable only one side communication at once. Our implementation is more duplex. By changing the ui it can be achieved.
  • Clearing the audio.



Abstract

In the modern era with the advancement of technologies, it is important to make human life easier and simpler. Sri Lanka can be considered as a green country where a plant is valued a lot and regular watering is essential part in taking care of it. Also in a country where agriculture is a strong point in economy and an automated watering system would serve the as a great solution for problems facing in growing up a good plant and make it convenient to do so. It'll reduce water wastage and minimize the manual intervention needed.

Table of Content

1. Introduction
2. Motivation
3. Objective and Scope
4. Literature Review
5. Requirement Analysis
6. System Design and Architecture
7. Conclusion and Future work

1. Introduction

Watering plants could be sometimes time consuming and with busy life schedules attending to them daily could be inconvenient. Aim of out project is to develop an automated watering system that would take care of the watering without manual intervention effectively saving lot of cost and yet satisfying plant's needs. This report presents the design for such a system.

2. Motivation

Almost every house at least have a small garden and even with all the developments and apartments still there is a place at our homes for a few plants. Yet if you ask what's the major challenge in having a garden or plants the answer would be watering. With all the busy schedules and life styles it would be easy to have a automated system to do the watering. When going out for vacations or at times you suddenly remember that you forgot to water the plants we might have to rely on a neighbor or sometimes it's going to be a hard time for the plants.
Also in commercial use like in farms and it takes a lot of time and to be done in a reasonable time it takes lot of human resources. To make farming effective it's important to reduce those additional costs and look for more feasible options.
So we wanted to create a affordable automated watering system to overcome those problems.

3. Objective and Scope

The objective of this project is to design an small scale automated watering system that'll take care of watering without human intervention. We considered aspects like Installation cost, Water Saving, expandability when designing the system.
Installation cost should be low so that it's affordable and worth considering for use. Effectively watering when needed will save water wastage and We wanted to create an system that is expandable and customizable as per requirements.

4. Literature Review

Similar items are available with agriculture equipment manufactures like hunter, hozelock, Gardena.
http://www.hunterindustries.com/en-metric
http://www.hozelock.com/watering/auto-watering.html
http://www.gardena.com/au/water-management/water-controls/
Most of them doesn't present with customizations and with their high end equipment they can be costly. We're implementing our system as client- server module which can be used for many customizations and extensions can be added easily.

5. Requirement Analysis

We wanted to develop an fully automatic watering system. So the system should be able to understand when the water is needed and provide according to requirement.
• Read data from moisture sensor and send them to server
• If levels are low get weather details to check for rain
• Send the command to water

6. System Design and Architecture


To understand when to water we use an moisture sensor which measure the water content in soil.
The readings were acquired from the arduino board which act as the client and send to the server.
If the levels are low server will contact the open weather API and get weather details. If it's not going to rain it will send an response back stating to start the pump. when the moisture level comes to a acceptable level it'll send the signal to stop the pump.


Flow Chart
Server Implementation
We implemented a simple login system which is handled by the login servlet. Arduino board is sends moisture levels to the moisture servlet as a GET requests. It is saved in the servlet context on the server side. Ajax can be used for update these values on the client side without refreshing the page. Watering servlet is for sends response to the server whether it is going to rain or not. So when the arduino board sends a request to the Watering servlet sever have to sends GET request to the open weather API and get the response from it. When the watering is finished arduino board will sends a request to the finished servlet including watering time as a parameter. Welcome servlet is to fetch all the result from servlet context and simulated in the main page.

7. Conclusion and Future Work



Our design is a simple beginning system for an automated watering system. Since it's a working prototype there are lot more improvements to be made in practical implementation. The cost is relatively low and could be implemented for a small garden in home and it'll be a home improvement worth considering.
With our client-server implementation it's widely open for customizations. Other devices can be set up such as mobile phones to monitor watering from connecting to web. Also watering times can be setup as we wanted and manual system can also be implemented where user will be notified when moisture levels are low through ussd/sms and he/she can order to water the plants. For all these just little modifications in code is needed.
Gknow is SinGlish USSD app which the users will answer gen. knowledge, Math and logic questions. And Compete with all users to become the top in the leader board. We have done this for dialog kandy app challenge.

Team members

Tharinda Ehelepola
Namodaya yasas
Thisaru Guruge
Lahiru Srimal

Actually we spends 2 sleepless nights for done this. The initial idea was came from my mind.  

What is Gknow?


  • SinGlishUSSD app.
  • Users will answer general knowledge, Mathematics and logical questions.
  • Compete with other users to rise up in the leader board to become the master Braininess.

What GKnow does?
  • Providing a platform to gain general knowledge.
  • Improving math and logic thinking.
  • Providing an opportunity to compete with other braininess.
  • Creating effective way to spend your leisure time.  
Technical part of Gknow

       We used PHP and mysql as programing languages. Read user inputs and send them to MySQL database using PHP.  And also Send the response to the users returned by MySQL queries.
       First we drew a small ER diagram. According to the ER diagram database has a table named “user” with columns for name and unique phone number.  Questions table to store questions and answers and Answered table to store answered questions numbers. Also used Triggers and MySQL functions.

dial #771*910 on dialog mobiles. Try it yourself.

Facebook page

https://www.facebook.com/gknowpera


Github

https://github.com/tharinda221/Gknow






This is my 2nd year academic project.time duration is 7 week.I have only 1 week to finish this.but 90% finished now.I'm willing to tell you the brief introduction  about this project.the title is Blocking ssh bots.

The secure shell ssh is a service that is used remotely login to unix-like systems. Attackers use bots to attempt brute-force logins on unix servers running ssh.The proliferation of these botnets targeting the ssh service poses a security to unix servers. Build a system todetect, block and, analyse ssh botnet attacks on servers.

I made a simple tool that detects brute-force attempts by analysing the ssh server logs. Typically, a large number of (failed) login attempts from same ip address indicates a bot.Once a bot is detected it can be blocked by adding a (dynamic) firewall. Periodically, these blocks must be used to save memory and,

prevent permanently locking out a particular ip.

after that i implement below extensions.
1.If the number of attacks originating from a subnet exceeds a given threshold, block the entire subnet. Subnet block rules should be expired faster than individual ip block rules.

2.Visualise the botnet activity using Google maps . using GeoIP database to map an ip to its
geographical location.
each sever has a unique format.i did this for our university sever.still trying to do for any sever.if i can implement this for do that definitely i'm willing to show you that.
I'm really confused with blocking a subnet which is a large number of (failed) login attempts.looking for extend my code to do that i have to get a subnet mask of a ip address.because that including the whole IP address'which are coming from the same area.In order to do that I wanted to use a sever.
http://cisconet.com/route-server/world_map.html
it was help me to find a sever.then i used command prompt to get a subnet mask of a IP address. i used route-server.ip-plus.net as my sever.

>>telnet route-server.ip-plus.net
*** Swisscom IP+ route server (AS3303) ***
RS_AS3303>show ip bgp 123.132.123.4
BGP routing table entry for 123.128.0.0/13, version 78278792
BGP Bestpath: deterministic-med
Paths: (1 available, best #1, table default)
  Not advertised to any peer
  Refresh Epoch 2
  (65000) 3320 701 4837, (aggregated by 4837 219.158.1.45)
    164.128.32.11 from 164.128.32.11 (138.187.128.158)
      Origin IGP, metric 601000, localpref 300, valid, confed-internal, atomic-a
ggregate, best
      Community: 3303:3006 3303:3067 3320:1840 3320:2020 3320:9020


highlighted  is the subnet mask.i was confused about how do i do this using java.
http://twit88.com/blog/2007/12/22/java-writing-an-automated-telnet-client/
above link was very helpful for me to face above problem.this is the way how i did the subnet part.
implemented code is here.
https://github.com/tharinda221/BlockingBots/

I created a simple GUI to present my project.
that is here
https://github.com/tharinda221/BotsInt

you can use this code for your sever.but you have to change the regular expression for matching your log file.

thank you.
Powered by Blogger.