The Big Blob

A blog of blobs

RSS Feeds

  • About
  • Artifical Intelligence
  • General
  • Image Processing & GFX
    • OpenGL
  • OpenCL
  • Webprogramming
    • Django
    • PHP
    • Zend Framework

Implementation of Marching Cubes in C++ and OpenGL

Jul 24th

Posted by Erik Smistad in Image Processing & GFX

No comments

Marching cubes is an algorithm for extracting a 3D surface (as a set of polygons) from a 3D set of sampled scalars(regular numbers). This algorithm is used a lot in medical imaging where one often have a 3D set of numbers where the numbers can be the absorption level of X-rays in one specific spot in the tissue. The algorithm is also often used to display a mathematical formula describing some 3D structure, for instance metaballs, which are some organic-looking 3D balls described purely by a mathematical formula.

In this post I explain the marching cubes algorithm and give an implementation of it in C++ using OpenGL based on the original simple marching cubes algorithm.

More >

Using the C++ bindings for OpenCL

Jul 12th

Posted by Erik Smistad in OpenCL

No comments

While the OpenCL API is written in C, the OpenCL 1.1 specification also comes with a specification for C++ bindings. In this post I go through how to use the C++ bindings instead of C for the simple example of vector addition from my previous post Getting started with OpenCL and GPU computing.

More >

The Boltzmann machine

Jul 11th

Posted by Erik Smistad in Artifical Intelligence

No comments

The neural network discussed in this post, called the Boltzmann machine, is a stochastic and recurrent network. This post contains my exam notes for the course TDT4270 Statistical image analysis and learning and explains the network’s properties, activation and learning algorithm.

More >

Getting started with OpenCL and GPU Computing

Jun 21st

Posted by Erik Smistad in OpenCL

6 comments

OpenCL (Open Computing Language) is a new framework for writing programs that execute in parallel on different compute devices (such as CPUs and GPUs) from different vendors (AMD, Intel, ATI, Nvidia etc.). The framework defines a language to write “kernels” in. These kernels are the functions which are to run on the different compute devices. In this post I explain how to get started with OpenCL and how to make a small OpenCL program that will compute the sum of two lists in parallel.

More >

Making charts and output them as images to the browser in Django

Jun 18th

Posted by Erik Smistad in Django

2 comments

Simple graph made with matplotlib

Simple graph made with matplotlib

Lets say you are working on a website made in Django. And you want to make some nice looking graphs real time, as images from dynamic data. This can be done by using the python 2D graph library matplotlib. The library can be found in the debian package python-matplotlib. A simple graph showing a sine curve, seen to the right, can be generated in regular python using the following code(taken from this example):

from pylab import *
 
t = arange(0.0, 2.0, 0.01)
s = sin(2*pi*t)
plot(t, s, linewidth=1.0)
 
xlabel('time (s)')
ylabel('voltage (mV)')
title('About as simple as it gets, folks')
grid(True)
show()

Output graph to browser from a Django view

If you want to output this graph as a PNG image to the browser from a view in Django, you can store the image in a string buffer and output this buffer using the HttpReponse class in Django and set the mime type to image/png.

from django.http import HttpResponse
from matplotlib import pylab
from pylab import *
import PIL, PIL.Image, StringIO
 
def showimage(request):
    # Construct the graph
    t = arange(0.0, 2.0, 0.01)
    s = sin(2*pi*t)
    plot(t, s, linewidth=1.0)
 
    xlabel('time (s)')
    ylabel('voltage (mV)')
    title('About as simple as it gets, folks')
    grid(True)
 
    # Store image in a string buffer
    buffer = StringIO.StringIO()
    canvas = pylab.get_current_fig_manager().canvas
    canvas.draw()
    pilImage = PIL.Image.fromstring("RGB", canvas.get_width_height(), canvas.tostring_rgb())
    pilImage.save(buffer, "PNG")
    pylab.cose()
 
    # Send buffer in a http response the the browser with the mime type image/png set
    return HttpResponse(buffer.getvalue(), mimetype="image/png")

Competitive and cooperative interactions in biological inspired AI

Jun 7th

Posted by Erik Smistad in Artifical Intelligence

No comments

In this essay, written as my final essay in the course IT3708 spring 2010, I discuss two phenomenas that are the driving forces for a lot of the complex biological systems in nature with several simple components that interact with each other. These two phenomenas are competition and cooperation. I will discuss examples from the process of evolution, where competition play a crucial part, to ant colonies, where cooperation between ants enables these simple creatures to do extraordinary things. All of the examples presented here have an inspiration from biology and has been applied successfully to computer AI problems. I start by defining competitive and cooperative interactions among individual components in a broad sense. Then six examples, with competitive and cooperative interactions, are presented. I finished off with a conclusion on the advantages and disadvantages of using these two phenomenas in AI systems.
More >

Gjenskapingen av Hamar domkirke – Del 2

Apr 30th

Posted by Erik Smistad in General

3 comments

Da var faget Eksperter i Team over og jeg og resten av gruppa mi er stolte over å presentere resultatet av vårt arbeid. Som sagt i et tidligere blogginnlegg gikk oppgaven vår ut på å gjenskape Hamar domkirke i virtuell virkelighet. I den sammenheng har vi laget en film over gamle Hamar domkirke som vi har lagt ut på Youtube, se under. Filmen viser tre ulike byggefaser kirka gikk gjennom.

3D modellene av kirka er laget i programmet 3D studio max 2009, landskapet i Grome 2, teksturene er funnet på cgtextures.com og fantastiske gratis Unreal Development Kit er brukt til å sette det hele sammen med realistisk grafikk.

Gjenskapingen av Hamar domkirke – Del 1

Feb 27th

Posted by Erik Smistad in General

5 comments

I det obligatoriske faget Eksperter i Team har jeg og en gruppe på 3 andre valgt oppgaven med å gjenskape Hamar domkirke i virtuell virkelighet. Det vil si at vi skal modellere den i 3D på datamaskiner og så plassere den i et 3D landskap. Kirken ble bygget rundt år 1200 og ble rasert i 1567 av svenskene under den nordiske 7 års krigen.


Hamar domkirkeruin

Det eneste som er igjen av kirka idag

Domkirken slik Olaf Nordhagen mente den kunne ha sett ut

Domkirken slik Olaf Nordhagen mente den kunne ha sett ut

Etter andre dag med jobbing har gruppa fått modellert hovedtrekkene til både fase 1 og 2.


Modell av hamar domkirke - del 1

Vår 3D modell laget med programmet 3D studio max


Modell av Hamar domkirke (bakside) - del 1

Sett bakfra

Neste steg er å legge mer detaljer til modellene. Som f.eks. dører, vinduer, takpynt o.l.

Hopfield network

Feb 27th

Posted by Erik Smistad in Artifical Intelligence

No comments

This neural network proposed by Hopfield in 1982 can be seen as a network with associative memory and can be used for different pattern recognition problems. This post contains my exam notes for the course TDT4270 Statistical image analysis and learning and explains the network properties, activation and learning algorithm of the Hopfield network.
More >

Pseudo-random numbers and sampling from probability distributions

Dec 17th

Posted by Erik Smistad in General

No comments

One often needs a source of random numbers for use in stochastic simulations. Since a computer is deterministic, it can’t generate real random numbers, unless one happen to have a quantum random generator at hand, like these. But computers can generate sequences of pseudo-random numbers which are deterministic sequences of numbers which has the same statistical properties as sequences of real random numbers. All of the different random functions in various programming languages, like rand() in C, create sequences of pseudo-random numbers. This post contains my exam notes for the course TDT4270 Statistical image analysis and learning and explains how to generate these sequences, what sampling is and how to sample from any probability distribution.

More >

12»
  • About

    This is a blog of Erik Smistad's experiences with the digital world. Read more
  • Recent Posts

    • Implementation of Marching Cubes in C++ and OpenGL
    • Using the C++ bindings for OpenCL
    • The Boltzmann machine
    • Getting started with OpenCL and GPU Computing
    • Making charts and output them as images to the browser in Django
  • Categories

    • Artifical Intelligence (3)
    • General (4)
    • Image Processing & GFX (2)
      • OpenGL (1)
    • OpenCL (2)
    • Webprogramming (2)
      • Django (1)
      • PHP (1)
  • Recent Comments

    • tom on Getting started with OpenCL and GPU Computing
    • tom on Getting started with OpenCL and GPU Computing
    • Achtkraut on Getting started with OpenCL and GPU Computing
    • Erik Smistad on Making charts and output them as images to the browser in Django
    • Nathan Moos on Making charts and output them as images to the browser in Django
    • Tags

      .htaccess 3D ant colony system apache artificial immune system associative memory biological inspired AI boid flocking border following box-muller competitive neural networks congruential generator contour tracing evolutionary algorithms exponential distribution fix folders GPU computing hamar domkirke hebbian learning hopfield http error inversion method it3708 kohonen learning algorithm metropolis sampling moore neighbor tracing neural network OpenCL particle swarm optimization polar method probability distribution pseudo-random rejection sampling restrict access rewrite sampling self organizing maps tdt4270 threshold unit UDK unreal development kit upload wordpress
Mystique theme by digitalnature | Powered by WordPress
RSS Feeds XHTML 1.1 Top