Point Operators Exercises
Antonio Albiol October 20, 2017
The following assignments will be done in this unit: Function that automatically increases contrast
Background estimation from video.
Creation of an HDR image using MATLAB
1 Auto-Scale
In this section you will program a function that given an image:
It computes histogram
It determines the values xmin and xmax so that a given percentage, P, of pixels will get saturated.
It determines the I/O table of the intensity transformation.
It applies the table to every pixel.
1.1 Experimentation
1.2 1.2.1
Write the code in the file autorange.cpp.
Execute the program autorange one on the image matricula poco contraste.jpg.
Execute the program autorange video on the videos matriculas1.avi and matriculas2.avi. Indicate what have you observed in each case.
What you will learn About CIMG
How to append two images side by side.
How to combine different CIMG functions in one single instruction.
1
1.2.2 About Image Processing
How to compute the histogram of an image
How to implement an automatic contrast expander.
The use of look-up tables as an alternative to compute values for each pixel.
1.3 Results Report
You should create a small report containing:
Code of the function.
Original image and result of matricula poco contraste.jpg.
Histogram of original and result image. (plotted using MATLAB)
2
2 Background Estimation in Video
A problem that often arises is to separate foreground objects from background in video. If the camera is static, one possibility is to estimate the aspect of background by averaging a number of video frames.
Once the background has been estimated, it is possible to subtract the background to each frame to get a foreground mask for pixels where the difference is large.
2.1 Experimentation
Study the code of video time average.cpp, the program that estimates the back- ground . This program computes the average of all video frames in the input video and shows partial results every 50 frames.
Compile the program and run it using as input svcte 2ips.avi. This video corre- sponds to 10 minutes of real duration at a rate of 2 images per second.
Create a program background subtract.cpp that takes as input
One background image ( the result of video time average.cpp )
One video
and computes and displays the absolute value of the difference of each frame with
background.
Remember that you will have to modify CMakeLists.txt.
2.2 What you will learn 2.2.1 About CIMG
How to make operations between CIMG images and constants.
The need to use the adequate data type: float for the sum of images.
The use of displays in CIMG.
2.2.2 About Image Processing
How to use the average of images to estimate background in video.
The advantage of using a small frame rate to reduce the computational load of
estimating background.
How to use background to obtain foreground masks.
3
2.3 Results Report
Each time that the program stops showing a partial background estimate it is possible to save it by pressing CTRL-S. Include some of these partial backgrounds and the final one on the report.
Include the code of background subtract.cpp and the changes that you made to CMakeLists.txt.
Include the difference image corresponding to the las to figures of your DNI or passport (indicating the frame number on the report)
4
3 Creation of a High Dynamic Range Image (HDR)
The dynamic range of intensities that a camera is able to record for a given camera aperture and exposure times is much smaller than what can happen in a scene.
In order to better capture the scene content, it is possible to combine several images of the same scene with different exposure times to get an image, called HDR, that can fit all the dynamic range without saturation.
HDR images are normally represented as floats. Such images have to be finally rescaled properly onto the range 0255 so that no burnt or dark zones appear.
In this exercise we will explore how to use the facilities of MATLAB Image Processing Toolbox de MATLAB for HDR.
3.1 Experiments
Read the help of function makehdr2 and make sure that you understand it.
Read the help of function tonemap2 and make sure that you understand it.
Using the provided images (or some that you may capture yourself using a tripod and varying the exposure) obtain an HDR image in the range 0-255.
3.2 What you will learn 3.2.1 About MATLAB
How to read and write images from disk using imread and imwrite.
How to display an image using imshow.
How to use MATLAB/Octave to create HDR images
makehdr2 tonemap2 imfinfo
5
3.3 About Image Processing
The concept of radiance image
How to convert from radiance image to normal image Learn what is EXIF data.
3.4 Results report
You should create a small report containing:
Original images
Result HDR image. Use different choices of optional parameters in tonemap func- tion. Show different results and the optional values used. Select which one is your best result.
Indicate the MATLAB commands used in each case.
6
Reviews
There are no reviews yet.