• Aucun résultat trouvé

EXERCISES, PROBLEM SETS, AND HOMEWORK .1 Parametric Plots

Dans le document Intelligent Image Processing (Page 192-197)

COMPARAMETRIC EQUATIONS, QUANTIGRAPHIC IMAGE

DIFFERENTLY EXPOSED IMAGES OF THE SAME SUBJECT MATTER As previously mentioned, comparison of two or more differently exposed

4.7 EXERCISES, PROBLEM SETS, AND HOMEWORK .1 Parametric Plots

Construct the parametric plot of (cost,sint) for 100 points of the parameter t ranging from 0 to 6. This can be done, using the Octave program, as follows:

octave:5> t=linspace(0,6);

octave:6> plot(cos(t),sin(t))

What do you observe about the shape of the plot? Is the shape complete? If not, what must be done to make the shape complete?

Now construct the same parametric plot for 100 points of the parameter t ranging from 0 to 6000. This can be done using the Octave commands:

octave:7> t=linspace(0,6000);

octave:8> plot(cos(t),sin(t))

What do you observe? Why is the shape not that of a smooth relation?

4.7.2 Comparaplots and Processing ‘‘Virtual Light’’

The reality mediator (WearCam) absorbs and quantifies light, processes these numerical quantities, and then re-synthesizes the result.

Recall from Chapter 3 that this process is as follows:

1. Light enters the apparatus and is converted into numbers.

2. The numbers pass through the computer.

3. The numbers are turned back into light that enters the eye.

This might seem like a rather expensive and complicated “window,” and one might ask, Why go to such trouble just to make a transparent viewing window?

The reason is that this creates a visual “reality stream” that allows one to modify, or to allow others to modify, one’s visual perception of reality. To do this, step 2 above is changed from just passing through to modifying light, while it is in numerical form.

In this chapter we saw that these numbers are referred to as “photoquanta.” It is desired that the “photoquanta” be calculated from ordinary digitized pictures.

To understand photoquanta, consider two images that differ only in exposure.

These two images may be matched to a so-called comparaplot (comparametric plot).

Recall the following definition: Thecomparametric plotof a functionf (q)is defined as the parametric plot off (q)versusf (kq), wherekis a scalar constant andq is the real-valuedcomparameter.

Proposition 4.7.1 When a functionf (q) is monotonic, the comparametric plot (f (q),f (kq))can be expressed as a functiong(f )not involvingq.

Consider the functionf (q)=q1/3. Construct a comparametric plot for a fixed value of the comparametric ratiok=2. In other words, construct a plot off (q) versusf (2q). What do you notice about this comparametric plot?

4.7.3 A Simple Exercise in Comparametric Plots

What class of semimonotonic functions f (q) is such that the comparametric plot of f (q) versus f (2q) is a straight line? Consider only q≥0, q (this corresponds to real quantities of light greater than or equal to zero). Identify the most general (broadest) class of functions whose comparametric plots are straight lines.

4.7.4 A Simple Example with Actual Pictures

Obtain two images that differ only in exposure. You can do this using the WearComp and QuickCam by varying the brightness (anchor the QuickCam fixed on a tripod or mount pointing at a fixed scene rather than wearing it — the wearable version of the Wyckoff principle will be taught in Chapter 6; for now just fix the camera on a tripod). Alternatively, you could use the standard

“mannfamily” image sequence, for example, one image called “Dark exposure”

from http://wearcam.org/mannfamily dark.pgm and “Light exposure”

from http://wearcam.org/mannfamily light.pgm Full-size color images in higher resolution are in http://wearcam.org/mannfamily dark.jpgand http://wearcam.org/mannfamily light.jpg.

Compute the histograms of each of the two images as well as the comparagram jointly across both of these two images. What do you notice about the comparagram? Explain the physical intuitive interpretation of the comparagram, as compared with the two histograms.

Don’t use the gif files on the www page, use the pgm version of the files, because the C-code provided there doesn’t work with gif files. We’re trying to phase out the use of gif because of the proprietary (Unisys) nonfree nature of this file format. If disk space is an issue, you can save in the lossless png (Portable Network Graphics) format, which has largely replaced the gif format.

4.7.5 Unconstrained Comparafit

Regard the comparagram as a set of bin counts on ordered pairs(x, y)wherex= m/255 andy=n/255. Find a function f−1(q) such that f−1(y)kf−1(x)is minimized when weighted by the bin counts of the comparagramJ[m, n]; that is, determinef−1(q)that minimizesε=255m=0255n=0(f−1(y)kf−1(x))2J[m, n], or equivalently, determine F1 that minimizes ε=255m=0255n=0(F1(y)F−1(x)K)2J[m, n]. In the example of Section 4.7.4 the value ofk is 4(K = log2(k)=2).

What are some of the problems with this “solution”?

4.7.6 Weakly Constrained Comparafit

Find a functionf1(q)such thatf1(y)−4f1(x)is minimized when weighted by the bin counts of the comparagram J[m, n], as in the previous question, but this time further add the constraint thatf1 be semimonotonic. [Hint: Constrain the first difference (as given by the Octave “diff” command) of the desired solution to be nonnegative. Additional hint: This problem is a quick one-liner if you set it up right and then use a package called qp.m (quadratic programming).]

Is this solution better than the previous solution, and if so, in what ways?

What are some of the problems with this “solution”?

Bonus question: Try imposing some smoothness constraints, and describe your results.

4.7.7 Properly Constrained Comparafit

Select a function from the left column of Table 4.4, and fit this function to the comparagram. Explain your reasons for choosing whichever function you select.

Now since you know the solutions of the entries in this table (from the right side of the table), report onf (q)recovered from the comparagram. Assume that k=4 (i.e.,K =2). You have now solved for the nonlinear response function of the camera given only two differently exposed images.

4.7.8 Combining Differently Exposed Images

Combine the two images together to render a single image of improved dynamic range and tonal fidelity, as described in this previous chapter.

A rough outline, consisting of skeletal example C-code may be found at http://wearcam.org/wyckoff.html.

Experiment with different ways of combining these (or your own) images. Try first applying f−1 to the two images to obtain two estimates of the quantity of lightq. Multiplying the first by four (to lighten it up enough to tonally “register”

it with the second) and then try adding the two; for example, 4a+bwhere ais the first andbis the second. Don’t forget to pass the result back throughf and scale the result back down, or you will overrun the 0 to 255 image interval. When you scale down, what you’re doing is a weighted average: (4a+1b)/(4+1), where the weights are 4 and 1. If you are using your own images, the number will not necessarily be 4, but you can easily find what your number is, either by experiment or measurement.

Explain your results; don’t just submit the finished pictures without an explanation. Also feel free to try other laws of composition to combine the two (or more) differently exposed pictures to obtain a single image of greater dynamic range.

4.7.9 Certainty Functions

Now try using weights that depend on the image pixel value. The weighting should be higher for pixel values near 127, and lower for pixel values near 0 or 255. This can be done by defining a Gaussian certainty function, c, such that c=exp(−x2), or c=pow(e,pow(x,2)) in “C,” where e is the Naperian base (2.718. . .) and x=6∗(pixelvalue/255)−3 makes it roll off nicely at “3 sigma” either side. (So pixel value 0 has very small certainty as does pixel value 255, but pixel value 127 has a high certainty value.)

Moderate pixels are favored so that extreme pixel values (which are under-or overexposed) are weighted less while properly under-or moderate exposed values more. Implement the “certainty” function as a function call. Test it to see if you get certainty(0)=1.2341∗10−4, and certainty(127)=0.9999. So now try calculating the weighted sum(4c(a)a+c(b)b)/(4c(a)+c(b))

You might also find useful the program “certaint.c” fromhttp://wearcam.

org/orbits/. This program taints an image with uncertainty. A certainted image can be loaded into GIMP (Gnu image manipulation program) or further processed (combined with other certainted images) using the CEMENT (computer-enhanced multiple exposure numerical technique) program, as an alternative to writing your own programs for combining the images.

4.7.10 Preprocessing (Blurring the Certainty Functions) and Postprocessing

Try blurring the certainty functions prior to using them as weights to do the weighted average that combines the images in lightspace. Experiment with

various blur radii, and comment on your results. Also try sharpening the final resulting image. Experiment with a combination of blurring the certainty functions and sharpening the final resultant combined image.

In addition to submitting the final pictures, explain your results. Feel free to try other laws of composition to combine the two (or more) differently exposed pictures to obtain a single image of greater dynamic range.

Copyright2002 John Wiley & Sons, Inc.

ISBNs: 0-471-40637-6 (Hardback); 0-471-22163-5 (Electronic)

5

LIGHTSPACE AND

Dans le document Intelligent Image Processing (Page 192-197)

Outline

Documents relatifs