logo Use CA10RAM to get 10%* Discount.
Order Nowlogo
(5/5)

The scaling and display of images is an extremely important concept. Typically, display buffers require that images be provided in a specific format.

INSTRUCTIONS TO CANDIDATES
ANSWER ALL QUESTIONS

 Digital Image Processing 

 

1         Linear Scaling Transformations

The scaling and display of images is an extremely important concept. Typically, display buffers require that images be provided in a specific format. For example, it is pretty common that an image be formatted for the display buffer as an unsigned 8-bit number for grayscale images or a 24-bit image for color images (8-bits per three color channels). The act of mapping a given image from its current units and data format into the display space is called a scaling transformation. Often times we are interested in linear scaling transformations. Shown below are two linear scaling transformations where at left the output is an 8-bit unsigned integer and at right the output is a floating-point number in the range of [0, 1].

In each case, notice that a range [αl, αh] is specified to indicate the region where linear scaling should be applied with values outside of this range being saturated, i.e.,

Notice that in the transformation above, the output image will be in the range of [0, 1].

 

The imshow() function in MATLAB will display images in a number of formats  (see the function documentation for details).   When an image’s data format is single or double precision,  imshow() expects the range of the image to be          [0, 1].  When an image’s data format is an unsigned integer of bit depth n,  imshow() expects the range of the image to       be [0, 2n − 1]. There are a number of linear scaling transformations that are useful. Here, we are going to focus on three methods: Max-Min Scaling, Statistical Scaling, and Absolute Scaling.

 

Max-Min Scaling : In this type of scaling, we want to scale the image so that the entire range of the input image maps into the range of [0,1]. Thus, we set and αl = min i[m, n]m,nαh = max i[m, n].m,n

Statistical Scaling: In this type of scaling, we want to scale the image so that the input image’s range of [µ − Aσ, µ + Aσ] maps into the range [0, 1]. Thus, we simply compute the mean and standard deviation (µ, σ) across all pixels in the image.  The parameter A controls how many standard deviations about the mean that we want to include in our scaling range, where A is a real number. Hence, we simply set αl = µ − Aσ and αh = µ + Aσ.

Absolute Scaling: In absolute scaling, the scaling range is directly specified by the user such that αl = L and

αh = H, where L and H are in units of the input image’s intensity levels.

 

2        Assignment

For this assignment, you are going to implement these three linear scaling methods in a MATLAB function (I have included a template for you to use with this assignment). We will adopt the convention that all output images will be in double precision format, and thus all scaled output images should be in the range of [0, 1]. As such, regardless of the input image format, the first step will be to convert the image to double() format. Then, depending upon the number of input parameters to the function, the function will perform a corresponding linear transformation (no parameters for max-min, one for statistical, and two for absolute). See the function template for additional details.

Testing : Once you have implemented your code, read in each of the three images provided with this assignment. Use the imread() function for reading JPG images. Use the load() command to read in .mat file images. Apply each type of scaling to each image according to the parameters specified below. Then, display each output image (three figures with three subplots per figure) using the imshow() function.

 

Image

Scaling Type

Parameter 1

Parameter 2

image1.png

Max-Min

 

Statistical

A = 10.0

 

Absolute

L = 130

H = 132

image2.jpg

Max-Min

 

Statistical

A = 1.5

 

Absolute

L = 50

H = 140

image3.mat

Max-Min

 

Statistical

A = 1.5

 

Absolute

L = 280.0

H = 310.0

image1.png is a gray-level 8-bit image with only 4 intensity levels. image2.jpg is a gray-level 8-bit image of a landscape photograph taken at the Giant’s Causeway in Northern Ireland. image3.mat is a gray-level double-precision infrared image of a daytime scene at LAX airport, calibrated to units of Kelvin.

 

Submission : Publish the results of your work into a .pdf file (which should include the code and figures) and submit through Isidore.

 

3        Additional Exploration

  1. If you would like to additionally include functionality for 3-channel RGB images, these scalings are typically ap- plied across all three color channels (not to each color channel independently). So, Max-Min Scaling would find the minimum and maximum value across all three colors channels, Statistical Scaling would find the mean and standard deviation using all three color channels, and Absolute Scaling would apply the same L and H to all three color channels. If each color channel is treated independently it could result in color casts or shifts in the output image.

 

  1. If you would like to convert your image to an unsigned n-bit integer format, you can simply take the output of your function in double precision format, multiply it by 2n − 1, apply a floor() operation, and then cast it to the appropriate data type. For example, to convert the results to an 8-bit unsigned integer format, use the command out8bit = uint8(floor(255 ∗ out));.

 

  • Code

 

function out = imgscale(in,param1,param2)

% out = imgscale(in,[param1],[param2])

%% This function takes an input gray scale image (in) and scales it

% according to one of three possible scaling transformations: max-min

% scaling, absolute scaling, or statistical scaling.

% Max-Min Scaling: If no parameters are specified, max-min scaling is

% assumed and min(in)-->0 and max(in)-->1. All values between min(in) and

% max(in) are linearly scaled between (0,1).

% Statistical Scaling: If one parameter is specified, statistical scaling

% is assumed, where param1 is the specified standard deviation of in.

% Values of in<= mean(in)-param1*sdev(in)-->0 and

% in>=mean(in)+param1*sdev(in)-->1. Values of in in the range of

% (mean(in)-param1*sdev(in), mean(in)+param1*sdev(in)) are linearly scaled

% between (0,1).

% Absolute Scaling: If two parameters are specified, absolute scaling is

% assumed and values of in<=param1-->0 and in>=param2-->1. Values of in

% in the range of (param1,param2) are linearly scaled between (0,1).

% INPUT PARAMETERS:

% in        Input image of size MxN

% param1    Either the lower absolute scaling range for absolute scaling or

%           the standard deviation for statistical scaling

% param2    The upper absolute scaling range for absolute scaling

% OUTPUT PARAMETERS:

% out       Output image of size MxN in double precision format scaled to

%           the range of [0,1]

% Note: The output image can easily be transformed to another format if

% desired. For example, if an unsigned 8-bit format is desired, simply

% transform out as follows: out2 = uint8(floor(255*out));

[M,N,Z] = size(in);

in = double(in);

%Max-Min Scaling: Set alpha_l = min(in(:)). Set alpha_h = max(in(:));

if(nargin==1)

% Statistical Scaling: Set alpha_l = mean(in(:))-param1*std(in(:)).

% Set alpha_h = mean(in(:))+param1*std(in(:)).

elseif(nargin==2)

% Absolute Scaling: Set alpha_l = param1. Set alpha_h = param2.

elseif(nargin==3)

 end

%Saturate all values of in < alpha_l = alpha_l

%aturate all values of in > alpha_h = alpha_h

%Linearly scale data in the range of [alpha_l, alpha_h] --> [0,1]

(5/5)
Attachments:

Related Questions

. Introgramming & Unix Fall 2018, CRN 44882, Oakland University Homework Assignment 6 - Using Arrays and Functions in C

DescriptionIn this final assignment, the students will demonstrate their ability to apply two ma

. The standard path finding involves finding the (shortest) path from an origin to a destination, typically on a map. This is an

Path finding involves finding a path from A to B. Typically we want the path to have certain properties,such as being the shortest or to avoid going t

. Develop a program to emulate a purchase transaction at a retail store. This program will have two classes, a LineItem class and a Transaction class. The LineItem class will represent an individual

Develop a program to emulate a purchase transaction at a retail store. Thisprogram will have two classes, a LineItem class and a Transaction class. Th

. SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 1 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

. Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of Sea Ports. Here are the classes and their instance variables we wish to define:

1 Project 2 Introduction - the SeaPort Project series For this set of projects for the course, we wish to simulate some of the aspects of a number of

Ask This Question To Be Solved By Our ExpertsGet A+ Grade Solution Guaranteed

expert
Um e HaniScience

943 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

737 Answers

Hire Me
expert
Husnain SaeedComputer science

858 Answers

Hire Me
expert
Atharva PatilComputer science

613 Answers

Hire Me
July
January
February
March
April
May
June
July
August
September
October
November
December
2025
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
SunMonTueWedThuFriSat
29
30
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
1
2
00:00
00:30
01:00
01:30
02:00
02:30
03:00
03:30
04:00
04:30
05:00
05:30
06:00
06:30
07:00
07:30
08:00
08:30
09:00
09:30
10:00
10:30
11:00
11:30
12:00
12:30
13:00
13:30
14:00
14:30
15:00
15:30
16:00
16:30
17:00
17:30
18:00
18:30
19:00
19:30
20:00
20:30
21:00
21:30
22:00
22:30
23:00
23:30