Browser love…
Cascading Style-Sheets or CSS for short were supposed to be the solution for all the nasty table hacks that one had to perform to create a web-page that had at least some form of layout. The idea is that your content (the HTML page) is separated from the layout, so both stay clear and maintainable. A CSS standard was developed to describe how browsers should display HTML content that was laid out with CSS.
Today, most browsers agree on this standard and implement it pretty well. Only one issue still seems to be a problem: is a border size part of the element size or does it add to the element size. This may sometimes give a misalignment of a few pixels, but is easily solvable (if necessary) with some browser type checking.
So you’d say, all is well in browser land…well, no, there still is Internet explorer, which even in the IE7 release still does not manage to pull off basic CSS layouts without the need for “special” care. Below are some screenshots of my blog in different browsers, you will notice that all but one produce very similar results. What you don’t see it that the page already provided some special care for Internet Explorer by adding a “position: absolute” style to the sidebar by some javascript: if that was not done, the main page would just end up *below* the floating sidebar. A nasty side-effect is that the bottom-borders of my article headers suddenly show up misaligned and above the headers, not to mention that IE seems to fail to produce a dotted border. In other words…IE fails to display a very simple layout correctly; don’t tell me that I need to style things differently either, because I’ve got 3 - standards compliant - browsers agreeing with me that my style-sheet should produce the expected result.
(Note that fonts are relative to browser standard font sizes in some cases and were expected to differ from browser to browser)
For dessert, some links to the browser download sites:
Konqueror is normally included in your favorite linux distribution.
Theory & Practice
“Theory is when you know something, but it doesn’t work.
Practice is when something works, but you don’t know why.
Programmers combine theory and practice: Nothing works and they don’t know why.”
Warping and morphing
Warping - in the context of image manipulation - is applying a geometrical transformation to an image, resulting in a new image: the warped image.
For my image manipulation toolbox I have written a number of different warping methods: warping by a global, invertible transformation, warping by an optical-flow field, warping using a mesh and field warping.
Global, invertible transformation
You may wonder why the transformation needs to be invertible. It is of course possible to just apply the transformation T to the coordinate a(x,y) in the input image, yield a projected coordinate a’=T(a) in the result image, but imagine a scaling transformation that doubles the size of the image. Coordinate a(0,0) would be projected on a’(0,0), but b(1,0) would be projected on b’(2,0) and there would be no data for the pixal at (1,0) in the resulting image. Therefor the process works in the opposite direction, on every pixel coordinate in the resulting image, the inverse of the transformation is applied and yields a either a coordinate within the boundaries of the original, or outside the boundaries. In case a coordinate within the boundaries is found, the pixel value at that coordinate can be copied to the result image. Often the coordinate will be a decimal value, in which one can either round the coordinate to the nearest integral value (easy, but not so good) or use interpolation.
Optical-flow field
An optical-flow field contains a translation vector for every pixel in the image which determines where that pixel should go in the resulting image. Optical-flow fields are often calculated from frames in a video-sequence to estimate the motion of objects in the scene and motion of the camera.
Mesh Warping
In this warping method a mesh is placed over the original, each crossing of lines in the mesh is a control point and is placed at a point of interest. A destination mesh with equal dimensions contains the target positions for the control points. Locations of points that are not a control point are then interpolated using a spline. This is a reasonably fast warping method, however placing control points using a mesh is not very intuitive and often most control points are irrelevant.
Field warping
Field warping offers a more intuitive approach to warping an image by marking and moving features. Features may be marked using 2 corresponding sets of lines, the algorithm has some global parameters that determine how good a location on a line in the original will stick to the corresponding line in the target, how fast the influence of a line diminishes as pixels are further away etc. This approach is very intuitive, but slow, in some cases some configurations of lines may introduce strange warping effects.
Morphing
Morphing is gradually dissolving between 2 images both in color and geometry. At time t=0.0 the output of a morphing operation will thus be the start input image and at time t=1.0 it will be the destination input image. For anything in between a set of interpolated parameters (ie. interpolated mesh of line set) is calculated, two warps are then performed: the source is warped from the source parameters to the interpolated parameters and and the destination is warped from the destination parameters to the interpolated parameters. The pixels in the 2 intermediate images should now be corresponding points and we are ready to interpolate the pixel values using the value of t.
Cum again?
I’m definitely not swimming there…
Software design
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies,and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”
Programmers vs. The universe
“Programming today is a race between software engineers
striving to build bigger and better idiot-proof programs,
and the universe trying to build bigger and better idiots.
So far, the universe is winning.”
