This document discusses various mathematical techniques for image processing and enhancement, including power functions, exponential functions, logarithmic functions, and linear contrast stretching. It provides examples of implementing each technique using MATLAB. For power functions, applying γ > 1 darkens an image while 0 < γ < 1 lightens it. Exponential functions with b > 1 darken overexposed images, while logarithmic transforms with b > 1 enhance low-contrast images by bringing out hidden features. Linear contrast stretching improves low-contrast images by remapping pixel values to better utilize the full tonal range.
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxmydrynan
CSCI 2033: Elementary Computational Linear Algebra
(Spring 2020)
Assignment 1 (100 points)
Due date: February 21st, 2019 11:59pm
In this assignment, you will implement Matlab functions to perform row
operations, compute the RREF of a matrix, and use it to solve a real-world
problem that involves linear algebra, namely GPS localization.
For each function that you are asked to implement, you will need to complete
the corresponding .m file with the same name that is already provided to you in
the zip file. In the end, you will zip up all your complete .m files and upload the
zip file to the assignment submission page on Gradescope.
In this and future assignments, you may not use any of Matlab’s built-in
linear algebra functionality like rref, inv, or the linear solve function A\b,
except where explicitly permitted. However, you may use the high-level array
manipulation syntax like A(i,:) and [A,B]. See “Accessing Multiple Elements”
and “Concatenating Matrices” in the Matlab documentation for more informa-
tion. However, you are allowed to call a function you have implemented in this
assignment to use in the implementation of other functions for this assignment.
Note on plagiarism A submission with any indication of plagiarism will be
directly reported to University. Copying others’ solutions or letting another
person copy your solutions will be penalized equally. Protect your code!
1 Submission Guidelines
You will submit a zip file that contains the following .m files to Gradescope.
Your filename must be in this format: Firstname Lastname ID hw1 sol.zip
(please replace the name and ID accordingly). Failing to do so may result in
points lost.
• interchange.m
• scaling.m
• replacement.m
• my_rref.m
• gps2d.m
• gps3d.m
• solve.m
1
Ricardo
Ricardo
Ricardo
Ricardo
�
The code should be stand-alone. No credit will be given if the function does not
comply with the expected input and output.
Late submission policy: 25% o↵ up to 24 hours late; 50% o↵ up to 48 hours late;
No point for more than 48 hours late.
2 Elementary row operations (30 points)
As this may be your first experience with serious programming in Matlab,
we will ease into it by first writing some simple functions that perform the
elementary row operations on a matrix: interchange, scaling, and replacement.
In this exercise, complete the following files:
function B = interchange(A, i, j)
Input: a rectangular matrix A and two integers i and j.
Output: the matrix resulting from swapping rows i and j, i.e. performing the
row operation Ri $ Rj .
function B = scaling(A, i, s)
Input: a rectangular matrix A, an integer i, and a scalar s.
Output: the matrix resulting from multiplying all entries in row i by s, i.e. per-
forming the row operation Ri sRi.
function B = replacement(A, i, j, s)
Input: a rectangular matrix A, two integers i and j, and a scalar s.
Output: the matrix resulting from adding s times row j to row i, i.e. performing
the row operatio.
CSCI 2033 Elementary Computational Linear Algebra(Spring 20.docxmydrynan
CSCI 2033: Elementary Computational Linear Algebra
(Spring 2020)
Assignment 1 (100 points)
Due date: February 21st, 2019 11:59pm
In this assignment, you will implement Matlab functions to perform row
operations, compute the RREF of a matrix, and use it to solve a real-world
problem that involves linear algebra, namely GPS localization.
For each function that you are asked to implement, you will need to complete
the corresponding .m file with the same name that is already provided to you in
the zip file. In the end, you will zip up all your complete .m files and upload the
zip file to the assignment submission page on Gradescope.
In this and future assignments, you may not use any of Matlab’s built-in
linear algebra functionality like rref, inv, or the linear solve function A\b,
except where explicitly permitted. However, you may use the high-level array
manipulation syntax like A(i,:) and [A,B]. See “Accessing Multiple Elements”
and “Concatenating Matrices” in the Matlab documentation for more informa-
tion. However, you are allowed to call a function you have implemented in this
assignment to use in the implementation of other functions for this assignment.
Note on plagiarism A submission with any indication of plagiarism will be
directly reported to University. Copying others’ solutions or letting another
person copy your solutions will be penalized equally. Protect your code!
1 Submission Guidelines
You will submit a zip file that contains the following .m files to Gradescope.
Your filename must be in this format: Firstname Lastname ID hw1 sol.zip
(please replace the name and ID accordingly). Failing to do so may result in
points lost.
• interchange.m
• scaling.m
• replacement.m
• my_rref.m
• gps2d.m
• gps3d.m
• solve.m
1
Ricardo
Ricardo
Ricardo
Ricardo
�
The code should be stand-alone. No credit will be given if the function does not
comply with the expected input and output.
Late submission policy: 25% o↵ up to 24 hours late; 50% o↵ up to 48 hours late;
No point for more than 48 hours late.
2 Elementary row operations (30 points)
As this may be your first experience with serious programming in Matlab,
we will ease into it by first writing some simple functions that perform the
elementary row operations on a matrix: interchange, scaling, and replacement.
In this exercise, complete the following files:
function B = interchange(A, i, j)
Input: a rectangular matrix A and two integers i and j.
Output: the matrix resulting from swapping rows i and j, i.e. performing the
row operation Ri $ Rj .
function B = scaling(A, i, s)
Input: a rectangular matrix A, an integer i, and a scalar s.
Output: the matrix resulting from multiplying all entries in row i by s, i.e. per-
forming the row operation Ri sRi.
function B = replacement(A, i, j, s)
Input: a rectangular matrix A, two integers i and j, and a scalar s.
Output: the matrix resulting from adding s times row j to row i, i.e. performing
the row operatio.
Image Enhancement in the Spatial Domain.pdfkamaluddinnstu
The principal objective of enhancement is to
process an image so that the result is more
suitable than the original image for a specific
application.
Image enhancement approaches fall into two
broad categories:
- Spatial domain methods
- Frequency domain methods
The term spatial domain refers to the image
plane itself, and approaches in this category are
based on direct manipulation of pixel in an image.
Frequency domain processing techniques are
based on modifying the Fourier transformation of
an image.
Choice of weighting function and expansion function in cemMohit Chimankar
A brief description of the numerical technique which has been developed to solve the electromgnetic field problem which has given the user advantage of solving the complex problem more easily.
International Journal of Computational Engineering Research(IJCER)ijceronline
International Journal of Computational Engineering Research(IJCER) is an intentional online Journal in English monthly publishing journal. This Journal publish original research work that contributes significantly to further the scientific knowledge in engineering and Technology.
I am Samuel H. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Alberta, Canada. I have been helping students with their homework for the past 12 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
More Related Content
Similar to Lightening & Darkening of Grayscale Image
Image Enhancement in the Spatial Domain.pdfkamaluddinnstu
The principal objective of enhancement is to
process an image so that the result is more
suitable than the original image for a specific
application.
Image enhancement approaches fall into two
broad categories:
- Spatial domain methods
- Frequency domain methods
The term spatial domain refers to the image
plane itself, and approaches in this category are
based on direct manipulation of pixel in an image.
Frequency domain processing techniques are
based on modifying the Fourier transformation of
an image.
Choice of weighting function and expansion function in cemMohit Chimankar
A brief description of the numerical technique which has been developed to solve the electromgnetic field problem which has given the user advantage of solving the complex problem more easily.
International Journal of Computational Engineering Research(IJCER)ijceronline
International Journal of Computational Engineering Research(IJCER) is an intentional online Journal in English monthly publishing journal. This Journal publish original research work that contributes significantly to further the scientific knowledge in engineering and Technology.
I am Samuel H. I am a Mechanical Engineering Assignment Expert at matlabassignmentexperts.com. I hold a Ph.D. Matlab, University of Alberta, Canada. I have been helping students with their homework for the past 12 years. I solve assignments related to Mechanical Engineering.
Visit matlabassignmentexperts.com or email info@matlabassignmentexperts.com.
You can also call on +1 678 648 4277 for any assistance with Mechanical Engineering Assignments.
Similar to Lightening & Darkening of Grayscale Image (20)
Operation “Blue Star” is the only event in the history of Independent India where the state went into war with its own people. Even after about 40 years it is not clear if it was culmination of states anger over people of the region, a political game of power or start of dictatorial chapter in the democratic setup.
The people of Punjab felt alienated from main stream due to denial of their just demands during a long democratic struggle since independence. As it happen all over the word, it led to militant struggle with great loss of lives of military, police and civilian personnel. Killing of Indira Gandhi and massacre of innocent Sikhs in Delhi and other India cities was also associated with this movement.
How to Make a Field invisible in Odoo 17Celine George
It is possible to hide or invisible some fields in odoo. Commonly using “invisible” attribute in the field definition to invisible the fields. This slide will show how to make a field invisible in odoo 17.
Embracing GenAI - A Strategic ImperativePeter Windle
Artificial Intelligence (AI) technologies such as Generative AI, Image Generators and Large Language Models have had a dramatic impact on teaching, learning and assessment over the past 18 months. The most immediate threat AI posed was to Academic Integrity with Higher Education Institutes (HEIs) focusing their efforts on combating the use of GenAI in assessment. Guidelines were developed for staff and students, policies put in place too. Innovative educators have forged paths in the use of Generative AI for teaching, learning and assessments leading to pockets of transformation springing up across HEIs, often with little or no top-down guidance, support or direction.
This Gasta posits a strategic approach to integrating AI into HEIs to prepare staff, students and the curriculum for an evolving world and workplace. We will highlight the advantages of working with these technologies beyond the realm of teaching, learning and assessment by considering prompt engineering skills, industry impact, curriculum changes, and the need for staff upskilling. In contrast, not engaging strategically with Generative AI poses risks, including falling behind peers, missed opportunities and failing to ensure our graduates remain employable. The rapid evolution of AI technologies necessitates a proactive and strategic approach if we are to remain relevant.
Normal Labour/ Stages of Labour/ Mechanism of LabourWasim Ak
Normal labor is also termed spontaneous labor, defined as the natural physiological process through which the fetus, placenta, and membranes are expelled from the uterus through the birth canal at term (37 to 42 weeks
Exploiting Artificial Intelligence for Empowering Researchers and Faculty, In...Dr. Vinod Kumar Kanvaria
Exploiting Artificial Intelligence for Empowering Researchers and Faculty,
International FDP on Fundamentals of Research in Social Sciences
at Integral University, Lucknow, 06.06.2024
By Dr. Vinod Kumar Kanvaria
The French Revolution, which began in 1789, was a period of radical social and political upheaval in France. It marked the decline of absolute monarchies, the rise of secular and democratic republics, and the eventual rise of Napoleon Bonaparte. This revolutionary period is crucial in understanding the transition from feudalism to modernity in Europe.
For more information, visit-www.vavaclasses.com
2024.06.01 Introducing a competency framework for languag learning materials ...Sandy Millin
http://sandymillin.wordpress.com/iateflwebinar2024
Published classroom materials form the basis of syllabuses, drive teacher professional development, and have a potentially huge influence on learners, teachers and education systems. All teachers also create their own materials, whether a few sentences on a blackboard, a highly-structured fully-realised online course, or anything in between. Despite this, the knowledge and skills needed to create effective language learning materials are rarely part of teacher training, and are mostly learnt by trial and error.
Knowledge and skills frameworks, generally called competency frameworks, for ELT teachers, trainers and managers have existed for a few years now. However, until I created one for my MA dissertation, there wasn’t one drawing together what we need to know and do to be able to effectively produce language learning materials.
This webinar will introduce you to my framework, highlighting the key competencies I identified from my research. It will also show how anybody involved in language teaching (any language, not just English!), teacher training, managing schools or developing language learning materials can benefit from using the framework.
Synthetic Fiber Construction in lab .pptxPavel ( NSTU)
Synthetic fiber production is a fascinating and complex field that blends chemistry, engineering, and environmental science. By understanding these aspects, students can gain a comprehensive view of synthetic fiber production, its impact on society and the environment, and the potential for future innovations. Synthetic fibers play a crucial role in modern society, impacting various aspects of daily life, industry, and the environment. ynthetic fibers are integral to modern life, offering a range of benefits from cost-effectiveness and versatility to innovative applications and performance characteristics. While they pose environmental challenges, ongoing research and development aim to create more sustainable and eco-friendly alternatives. Understanding the importance of synthetic fibers helps in appreciating their role in the economy, industry, and daily life, while also emphasizing the need for sustainable practices and innovation.
1. Mathematical Techniques
of Image Processing
Master of Applied Mathematics
Department of Mathematics
College of Science - University of Baghdad
Saad Al-Momen
2
4. Power Functions and Gamma-
Correction
01
Exponential Functions and Image Transformations
02
Logarithmic Functions and Image
Transformations
03
Linear Functions and Contrast Stretching
04
Automation of Image Enhancement
05
6. 𝒇 𝒙 = 𝒙𝟐
0,
1
2
0,
1
4
Shrinks
1
2
, 1
1
4
, 1
Stretches
𝒇 𝒙 = 𝒙
0,
1
4
0,
1
2
Stretches
1
4
, 1
1
2
, 1
Shrinks
• First we divide the pixel values by 255 in order to normalize
them by putting them in to the range of 0 to 1.
• Next, we raise the (normalized) pixel values to a positive power
0 < 𝛾 < 1 (for example, 𝛾 =
1
2
).
• Finally, we multiply the transformed pixel values by 255 and plot
the resulting image.
Practicall
y
10. Any value 𝛾> 1 can
be used to darken the
image, and any value
0 < 𝛾 < 1 can be
used to lighten it.
11. Write a MATLAB function that would lighten (or darken)
the specified image using the specified value of 𝛾. The
function should accept both the matrix of the image and
the value of 𝛾 as inputs. Ideally, it should work with any
gray scale image and with any color image. In the latter
case, the image should be converted into the YCbCr
color space, and the transformation should be applied to
the Y channel.
E x e r c i s e s
13. As we saw in the previous section, darkening could be
accomplished by raising the (normalized) pixel values to a positive
power 𝛾 > 1, that is, by applying a function that has the property
of being concave up.
Another well-known class of
functions that are concave up is the
class of exponential functions 𝑏𝑥
Unlike the graphs of the power
functions, the graphs of exponential
functions do not pass through the
origin, which is going to be a
problem if we apply an exponential
function to the pixel values.
Fortunately, this deficiency can be
easily remedied by shifting the
graph one unit down.
𝒚 = 𝟐𝒙
𝒚 = 𝟓𝒙
𝒚 = 𝟐𝟎𝒙
Basic Exponential
Functions
14. We would also like our function to map the interval [0, 1] into the
interval [0,1].
We are looking for a function:
𝑓 𝑥 = 𝑐(𝑏𝑥 − 1)
that satisfies the conditions
𝑓 0 = 0 and 𝑓 1 = 1
The second conditions above
implies that the constant 𝑐 has to
equal
𝑐 =
1
𝑏 − 1
i.e.
𝑓 𝑥 =
(𝑏𝑥
− 1)
𝑏 − 1
𝒚 = 𝒄(𝟐𝒙
− 𝟏)
𝒚 = 𝒄(𝟓𝒙
− 𝟏)
𝒚 = 𝒄(𝟐𝟎𝒙
− 𝟏)
Exponential Transforms
15. MATLAB
Implementation
• First we divide the pixel values by 255 in
order to normalize them by putting them in
to the range of 0 to 1.
• Next, we calculate every pixel value 𝐵(𝑚, 𝑛)
in the modified image 𝐵 from the
corresponding pixel 𝐴(𝑚, 𝑛) by means of the
formal
𝐵 𝑚, 𝑛 = c(𝑏𝐴 𝑚,𝑛 − 1)
• Finally, we multiply the transformed pixel
values by 255 and plot the resulting image.
Practicall
y
17. The exponential transform
tends to be more
effective in correcting
overexposed images that
have most of the pixel
values crowded in a
small interval near the
maximal intensity.
18. Write a MATLAB function that would darken the specified
image using the exponential transform with a specified
value of the base b. Your function should accept the
image and the base b as inputs. Ideally, your function
should work with any gray scale image and with any
color image. In the latter case, the image must be
converted into the YCbCr color space, and the
transformation must be applied to the Y channel.
E x e r c i s e s
20. In the previous section, we saw that in order to darken an overexposed
image, we had a choice of mathematical instruments and were not limited
to just the power-function transforms with the parameter 𝛾 > 1.
The exponential-function transform is
used for images where most of the
pixel values concentrated in a
narrow interval of near-maximal
intensity.
Similarly, when it comes to lightening
an image, there is no reason to feel
limited to just the power function
transform with the parameter 0 < 𝛾 <
1.
𝒚 = 𝒍𝒐𝒈𝟐𝒙
𝒚 = 𝒍𝒐𝒈𝟓𝒙
𝒚 = 𝒍𝒐𝒈𝟐𝟎𝒙
What made such power functions
suitable for the purpose of lightening
an image is that their graphs are
concave down.
Basic Logarithmic Functions
21. Unlike the graphs of the power functions, the graphs of the logarithmic
functions do not pass through the origin. Nor do they pass through the point
(1,1)
The former deficiency can be easily
remedied by shifting the graph one unit to
the left by adding 1 to the expression of the
logarithm is applied to.
In order to ensure that our function maps
the interval [0,1] onto the interval [0,1], we
need to impose further conditions.
We are looking for a function:
𝑓 𝑥 = 𝑐log𝑏(𝑥 + 1)
that satisfies the conditions
𝑓 0 = 0 and 𝑓 1 = 1
The second conditions
above implies that the
constant 𝑐 has to equal
1 = 𝑐 log𝑏 2
𝑐 =
1
log𝑏 2
𝑓 𝑥 =
log𝑏(𝑥 + 1)
log𝑏 2
⇒ 𝑓 𝑥 = log2(𝑥 + 1)
𝐥𝐨𝐠𝒂𝒙 =
𝐥𝐨𝐠𝒃 𝒙
𝐥𝐨𝐠𝒃 𝒂
22. 𝑔 𝑥 = log𝑏(𝜎𝑥 + 1)
that satisfies the conditions
𝑔 0 = 0 and 𝑔 1 = 1
From the second condition we have
1 = log𝑏(𝜎 + 1)
𝑏1
= 𝜎 + 1
So the parameter 𝜎 satisfys the condition
𝜎 = 𝑏 − 1
One possible idea would be to recall that logarithmic and exponential functions
are inverses of each other.
The inverse of 𝑓 𝑥 = 𝑐 𝑏𝑥 − 1 is 𝑓−1 𝑥 = log𝑏(
𝑥
𝑐
+ 1)
Therefore, it would seem reasonable to construct a suitable function for our
logarithmic transform in the form.
𝒚 = 𝒍𝒐𝒈𝟐(𝝈𝒙 + 𝟏)
𝒚 = 𝒍𝒐𝒈𝟓(𝝈𝒙 + 𝟏)
𝒚 = 𝒍𝒐𝒈𝟐𝟎(𝝈𝒙 + 𝟏)
Logarithmic Transforms
𝒚 = 𝒍𝒐𝒈𝒃𝒙 ⇔ 𝒃𝒚 = 𝒙
23. MATLAB
Implementation
• First we divide the pixel values by 255 in
order to normalize them by putting them in to
the range of 0 to 1.
• Next, we calculate every pixel value 𝐵(𝑚, 𝑛) in
the modified image 𝐵 from the corresponding
pixel 𝐴(𝑚, 𝑛) by means of the formal
𝐵 𝑚, 𝑛 = log𝑏 𝜎𝐴 𝑚, 𝑛 + 1 =
loga(𝜎𝐴 𝑚, 𝑛 + 1)
log𝑎 𝑏
• Finally, we multiply the transformed pixel
values by 255 and plot the resulting image.
Practicall
y
24. E x a m p l e
Logarithmic transform
𝑏 = 1000
We can get similar results by using a power-function transform with the parameter
0 < 𝛾 < 1.
However, the logarithmic transform tends to be more effective in bringing to light the
otherwise hidden features in an image where intensity levels differ vastly, but most
of the pixel values are very small
25. Write a MATLAB function that would bring out the hidden
features of the specified image using the logarithmic transform
with the specified value of the base 𝑏.Your function should
accept the image and the base as inputs. Ideally, your function
should work with any gray scale image and with any color
image. In the latter case, the image must be converted into the
YCbCr color space, and the transformation must be applied to
the Y channel
E x e r c i s e s
26. Suppose that a function is described by the formula
𝑦 = log𝑏(𝑐𝑥 + 1).
Determine the values of the parameters 𝑏 and 𝑐 if the graph of
the functions passes through the points
(a) (1,3) and (2,12),
(b) (1,5) and (4,10).
E x e r c i s e s
28. Low Contrast images
• It is not too light or to dark.
• The image only takes advantage of a small part of the available
range of pixel values.
Instead of being spread between 0 and 255, most
of the pixel values appear to fall into the fairly
narrow interval between, roughly, 75 and 160
Find the smallest value
74 the darkest pixel
Find the quartiles
𝑄1 = 89, 𝑄3 = 131
Find the largest value
224 the lightest pixel
The Action
Stretch the current interval
[74,224] to [0,255]
Stretch the narrow range [𝑄1, 𝑄3] to
the middle half [63,191]
29. 0 63 19
1
25
5
mi
n
𝑸𝟏 𝑸𝟑 max
We are looking for a monotone function 𝑔(𝑥) such that
𝑔 74 = 0, 𝑔 89 = 63, 𝑔 131 = 191, and 𝑔 224 = 255
34. Previously, we used trial and error to select the value of parameters
in power, exponential and logarithmic functions to enhance an image.
The contrast-stretching effect of the power-function transformation 𝑓 𝑥 = 𝑥𝛾
at a point
𝑥 = 𝑥0is related the derivative
𝑓′
𝑥0 = 𝛾𝑥0
𝛾−1
Now, let 𝑚 𝛾 = 𝑓′
𝑥0 = 𝛾𝑥0
𝛾−1
and we have to find the absolute maximum of the
function 𝑚 𝛾 on the interval 0 < 𝛾 < ∞.
To that we have to find the derivative
𝑚′ 𝛾 = 𝑥0
𝛾−1
+ 𝛾 ln 𝑥0 𝑥0
𝛾−1
and set 𝑚′
𝛾 equal to zero.
𝑥0
𝛾−1
+ 𝛾 ln 𝑥0 𝑥0
𝛾−1
= 0
⟹ 𝛾 = −
1
𝑙𝑛(𝑥0)
The candidate for the
Optimal value of the power
35. 1- Try to imitate the approach of this section to automate the
choice of the optimal base for the exponential transform.
2- Try to imitate the approach of this section to automate the
choice of the optimal base for the logarithmic transform.
E x e r c i s e s