metric information from camera ray reconstruction

As explained in a previous article (simulating a camera) (which is basically converting 3d objects to 2D projective geometry, with specific camera parameters) is one thing, but getting metric information out of a photograph is totally another. There are several ways of achieving this. You can either use a digital terrain model and one oriented image or a pair of oriented images (stereoscopic). In this article I am going to focus on a stereoscopic “technique”. Some “techniques” require good mathematical knowledge and skills while others are a bit more graphical (meaning you can actually imagine the solution and even graphically depict it).In this article I try to explain how to compute a point’s 3D space coordinates, from two images using camera ray reconstruction.

(more…)

An implementation of knight’s tour algorithm written in javascript & html5

A knight’s tour is a sequence of moves of a knight on a chessboards such that the knight visits every square exactly once. The knight’s tour problem is an instance of the more general Hamiltonian path problem in graph theory. we use the Warnsdorff’s rule “an heuristic algorithm”. We move the knight so that we always proceed to the square from which the knight will have the fewest onward moves. When calculating the number of onward moves for each candidate square, we do not count moves that revisit any square already visited. It is, of course, possible to have two or more choices for which the number of onward moves is equal. Below we can see the piece of code where the chessboard created using html5 and algorithm’s implementation in javascript. The algorithm chooses the square where the knight has the minimum value of possible moves. This is not the best approach because there are cases that the puzzle doesn’t have a solution as we can see at this paper. In a next post i’ll try to solve the problem. The knight’s tour has been tested in mozzila firefox and google chrome.

(more…)

camera simulation

Its not often that someones asks you to re-invent the wheel. But this was one one these times and it was mostly necessary.

The task involved projecting already digitized city blocks outlines onto camera images.

A normal approach would be something among the lines of drawing the shapes in a 3d space (directX, openGL etc) and showing the image in the background. But when you want to accurately simulate a “real” existing camera then it seemed to me easier to build the whole construct from scratch.

In Order to do that we had to know both the interior and exterior orientation of the camera.

  • the interior orientation is the position of the principal point, the focal length and the radial distortion. Some manufacturers provide those values (when it comes to photogrammetric cameras at least) but most do not. There are ways to calibrate yourself a camera but that’s completely a different topic.
  • the exterior orientation of the camera is the position (x,y,z) and rotations (ω,φ,κ) of the camera at the time of the shooting

So what we need to do is to go from city block coordinates to image coordinates.
The main idea is described in the following steps
(more…)

Cad implementation using the Javascript based topology library

Today I had some time and I decided to resurrect and update one sample page on how to use the topology Javascript library (codenamed tougo) I developed a couple of years ago.

The sample demonstrates some basic functions of a simple drawing app. You have the option to draw circles, boxes, triangles and lines. Originally I called it a Cad app cause you had the option edit the drawing and to export it to a dxf file.

The export option in this sample is deactivated (although the sample does includes the Javascript code to do so).

I may add a couple more features in due time.

enjoy the sample page and feel free to pop a question. Btw it only works on webkit browsers due to mozilla html5 canvas incompatibilities

UPDATE:  I updated my code to the latest version where I have solved the mozilla html5 canvas incompatibilities, so now it works,  just fine, on both browsers.

(more…)

JavaScript based geometric and topological operations

A while ago I was working on a personal project concerning various geometric and topological operations on html5 canvas elements. Nowadays it is a bit abandoned but It was a pity to let it go to waste. So I made a public repository on Bitbucket and GitHub.

https://bitbucket.org/stefelpho19/tougo
https://github.com/elasticrash/tougo

As of today 19-November-2013 I would be maintaining the github version

Oracle Universal Installer

Today we had a, what it seems, minor task of installing a Oracle Database instance on a remote server. But for some unknown reason we kept getting the following console output and then …nothing.

So we set onto the unknown searching throughout oracle website, forums, blogs, google …and got almost nothing.  Just a big load of crap concerning rare cases about remote installation failures etc.

After a lot of searching we found in the oracle database forums a post by a single person that said that for some reason Oracle Universal Installer fails to Launch while your installation drive has ~ 3TB empty space. Ours had ~2.6TB but still the launcher failed, so with a big more digging we found out that Oracle for some reason (probably cause 3TB didnt exist on the oracle database latest release)  didnt support >2TB drives.

Bottom Line we had to trick the system by creating an empty 1TB file using fsutil

And it worked!

Obviously ;-)

Pattern Based Sudoku Solving Algorithms (part A)

It is no secret that I love puzzles. Depending on the mood and period of my life, I find myself stuck with a certain kind of puzzles. Sudoku,among others, is naturally one of them and since I am fascinated with logic, it was bound, at some point, to check out what approach most programmers take in solving such a problem.

Most sudoku solving algorithms out there just “do” the job. Meaning they are mostly recursive and back-tracing solutions (like dancing links) rather than a more natural human approach.

Now whats the point in solving such a relatively simple problem without using such techniques. The point is that DLX techniques cannot produce a straight forward solution, I mean one that the filling sequence could fool someone that it wasn’t solved by a computer.

So I thought why not try to write some code based on how I think while solving a puzzle. Also Iam not allowing the algorithm to take notes and by notes I mean to pre-calculate every possible number that might correspond to each empty space.

My Solution so far is based on 3 Patterns and can solve most sudoku puzzles with a degree of difficult up to 7, 10 being the hardest.

There will be many more posts on this topic, in the near future…and probably some results concerning performance issues as well as a bit of code.

Here is a draft flowchart of the first Thinking Pattern
(more…)

City Engine Presentation

Last week we attended a small presentation concerning a procedural modeling software called city engine. The reason of this event is the merging of the existing city engine software with esri’s next release of ArcMap 10.2

This presentation took place in Athens. The main speaker was Mr. Gert Van Maren.

Procedural Inc. was acquired by Esri in the summer of 2011. As I understood by the presentation, City Engine wont stop its standalone release due to a lot of clients not be interested in GIS oriented applications but rather focused on more media oriented tasks.

The speech was really interesting and I enjoyed it a lot (I didn’t fall asleep, like I usually do in such occasions when the presentations are dull and boring). Although to really absorb the info presented by Mr Gert Van Maren you had to at least try the software prior, in some extend. Because otherwise everything sounded easy and magical. He didn’t focus that much on the difficulty of rule writing, especially when modeling existing cities. He did though present a graph that stated that initially even conventional handmade models could be faster than procedural modelling. But once the rules were well defined and established the times for future projects could be scaled down to a tenth.

The only annoying thing about the whole presentation was the speech of the Greek esri representative, that besides the endless irrelevant topics he touched, he appeared to have an attitude of selling tomatoes instead of a 3D procedural GIS modeling software.

press more to see a live example of they web-GL implementation
(more…)

introduction

Hello to everyone out there. This is my first post so bare with me (not counting hello world one, obviously). First of all welcome.

Before I write anything worthy I ought to give a brief description of what we intent this blog to be. We are three friends and co-workers working mainly, but not confined (our boss from times to times got some weird ideas on software development, other good, other not that good) to custom GIS oriented applications, whether they are web based or desktop ones.

In this blog, personally I will be focusing in writing about work experiences, specific or vague, depending on the mood. Various conferences and speeches we attend, code of course … all though most code related stuff and questions, in my humble opinion can be pretty much be resolved in other Internet means e.g. www.stackoverflow.com

So we are here to have fun while typing, more or less we walk on a road carved by “fun with flags” :P

Hello world!