Monday, July 30, 2007

[Work] Veiling glare

All of the above computational methods(deconvolution based) post-process an image that already contains glare. In HDR scenes with significant veiling glare these methods will perform poorly, as signal-to-noise ratios are low in the presence of strong glare. To overcome this, glare must be physically removed before it is recorded.

While these methods(light transportation) can be used to characterize glare, they do not provide an avenue for separating out glare before it is recorded on the camera image sensor.

methods to remove glare:
-- direct/global components separation

Multiple exposure HDR is limited by veiling glare that is scene-, exposure-, aperture-, and camera-dependent. The accuracy of scene-luminances estimates varies with all these parameters.

Glare is the scene- and camera- dependent scattered light falling on image sensors.

Thursday, July 26, 2007

[Life] Sprechzeiten

Studentenwerk im Saarland

Klaudia Kopp

Mo., Di und Do. 9:30 - 11:30
Mo. 13:00 - 14:00

Telefon: 0681 3022890

Wednesday, July 25, 2007

[Work] How to draw anti-aliased circles and disks

How to draw anti-aliased circles and disks
Theory:
We will use the basic equation for a circle. Using two coordinates, X and Y, and the center of the circle located at Xc and Yc, and a radius R:

sqr(X-Xc) + sqr(Y-Yc) = sqr(R)

Notice that the value sqr(R) is always the same, so we can pre-calculate it. On each row of pixels (called a scanline), the value of sqr(Y-Yc) is also constant, because the Y value is constant. And just so, for each column of pixels the value of sqr(X - Xc) is constant.

Using this, we can precalculate these values, and then the only thing left to do is to compare the correct values in each pixel with simple addition. This results in very fast code.

How to do anti-aliasing
Anti-aliasing means that we must find "inbetween" values whenever we are "on" the edge of the circle. Suppose we want to draw a disk, with radius R:

if sqr(X-Xc) + sqr(Y-Yc) < sqr(R) we are on the disk, if not, we are outside of the disk.

An easy way of implementing anti-aliasing here is to assume that there are two circles. We have an inner circle R1 and an outer circle R2:

if sqr(X-Xc) + sqr(Y-Yc) < sqr(R1) we are on the disk,

if sqr(X-Xc) + sqr(Y-Yc) > sqr(R2) we are outside,

and in the other cases we have fallen inbetween both circles. This is the area where the color must change from background color to disk color.

First we find our local radius: R = sqrt(sqr(X-Xc) + sqr(Y-Yc)). This requires a square root calculation, but fortunately only in the relatively small area of the anti-aliasing zone.

Next, we find the factor ranging from 0 (outside) to 1 (inside) and use this one to scale our color:

Factor = (R2 - R) / (R2 - R1), which is 1 if R=R1 and 0 if R=R2


#include

#include "array.h"
#include "math.h"

#ifndef A2D
typedef Array_2D A2D;
#endif

#ifndef SQR
#define SQR(a) ((a)*(a))
#endif

/***************************************************************************************************/
// Draw a disk on Bitmap. Bitmap must be a 256 color (pf8bit) palette bitmap,
// and parts outside the disk will get palette index 0, parts inside will get
// palette index 255, and in the antialiased area (feather), the pixels will
// get values inbetween.
// ***Parameters***
// Bitmap:
// The bitmap to draw on
// CenterX, CenterY:
// The center of the disk (float precision). Note that [0, 0] would be the
// center of the first pixel. To draw in the exact middle of a 100x100 bitmap,
// use CenterX = 49.5 and CenterY = 49.5
// Radius:
// The radius of the drawn disk in pixels (float precision)
// Feather:
// The feather area. Use 1 pixel for a 1-pixel antialiased area. Pixel centers
// outside 'Radius + Feather / 2' become 0, pixel centers inside 'Radius - Feather/2'
// become 255. Using a value of 0 will yield a bilevel image.
/***************************************************************************************************/
void draw_disk(float CenterX, float CenterY, float Radius, float Feather, A2D *img){

int width, height;
width=(*img).x_size();
height=(*img).y_size();


int x, y;
int LX, RX, LY, RY;
// int Fact;
float RPF2, RMF2;
float SqY, SqDist;
std::vector SqX;

// Determine some helpful values (singles)
RPF2 = SQR(Radius + Feather/2);
RMF2 = SQR(Radius - Feather/2);

// Determine bounds:
LX = (int)MAX(floor(CenterX - RPF2), 0);
RX = (int)MIN(ceil (CenterX + RPF2), width - 1);
LY = (int)MAX(floor(CenterY - RPF2), 0);
RY = (int)MIN(ceil (CenterY + RPF2), height - 1);

// Optimization run: find squares of X first
SqX.resize(RX - LX + 1, 0.0f);

for( x = LX ; x<= RX; x++){
SqX[x - LX] = SQR(x - CenterX);
}

// Loop through Y values
for(y = LY ; y<= RY; y++) {
SqY = SQR(y - CenterY);
// Loop through X values
for( x= LX; x<=RX; x++){
// determine squared distance from center for this pixel
SqDist = SqY + SqX[x - LX];
// inside inner circle? Most often..
if( SqDist < RMF2){
// inside the inner circle.. just give the scanline the
(*img)(x,y)= 1.0;
}else{
// inside outer circle?
if( SqDist < RPF2){
// We are inbetween the inner and outer bound, now
// mix the color
// Fact = int(((Radius - sqrt(SqDist)) * 2 / Feather)
// * 127.5 + 127.5 +0.5);
// (*img)(x, y)= float(MAX(0, MIN(Fact, 255)));
(*img)(x,y)= MAX(0, ((Radius - sqrt(SqDist)) * 2 / Feather)*0.5+0.5);
}else{
(*img)(x, y) = 0.0;
}
}
}
}
}

/***************************************************************************************************/
// Draw a circle on Bitmap. Bitmap must be a 256 color (pf8bit) palette bitmap,
// and parts outside the circle will get palette index 0, parts inside will get
// palette index 255, and in the antialiased area (feather), the pixels will
// get values inbetween.
// ***Parameters***
// Bitmap:
// The bitmap to draw on
// CenterX, CenterY:
// The center of the circle (float precision). Note that [0, 0] would be the
// center of the first pixel. To draw in the exact middle of a 100x100 bitmap,
// use CenterX = 49.5 and CenterY = 49.5
// Radius:
// The radius of the drawn circle in pixels (float precision)
// LineWidth
// The line width of the drawn circle in pixels (float precision)
// Feather:
// The feather area. Use 1 pixel for a 1-pixel antialiased area. Pixel centers
// outside 'Radius + Feather / 2' become 0, pixel centers inside 'Radius - Feather/2'
// become 255. Using a value of 0 will yield a bilevel image. Note that Feather
// must be equal or smaller than LineWidth (or it will be adjusted internally)
/***************************************************************************************************/

void draw_circle(float CenterX, float CenterY, float Radius,float LineWidth, float Feather, A2D *img){

int width, height;
width=(*img).x_size();
height=(*img).y_size();

int x, y;
int LX, RX, LY, RY;
float ROPF2, ROMF2, RIPF2, RIMF2;
float OutRad, InRad;

// P: PByteArray;
float SqY, SqDist;

std::vector SqX;

// Determine some helpful values (singles)
OutRad = Radius + LineWidth/2;
InRad = Radius - LineWidth/2;
ROPF2 = SQR(OutRad + Feather/2);
ROMF2 = SQR(OutRad - Feather/2);
RIPF2 = SQR(InRad + Feather/2);
RIMF2 = SQR(InRad - Feather/2);

// Determine bounds:
LX = (int) MAX(floor(CenterX - ROPF2), 0);
RX = (int) MIN(ceil (CenterX + ROPF2), width - 1);
LY = (int) MAX(floor(CenterY - ROPF2), 0);
RY = (int) MIN(ceil (CenterY + ROPF2), height - 1);

// Checks
if(Feather > LineWidth)
Feather = LineWidth;

// Optimization run: find squares of X first
SqX.resize(RX - LX + 1, 0.0f);

for( x = LX; x<=RX; x++)
SqX[x - LX] = SQR(x - CenterX);

// Loop through Y values
for(y= LY; y<= RY; y++){
SqY = SQR(y - CenterY);
// Loop through X values
for( x = LX; x<= RX; x++){

// determine squared distance from center for this pixel
SqDist = SqY + SqX[x - LX];

// now first check if we're completely inside (most often)
if (SqDist < RIMF2){
// We're on the disk inside everything
(*img)(x,y) = 0;
} else {
// completely outside?
if( SqDist < ROPF2){
// inside outer line - feather?
if (SqDist < ROMF2){
// check if we're in inside feather area
if( SqDist < RIPF2){
// We are in the feather area of inner line, now mix the color
// Fact = int(((sqrt(SqDist) - InRad) * 2 / Feather) * 127.5 + 127.5+0.5);
//(*img)(x,y) = MAX(0, MIN(Fact, 255)); // just in case limit to [0, 255]
(*img)(x,y)=MAX(0,(sqrt(SqDist) - InRad) * 2 / Feather*0.5+0.5);
} else{
// on the line
(*img)(x,y) = 1.0;
}
}else{
// We are in the feather area of outer line, now mix the color
// Fact = int(((OutRad - sqrt(SqDist)) * 2 / Feather) * 127.5 + 127.5+0.5);
//(*img)(x,y) = MAX(0, MIN(Fact, 255)); // just in case limit to [0, 255]
(*img)(x,y)=MAX(0, (OutRad - sqrt(SqDist)) * 2 / Feather);
}
} else{
// outside everything
(*img)(x,y) = 0;
}

}
}
}


}


/***************************************/

int main(int argc, char *argv[] )
{


int width, height;
width=1200;
height=1000;
A2D img(width, height);


draw_disk(width/2, height/2, 400, 10.0, &img);
write_A2D(img, "disk");

draw_circle(width/2+0.5, height/2+0.5, 450,4, 1, &img);

write_A2D(img, "circle");

cout << "All done!" << endl;
}


[Work] l1-magic

l1-magic and links to compressive sampling

Compressed Sensing Resources

Tuesday, July 24, 2007

[Work] firefox, mozilla locked!

In Firefox 1.5 or later, a "Close Firefox" dialog box may appear with one of these messages:
"Firefox is already running, but is not responding. To open a new window, you must first close the existing Firefox process, or restart your system."

How to unlock your profile

Your profile may be inaccessible for a number of reasons, most often because the application failed to shut down completely the last time it was used and the task or process is still "running in the background", even though there are no open application windows. Ending the running process is normally sufficient to unlock the profile. If the profile remains inaccessible, try these other solutions:
[edit]
End processes

Go through your task or process list to see if multiple instances of Firefox, Thunderbird or Mozilla Suite are still running or not responding and end each instance found.
[edit]
Remove the profile lock file
The application may have shut down abnormally, leaving the lock in place. To fix this, open the profile folder and delete the file,

* "parent.lock" (Windows),
* "lock" and ".parentlock" (Linux), or
* ".parentlock" (Mac OS X)

[Work] find hidden file

find . -name '.*'

[Work] Spray for scanning

Helling

Eindringpruefverfahren

MET-L-CHEK Developer >>D70<<

MET-L-CHEK Developer D-70

Inhalt 400 ml

Monday, July 23, 2007

[Work] Display surpersampling

Pluribus

E pluribus Pluribus: Out of many projectors, one super screen

Nelson L. Chang

Niranjan Damera-Venkata

# Niranjan Damera-Venkata and Nelson L. Chang, "Realizing Super-Resolution with Superimposed Projection," IEEE International Workshop on Projector-Camera Systems (ProCams), 18 June 2007, Minneapolis, MN (Best Paper Award winner)

# Niranjan Damera-Venkata and Nelson L. Chang, "Display Supersampling," ACM Transactions on Graphics, (Accepted with revisions)

# Niranjan Damera-Venkata and Nelson L. Chang, "On the Resolution Limits of Superimposed Projection," IEEE International Conference on Image Processing (ICIP), Sept 2007, San Antonio, TX, (to appear)

# Niranjan Damera-Venkata and Nelson L. Chang, "A Unified Paradigm for Scaleable Multi-Projector Displays," IEEE Transactions on Visualization and Computer Graphics, (accepted with minor revisions

Thursday, July 19, 2007

[Wor] lithium ion battery

When to recharge

You can recharge a lithium ion battery pack whenever it is convenient. Unlike a conventional battery pack, it does not have to be fully discharged first. However, as the battery pack will natually discharge itself over time, it is best to charge it the smae day you plan to use it, or the day before.

In addition, there is the possibility of damage to the battery pack and reduced usage time if fully charged batteries are stored for a period of months.

Disconnect the battery pack when you are not using it.

Even when it is turned off, the product the battery pack is attached to will continue to slowly drain power from the battery pack.

When you plan to store a battery pack aim to use its complete charge first, before disconneting it. Store the battery in an area which is free of moisture, and where the temperature is no higher than 30C.

Wednesday, July 18, 2007

[Work] DIY photography weblog

DIY photography weblog



how to make a tele lens a macro lens?
A new meaning to ‘tele-photo’
Extreme macro photography on a budget

Monday, July 16, 2007

[Work] white balance

iproc berry_blur.tif -f toFloat -f applyWB wb = 0.6 0.9 1 -f Normalize -f toByte -o berry_blur_wb TIFF

Sunday, July 15, 2007

[Work] bash script for batch moving files


#!/bin/bash
i=9892
while [ $i -lt 9910 ]
do
i=$((i+1))
fname=$(printf "%04d" $i)
fname=img_${fname}.jpg
if [ -f $fname ]
then
echo processing $fname
mv $fname ./cap
fi
done

Thursday, July 12, 2007

[Work] Image resize

Paul Heckbert's homepage
Paul Heckbert's zoom


/*----------------------------------------------------------------------
* The mapping from source coordinates to dest coordinates:
* (Notation: prefix 'a' denotes source coords, 'b' denotes destination coords)
*
* bx = sx*ax+tx
* by = sy*ay+ty
*
* where (ax,ay) and (bx,by) are DISCRETE source and dest coords, respectively.
*
* An important fine point on terminology: there are two kinds of pixel coords:
* DISCRETE COORDINATES take on integer values at pixel centers
* CONTINUOUS COORDINATES take on integer values halfway between pixels
* For example, an image with discrete coordinate range [0..511] has a
* continuous coordinate range of [0..512]. The pixel with
* discrete coords (x,y) has its center at continuous coords (x+.5,y+.5)
* and its continuous coord domain is [x..x+1] in X and [y..y+1] in Y.
* Note: discrete coords are not always stored in ints and continuous coords
* are not always stored in floats.
*
* conversion:
* if c = continuous coord and d = discrete coord, then
* c = d+.5
* d = floor(c)
*
* To map a discrete src interval [a0..a1] to a discrete dst interval [b0..b1]:
*
* b-b0+.5 = bn/an*(a-a0+.5)
* or b = (bn/an)*a + (b0-.5)-(bn/an)*(a0-.5)
* = scale*a+tran
*
* where a and b are the discrete source and dest coords (either x or y)
* and an and bn are the interval lengths: an=a1-a0+1, bn=b1-b0+1.
* a0, an, b0, bn are the mapping parameters used by the zoom routine below.
* In general, however, for sub-pixel scale and translate control, we allow
* any real numbers for scale and tran (although there should usually be some
* correspondence between the mapping function and the src and dst windows).
*
* We'll often want the inverse mapping, from discrete dst coord b to
* continuous src coord ac, relative to the interval origins a0 and b0:
*
* b+b0 = s*(ac+a0-.5)+t
* so ac = (b+b0-s*(a0-.5)-t)/s
* = (b+offset)/scale = MAP(b, scale, offset)
*
* The mapping fields ux and uy in the Mapping structure
* are these offsets in x & y respectively.
*/
/* the mapping from discrete dest coord b to continuous source coord: */
#define MAP(b, scale, offset) (((b)+(offset))/(scale))



#!/bin/bash

for filter in point box triangle quadratic cubic catrom mitchell gaussian sinc bessel hanning hamming blackman kaiser
do
# echo ${filter}
# echo ./bin/zoom -src $1 -dst `basename $1 .tif`_${filter}.tif -s 0 0 340 260 -d 0 0 680 520 -filt ${filter}
./bin/zoom -src $1 -dst `basename $1 .tif`_big_${filter}.tif -s 0 0 406 500 -d 0 0 812 1000 -filt ${filter}
./bin/zoom -src $1 -dst `basename $1 .tif`_small_${filter}.tif -s 0 0 406 500 -d 0 0 203 250 -filt ${filter}
done




http://www.mobilegd.com/index.php?option=com_smf&Itemid=73&topic=34.msg1980

[Work] ImageMagick, convert

convert command line

[Work] Richardson-Lucy deconvolution

To be careful with the image size

For example
I got a problematic result when deconvolve a 320*263 image with 21*21 kernel.
(The problem: there is an artifact line near the bottom of the deconvolved image.)
But it goes fine when I cut the image to 320*260

[work] good vector, 2D array, Matrix

from TNT-JAMA

tnt_array1d.h
tnt_array1d_utils.h
tnt_array2d.h
tnt_array2d_utils.h
tnt_array3d.h
tnt_array3d_utils.h
tnt_cmat.h
tnt_vec.h

from AG4 software base
Vector.hh

customed by myself
Vec.h //from R3
array.h //from Paris' array.h

Wednesday, July 11, 2007

[Work] Computer vision course

CMSC 426
Image Processing (Computer Vision)
David Jacobs
Fall 2005

good explanation of convolution and correlation

[Work] system monitoring tool

gkrellm

Monday, July 9, 2007

[Work] Linear system solvers

BCLS
BCLS is a software package for solving bound-constrained least-squares problems.

CHOLMOD:
CHOLMOD is a set of ANSI C routines for sparse Cholesky factorization and update/downdate. A MATLAB interface is provided.
Example application for mesh optimization (combining positions and normals by Diego Nehab)

LSQR
LSQR: Sparse Equations and Least Squares

Local Optimization Software links

[Work] Curl

curl

curl is a command line tool for transferring files with URL syntax, supporting FTP, FTPS, HTTP, HTTPS, SCP, SFTP, TFTP, TELNET, DICT, FILE and LDAP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user+password authentication (Basic, Digest, NTLM, Negotiate, kerberos...), file transfer resume, proxy tunneling and a busload of other useful tricks

download/upload tool

Saturday, July 7, 2007

[Work] sample Makefile


MTL_INCLUDES=-I$(HOME)/MTL
CXX = g++
CXXCPP = g++ -E
CXXFLAGS = -g -ftemplate-depth-30 -Wall
CXX_OPTIMIE_FLAGS = -O2 -funroll-loops -fstrict-aliasing -fno-gcse
CXXLD = g++
DEFS = -DHAVE_CONFIG_H
LDFLAGS = -g
LIBS = -lm

CXXCOMPILE = $(CXX) $(DEFS) $(MTL_INCLUDES) $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(LDFLAGS) -o $@

.SUFFIXES: .cc
.cc.o:
$(CXXCOMPILE) -c $<

SRC = abs_sum.cc general_matvec_mult.cc
OBJS = $(addsuffix .o, $(basename $(SRC)))
EXES = $(basename $(SRC))

abs_sum_OBJS=abs_sum.o
general_matvec_mult_OBJS=general_matvec_mult.o

all: $(EXES)

abs_sum:$(OBJS)
$(CXXLINK) $(LDFLAGS) $(abs_sum_OBJS) $(LIBS)

general_matvec_mult:$(OBJS)
$(CXXLINK) $(LDFLAGS) $(general_matvec_mult_OBJS) $(LIBS)

clean:
rm $(EXES) $(OBJS)

.PHONY: clean

Friday, July 6, 2007

[Work] SWiK

SWiK is a community driven resource for people who use open source software.

[Work] Optimization library

The Matrix Template Library
The Matrix Template Library (MTL) is a high-performance generic component library that provides comprehensive linear algebra functionality for a wide variety of matrix formats.

terative Template Library
The Iterative Template Library (ITL) is a generic component library that provides iterative methods for solving linear systems. ITL also provides numerious preconditioners which is for MTL.

SparseLib++

High Performance Math Software Catalog

OPT++: An Object-Oriented Nonlinear Optimization Library

The Object-Oriented Numerics Page

Wednesday, July 4, 2007

[Work] Matlab tutorial

Matt's Matlab Tutorial Source Code Page

[Work] Accelerating Matlab

tips and tricks for accelerating Matlab
by Tom Minka

[Work] Image denoising

Nois Ninja from pictureCode
one of the best commercial denoising tool, with free trial version

GREYCstoration
Open source algorithm for image denoising and interpolation
by David Tschumperlé

image cooler
Free; noise reduction

BLS_GSM image denoising toolbox in Matlab
This toolbox implements the algorithm described in:
J Portilla, V Strela, M Wainwright, E P Simoncelli, "Image Denoising
using Scale Mixtures of Gaussians in the Wavelet Domain," IEEE
Transactions on Image Processing. vol 12, no. 11, pp. 1338-1351,
November 2003

PoEdges denoising
in Matlab
by Peter Gehler and Max Welling

Tuesday, July 3, 2007

[Work] Polarization

links:
Polarization.com
wikipedia on polarization

[Work] Glare

Glare is the sensation produced by luminance(brightness) within the visual field that is sufficiently greater than the luminance to which the eyes are adapted to cause annoyance, discomfort, or loss in visual performance and visibility.
(IES, Illuminating Engineering Society of North America)

Blinding glare is so intense that for an appreciable length of time no object can be seen.

Direct glare is produced by poorly shielded luminaires, bright widows, or from reflecting areas of high luminance, such as a ceiling plane receiving the light output from an indirect luminaire that is only a few feet below the ceiling.

Disabling glare causes a reduction in visual performance.

Veiling glare is a disabling glare caused by extreme contrast within a task that prevents the viewer from properly seeing the task: for example, the reflection on a printed page made of coated paper. Someone looking down at the paper will have brightness reflecting from the glossy surface. Such veiling reflections on the paper surface cause loss of visibility.

Discomfort glare is an annoyance that does not necessarily prevent accurate seeing of a task but could affect a person's performance over a period of time by causing eye fatigue.

Reflected glare comes from reflections off highly polished or specular materials that can be viewed by an occupant.

[Life] Healthy computing

http://www.healthycomputing.com/

[Work] Veiling glare

Veiling glare is a term used to indicate light which is scattered and reflected within the lens system. The net effect of veiling glare is to reduce imaging contrast.

The reduction in contrast of an optical image caused by superposition of scattered light.

Diffuse stray light at the image plane of an optical system that results in reduced contrast and resolution.

Veiling glare causes:
  • Internal multiple reflections between the lens surfaces.
  • Scatter from the surfaces of the lens elements due to scatches and the other imperfections in the polish, dirt and dust, fingerprints, grease, and poor antireflection coatings.
  • Bulk scatter from the interior of the glass and from bubbles and striae.
  • Scatter from optical cements.
  • Scatter and reflections from the ground edges of the lens elements, from internal lens mounts and from the internal surface of the lens barrel.
  • Reflections from the surfaces of diaphragms and shutter blades.
  • Fluorescence of the glass or optical cements.



Flare comes in two flavors, veiling glare and visible flare. Veiling glare is the loss of contrast seen in darker shadows from light bouncing around off the lens elements and film. To evaluate veiling glare, you want a thin dark subject against a bright white background. The easiest real world subjects I have found are thin tree branches against the sky in winter. In summer, the leaves get in the way, so I may opt to use a powerline against a bright cloudy sky. Ideally, the branches or wires should be dark black and transition abruptly to the white sky. The less solid black the branches or wires look, the more you are seeing the effects of flare. If you have a downloaded lens test chart , you can also do this test easily with the black and white lines on the chart.

To evaluate visible flare, you can take a photo of a bright point light source such as the sun. You may see a hexagonal or other pattern from reflections off the surface of the lens diaphragm blades. You may also see bright blobs or streaks of light reflected from lens elements. Try a shot without your UV filter, if you use one, to see why some of us don't use UV filters (they add to flare). Some lenses such as my 20mm f/3.5 AI nikkor have surprisingly little flare, even in direct sun in the photos shots. Zoom lenses tend to have much higher flare than other lenses due partly to the larger number of elements having more reflective surfaces. Again, this is one major reason many of us prefer fixed or non-zoom lenses.

/The question of subject distance when testing a lens is important. Photographic lenses are normally optimized for middle distances, say, six to ten metres, the range in which they may mostly be used. The wider the aperture, the narrower the optimal range, a factor important from f/1.4. Source: Lens Test Charts by Geoffrey Crawley in British Journal of Photography, January 31, 2001, p. 26./

Links:
McCann Imaging
Veiling glare on Imatest