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

767 Answers

Hire Me
expert
Muhammad Ali HaiderFinance

582 Answers

Hire Me
expert
Husnain SaeedComputer science

583 Answers

Hire Me
expert
Atharva PatilComputer science

953 Answers

Hire Me

Get Free Quote!

263 Experts Online