representing a topological map using java - java

I'm developing a indoor navigation program for android, and i'm stuck right at the beginning:
How do you represent a map in java?
I will prefer a way that will allow me to apply Dijkstra's algorithm easily.
note: i need the program to know the size of each room and where are the entrances and exits.
edit: i'm looking for a object to use in the BL not the UI

Android has a built-in GUI element called a mapView that you can add to a screen in your application. It is a Google map and will require you to obtain your applications API key. You can add overlays to it and locate points on the map based on latitude and longitude (I think it supports other methods as well) and these points could be used for Dijkstra's algorithm.
Hope this helps, good luck.

I think, what you are describing is a extended topological map (where you have an estimate on the nodes absolute location). So you basically need a component that can draw a graph with locations attached to the nodes. Also, you might want the possibility to draw addistional stuff (like heat maps for wifi connectivitiy, bluetooth devices or whatever you are using to estimate your position and gather information about the environment). You are also dealing with the SLAM problem.
I don't know of any existing component that can do the visual task for that, but maybe you find something with google. I wouldn't however recommend it. I would just create my own component (using a TextView and draw my stuff on that). It is much more flexible, not that much of an effort and you can choose the functionality and data format, which can be very helpful in such cases...
Once you have all the rest running (which is a lot!), you still can decide to look for some fancy component that may integrate even google maps, is able to zoom or so.

Related

How to determine the position of a car inside an image?

Is it possible to analyse an image and determine the position of a car inside it?
If so, how would you approach this problem?
I'm working with a relatively small data-set (50-100) and most images will look similar to the following examples:
I'm mostly interested in only detecting vertical coordinates, not the actual shape of the car. For example, this is the area I want to highlight as my final output:
You could try OpenCV which has an object detection API. But you would need to "train" it...by supplying it with a large set of images that contained "cars".
http://docs.opencv.org/modules/objdetect/doc/objdetect.html
http://robocv.blogspot.co.uk/2012/02/real-time-object-detection-in-opencv.html
http://blog.davidjbarnes.com/2010/04/opencv-haartraining-object-detection.html
Look at the 2nd link above and it shows an example of detecting and creating a bounding box around the object....you could use that as a basis for what you want to do.
http://www.behance.net/gallery/Vehicle-Detection-Tracking-and-Counting/4057777
Various papers:
http://cbcl.mit.edu/publications/theses/thesis-masters-leung.pdf
http://cseweb.ucsd.edu/classes/wi08/cse190-a/reports/scheung.pdf
Various image databases:
http://cogcomp.cs.illinois.edu/Data/Car/
http://homepages.inf.ed.ac.uk/rbf/CVonline/Imagedbase.htm
http://cbcl.mit.edu/software-datasets/CarData.html
1) Your first and second images have two cars in them.
2) If you only have 50-100 images, I can almost guarantee that classifying them all by hand will be faster than writing or adapting an algorithm to recognize cars and deliver coordinates.
3) If you're determined to do this with computer vision, I'd recommend OpenCV. Tutorial here: http://docs.opencv.org/doc/tutorials/tutorials.html
You can use openCV latentSVM detector to detect the car and plot a bounding box around it:
http://docs.opencv.org/modules/objdetect/doc/latent_svm.html
No need to train a new model using HaarCascade, as there is already a trained model for cars:
https://github.com/Itseez/opencv_extra/tree/master/testdata/cv/latentsvmdetector/models_VOC2007
This is a supervised machine learning problem. You will need to use an API that features learning algorithms as colinsmith suggested or do some research and write on of your own. Python is pretty good for machine learning (it's what I use, personally) and has some nice tools like scikit: http://scikit-learn.org/stable/
I'd suggest for you to look into HAAR classifiers. Since you mentioned you have a set of 50-100 images, you can use this to build up a training dataset for the classifier and use it to classify your images.
You can also look into SURF and SIFT algorithms for the specified problem.

Creating Map from scanned image

I want to create a (Googlemap-esq) object from an image. This is going to be architects building plans scanned in, probably to something like a JPEG. In a native android app I want to have an object I can drop pins on and then click the pins for a info bubble etc.
I know Google provide functionality that lets you upload, create FloorPlans but this isn't really what I want. The end result would be perfect, but I can use a scanner to create them.
What sort of technology can be recommended, or do I just implement a Co-Ords system and overlay it?
Google maps uses a tiling system because the map can be very big. For example a morton curve can recursively subdivide the surface. It's similar to a quadtree. In relational database there is a spatial index usually a r-tree or a hilbert curve. If you can use a database you can use the point datatype or you can write your own r-tree. When you have many overlapping pins maybe a quadtree is better.

android automatic route for pedestrians

I would like to develop an Android application that allows users (pedestrians) to follow an automatically generated route.
Users would specify how far they wish to walk, whether they must return to their stating position, avoid hills, dangerous roads, not cross any roads, how fast they walk on avergae, etc.
i have been searching for a java based library or service that generates a route but have failed.
can anyone recommend a java library that will automatically generate a route?
Interesting idea. I've never seen any library or available implementation that matches your requirements exactly. What you are attempting to do, though, is basic route optimization.
Look at some combination of the google directions API (https://developers.google.com/maps/documentation/directions/) and a set of pre-defined (that you set up) waypoints around the city. The waypoints represent nodes in your "graph" and the edges are routes between them. Waypoints have coordinates so you can map them. Then you assign weight (preference) to each edge and use google to calculate the distance between the waypoints. Extract the routes that match your distance preference and then pick the one with the best "weight" preference.

constructing a minimum spanning tree using java's TreeMap

I'm working on a project that requires me to keep track of a number of points on a 2d plane. I need to add functionality that allows for certain points to detect the proximity of other points. I immediately thought of the closest pair problem and thought that maybe I should construct a minimum spanning tree.
The first issue is, these points constantly update their coordinates and I was wondering if it would even be plausible to do this.
The other issue is, I can't use 3rd party libraries for this so no jgraph or jung. I was wondering if there is a way to construct a minimum spanning using just the libraries I've been given. Can TreeMap be used or would I have to do this from scratch?
It sounds like you are trying to do Nearest Neighbor queries. That is where you try to find a point (or points) closest to another point. For a naive solution, you can just store a list of points and iterate through them using the distance formula to figure out which ones are closest. But if you want to do queries more quickly, you will want to use a spatial data structure that enables these kinds of queries. I would suggest a KD Tree. Java does not come with a KD Tree implementation in its standard library so you'll need to implement that yourself.
A TreeMap is just an implementation of the Map interface that lets you put and retrieve values by their keys. If you want to write something to generate a minimum spanning tree, you'll need to do that yourself.
On very Object Oriented way of doing this would have the Point Objects use the Observer Pattern and register themselves as Observers of all the other points, then as points positions change they can update all the Observers that they changed. You could control the thresholds of how often the changes occurred or by how much the changed needed to be by before the notifications were sent to the Observers. This would work well since you said, "certain" points need to track proximity and not all.

How to create a user interface like Google maps (a draggable map)?

I have to draw a graph with many nodes, and I thought that an user interface like what Google maps offers could be nice to navigate the graph. I'm currently using Java for my application (a web application): what technologies/libraries should I use to build an interface like google maps? What approach?
edit: I'm interested mainly in creating a draggable map with zooming capabilities
edit2: I'm not looking for the exact solution of the problem, but for some starting point
If you have a massive data to display, one approach is to create an interactive interface that let the user to navigate in your data. Higher the zoom, greater the details.
An example of google maps like interface for other purpose is zoompy
Are you familiar with OpenLayers? It is JavaScript map visualization library. Combined with something like OpenStreetMap, you can get some very powerful visualization with data for free.
Take a look at the tools in Eclipse's Graphical Modeling Project.
Take a look at Polymaps, specifically the support for vector data via geoJSON. It's a Javascript library that handles doing all the slippy-map interface: zooming, scrolling, and loading new sections of the map via HTTP. It renders to SVG, so it looks great and works in every browser except pre-9.0 MSIE.
It's a bit odd to use a geographic tool to draw arbitrary graphs, but it's totally doable. The Mandlebrot example is a proof of concept.
I was successful using modestmaps for Processing (find it here). A processing PApplet can be embedded in a swing GUI as explained here. I guess you could use the source to draw your graph in processing and then use the already implemented 'slippy map' features.

Categories

Resources