Rabu, 07 Desember 2011

real time

Occurring immediately. The term is used to describe a number of differentcomputer features. For example, real-time operating systems are systemsthat respond to input immediately. They are used for such tasks as navigation, in which the computer must react to a steady flow of new information without interruption. Most general-purpose operating systems are not real-time because they can take a few seconds, or even minutes, to react.
Real time can also refer to events simulated by a computer at the same speed that they would occur in real life. In graphics animation, for example, a real-time program would display objects moving across the screen at the same speed that they would actually move.

Kamis, 20 Oktober 2011

Real-time computing


In computer science, real-time computing (RTC), or reactive computing, is the study of hardware and software systems that are subject to a "real-time constraint"— e.g. operational deadlines from event to system response. Real-time programs must guarantee response within strict time constraints.[1] Often real-time response times are understood to be in the order of milliseconds and sometimes microseconds. In contrast, a non-real-time system is one that cannot guarantee a response time in any situation, even if a fast response is the usual result.

The use of this word should not be confused with the two other legitimate uses of real-time, which in the domain of simulations, means real-clock synchronous, and in the domain of data transfer, media processing and enterprise systems, the term is intended to mean without perceivable delay.

The needs of real-time software requires the use of one or more synchronous programming languages, real-time operating systems, and real-time networks which provide the essential frameworks on which to build a real-time software application.

A real-time system may be one where its application can be considered (within context) to be mission critical. The anti-lock brakes on a car are a simple example of a real-time computing system — the real-time constraint in this system is the time in which the brakes must be released to prevent the wheel from locking. Real-time computations can be said to have failed if they are not completed before their deadline, where their deadline is relative to an event. A real-time deadline must be met, regardless of system load.

Real-Time Radiation Monitoring in Japan - Internet of Things in Action


It never occurred to me that crowdsourcing radiation data from Geiger counters would be an application for Pachube! But, in light of recent events, radiation data has been pouring into the system while our community has been coming together to build how-to's and docs so people can get up and running. Open hardware and open data is coming together here to do what authorities couldn't do nearly as fast: a national real-time map of radiation data, accessible to everyone. As of Monday morning, we are hosting hundreds of feeds.
By socializing radiation data via Pachube, users are also gaining the ability to answer questions like:
Is my data consistent with others close by?
How has my particular region been affected in relation to other parts of the country?
How are radiation levels changing with the weather?
Is my data consistent with official reports at home and abroad?
Pachube is also already enabling the foundations of higher-level applications to be built on top of this radiation data. Haiyan Zhang, an Interaction Designer at the design consultancy IDEO, wrote that she had the desire to "just make something", and in an afternoon she had put together a map visualization of the data. The guys over at Uncorked Studios, a creative firm that builds mobile, social, and location products, built RDTN.org where they are aggregating data and providing additional resources. This stuff is getting built super-fast and is able to be tailored quickly to specific needs around the world.
We hope to see developers incorporating mobility in future applications, potentially allowing users to mash up their current location with radiation data and receive real-time estimates on radiation levels in their immediate vicinity. Open-source, easily customizable mobile apps already exist in our repository for community use. Additionally, our "Earth Browser" app allows you to visualize the data via a Google Earth overlay, which can serve as a head-start for an even better app (Try it! Requires Pachube login, search:"radiation",tag:"radiation", scalar:"200", then navigate to Japan).

Chatter on Twitter has been constant while this groundswell of activity has built up. Users are collaborating to decide on standard units of measurement, how to obtain hardware, and how to share data in the easiest manner. Our users self-organized from the beginning (thanks @kotobuki, @kaku60, @MarianSteinbach, @kaoru622,@miyasita, @motoishmz, @freaklabs!), we simply facilitated the process with a more public call for data and some increased service limits. This is the people-centric, open, useful Internet of Things!


Realtime image processing in Python

Image processing is notoriously a CPU intensive task. To do it in realtime, you need to implement your algorithm in a fast language, hence trying to do it in Python is foolish: Python is clearly not fast enough for this task. Is it? :-)
Actually, it turns out that the PyPy JIT compiler produces code which is fast enough to do realtime video processing using two simple algorithms implemented by Håkan Ardö.
sobel.py implements a classical way of locating edges in images, the Sobel operator. It is an approximation of the magnitude of the image gradient. The processing time is spend on two convolutions between the image and 3x3-kernels.
magnify.py implements a pixel coordinate transformation that rearranges the pixels in the image to form a magnifying effect in the center. It consists of a single loop over the pixels in the output image copying pixels from the input image.
You can try by yourself by downloading the appropriate demo:
pypy-image-demo.tar.bz2: this archive contains only the source code, use this is you have PyPy already installed
pypy-image-demo-full.tar.bz2: this archive contains both the source code and prebuilt PyPy binaries for linux 32 and 64 bits
To run the demo, you need to have mplayer installed on your system. The demo has been tested only on linux, it might (or not) work also on other systems:
$ pypy pypy-image-demo/sobel.py

$ pypy pypy-image-demo/magnify.py
By default, the two demos uses an example AVI file. To have more fun, you can use your webcam by passing the appropriate mplayer parameters to the scripts, e.g:
$ pypy demo/sobel.py tv://
By default magnify.py uses nearest-neighbor interpolation. By adding the option -b, bilinear interpolation will be used instead, which gives smoother result:
$ pypy demo/magnify.py -b
There is only a single implementation of the algorithm in magnify.py. The two different interpolation methods are implemented by subclassing the class used to represent images and embed the interpolation within the pixel access method. PyPy is able to achieve good performance with this kind of abstractions because it can inline the pixel access method and specialize the implementation of the algorithm. In C++ that kind of pixel access method would be virtual and you'll need to use templates to get the same effect without incurring in runtime overhead.