create account

Digital Images | Image Enhancement by event-horizon

View this thread on: hive.blogpeakd.comecency.com
· @event-horizon ·
$15.77
Digital Images | Image Enhancement
<html> 
<div class = "pull-left"> https://steemitimages.com/DQmZF6Uo4aB1iq1ZZypGWSKrrTjVP5dcJC3Xob7QAba2ywf/mario%20title.jpg<br>
<sub><center><a href="https://pixabay.com/en/super-mario-mario-mario-bros-2690254/">Source [ CC0 Creative Commons, Pixabay ]</a></center></sub></div>
<p>I am back with some more interesting information about Digital Images. Hope you find the post useful.</p>
<p>The images we capture through digital cameras or any other digital medium are not always of the best quality. Light plays game with the image, making it too bright or too dark sometimes, resulting in an apparent loss of fine details, making it a bad quality image. It's not always light though, at times image acquisition equipment has limitations too. But the good news is, <strong>we can improve the quality of digital images</strong>. It's just a game of Pixels. ;-)</p>
<div class = "pull-left">https://steemitimages.com/DQmWqZ2YtP3yu2DEAWLDiFzg1kr1C1uqkxs2M1FCi2mBjVr/mario%20pixel.png<br> <center><sub> Pixelated and Gray Scale </sub></center></div>
<p>So as the title suggests, we will talk about Image Enhancement techniques today.&nbsp;</p>
<p>Images are usually improved or enhanced for specific purposes and different images are improved with different techniques. Like, techniques used to enhance the quality of landscape image would be different from the techniques applied at medical image (X-rays image etc).</p>
<p>There are two different approaches of Image Enhancement.</p>
<ol>
  <li>Spatial Domain Transformations</li>
  <li>Frequency Domain Transformations</li>
</ol>
<p>We will first talk about <strong>Spatial Domain Transformations which is direct manipulation of pixels. </strong>As you know an image is just a group of pixels with different gray levels.</p>
<div class = "pull-right"> https://steemitimages.com/DQman7s3Za5N1xbc3trf42gLY646vHzSRfngZ1RZGLAGiyB/WristSpatialFiltering.jpg<br>
<center><sub><a href="https://commons.wikimedia.org/wiki/File:WristSpatialFiltering.jpg">Spatial Filtering</a></sub></center></div>
<p>A specific function is performed on all pixels one by one to get the desired image.</p>
<blockquote><strong>g(x,y) = T[f(x,y)]</strong></blockquote>
<p><em><strong>f(x,y)</strong></em><em> </em>is the image with pixel coordinate values, <em><strong>x</strong></em><em> </em>and <em><strong>y</strong></em><em>.&nbsp;</em></p>
<p><em><strong>T</strong></em><em> </em>is the function performed on each pixel<em>.&nbsp;</em></p>
<p><em><strong>g(x,y)</strong></em><em> </em>is the resultant image.</p>

<p>In <strong>Spatial Domain</strong> there are various techniques of image enhancement. Let's go through each.</p>
<h2>Gray Level Transformations</h2>
<p>There are three types of <em>Gray Level Transformations</em>.</p>
<ol>
  <li>Linear (Negative/Identity) Transformations</li>
  <li>Logarithmic (and Inverse Log) Transformations</li>
  <li>Power Law (nth power and nth root) Transformations</li>
</ol>
<h3>Linear Transformations</h3>
<p>As the name suggests, mapping of each input pixel to the output pixel is called <strong>Identity Transformation</strong>. It is as simple as that.</p>
<p><strong>Negative transformation</strong> is basically the inverse of each pixel.</p>
<div class = "pull-right">https://steemitimages.com/DQmR1CAgNNwM6rYWMpn8AEDf4as6Xw1PBWdqPVYCgy4paRZ/mario%20negative.png<br>
<center><sub>Negative Effect</sub></center></div>
<blockquote><strong>s = (L - 1) - r &nbsp;</strong></blockquote>
<p><strong>s </strong>is output pixel. <strong>L</strong> is the total gray levels and <strong>r</strong> is input pixel.</p>
<p>If <em><strong>L = 256</strong></em> &nbsp;and <em><strong>r = 0</strong></em> (black), then <em><strong>s = (256 - 1) - 0 = 255 </strong></em>(white).</p>
<p>Lighter pixels become dark and darker becomes light.</p>
<p>( Total gray levels are 256 when the image is 8bbp )</p>
<h3>Logarithmic Transformations</h3>
<p>When we need to enhance darker pixels and compress lighter ones, then we use this function.</p>
<div class = "pull-right">https://steemitimages.com/DQmcXmHG4zaPWKNkQcCM7ocS2eiNwaZfRX2Rs5x9e1NR3uy/log.png<br><br>
<sub><center> Log Effect </center></sub></div>
<blockquote><em><strong>s = c log (r + 1)</strong></em></blockquote>
<p><em><strong>s </strong></em>and<em><strong> r </strong></em>are output and input pixels<em><strong>, c </strong></em>is a constant.</p>

<p>Inverse Log gives opposite results.</p>
<h3>Power Law Transformations</h3>
<p>This is used for enhancing images for different display screens.</p>
<blockquote>s = c r<sup> γ</sup></blockquote>
<p>You can spot a gamma symbol here. Value of gamma decides the appearance of image. Different display devices have different gamma values which adjust the image accordingly and that is gamma correction.</p>
<p>I have shown how the image looks like at different values of gamma.</p>

<table>
<tr>
<th> https://steemitimages.com/DQmcHjVNDopzGHPLP1Y1UH9D6PA7wt166FYV6wm2DsrLNx8/gamma%200.7.png 
<center><sub> γ =  0.7 </sub></center>
</th>
<th> https://steemitimages.com/DQmU3FM87r5jdjorcB81AxQcQinY3eoiENQGYn65gUCU6gS/gamma%201.3.png 
<center><sub> γ =  1.3 </sub></center></th>
<th> https://steemitimages.com/DQmZWDDn9yR3fFc5MSBTQ99HpgsgiKBoRnym25aePQkCN2x/gamma%202.png 
<center><sub> γ =  2.0 </sub></center></th>
</tr>
</table>

<p><br></p>
<h2>Histogram &nbsp;Image</h2>
<div class = "pull-right">
<div class = "pull-right">
https://steemitimages.com/DQmRP181heCz7QvStbALBGUr34n5yZh4MQLFHBbtE681ru9/histogram%20example.png<br>
<sub><center><a href="https://eu.wikipedia.org/wiki/Maiztasun-poligono">Source [ CC-BY-SA 3.0, Wikipedia ]</a></center></sub> </div></div>
<p>As you know Histograms are kind of graphs in which at x-axis there are subjects and at y-axis there are frequencies of those subjects.</p>

<p>Histogram of an Image has gray levels range at x-axis and at y-axis it has frequency of occurrence of each gray value/pixel in the image. Like if we have 8bbp image that means x-axis's range is 0-255.</p>
<p>Histogram of an image helps us to understand how the image may look like. For instance,</p>
<ol>
  <li>Image is meant to be bright, if most of the bars have high frequency on right side.</li>
  <li>Images is dark, if most of the bars have high frequency on left side.</li>
  <li>Image has high contrast, if the bars are spread across much varying intensity levels.</li>
  <li>Image has low contrast if the graph is dense at some area and less varying intensity levels.</li>
</ol>
<table>
<tr>
<td> <div class = "pull-left">
https://steemitimages.com/DQmd52WMZU2nLyuWxtjPJJFjtGPN5oX3hWn7qVDP9yagcpL/BRIGHT%20MARIO.png
</div> </td>
<td>Bright Image</td>
<td> https://steemitimages.com/DQmWJBHVBFJ3iWhNhot6aD8guCTrYGxVfEFyE7BtTnhnVou/bright%20graph.png </td>
</tr>
<tr>
<td> <div class = "pull-left">
https://steemitimages.com/DQmZqHnYwAhBZVo9pDFn8FYLpxjEY8UiBwEquNjH8FoE81X/DARK%20MARIO.png
</div></td> 
<td> Dark Image </td>
<td>https://steemitimages.com/DQmcBYHvcydDEiBv9FwmS4XUbscHRaFBaCwHvjzsto7uvzC/dark%20graph.png</td>
</tr>
<tr>
<td><div class = "pull-left">
https://steemitimages.com/DQmbq19dybk49bJvYFNeCDqP5yF6kYhPwsw5Gqvc6TxnmRm/HIGH%20CONTRAST%20MARIO.png</div></td> 
<td> High Contrast Image </td>
<td> https://steemitimages.com/DQme8NqmsHPNqSjyLiEkzb2HAUKskBrFuyRVn7yEtJcU5Ne/high%20c.png</td>
</tr>
<tr>
<td><div class = "pull-left">
https://steemitimages.com/DQmaUYMVdoqetHuUau11KRELLii2t16zAcYY1A9aRBskVUC/LOW%20CONTRAST%20mARIO.png </div></td> 
<td> Low Contrast Image </td>
<td>https://steemitimages.com/DQmZvrgPg8fQMPhicMZHuzCbhaB9FWQouKVZMxbV4HRLyUe/high%20c.jpg </td>
</tr>
</table>
<p><strong>What is Histogram Equalization?</strong></p>
<p>The main idea behind this concept is to get a flat, evenly distributed histogram, using maximum of the intensity range to get the best contrasted image.</p>
<table>
<tr>
<th> <div class = "pull-left">
https://steemitimages.com/DQmdYjAfyqCzggsJeCRbyvLuKWZchoZbi3FczNPyj2jk2kw/equalize.png</div></th>
<th>
https://steemitimages.com/DQmeQcTh2FB1Ke4juW2XRXL2Xcin9GfQRYu9aykC83fVTkd/equalzie%20graph.png </th>
</tr>
</table>
<hr>
<h2>Arithmetic and Logic Operations on Images</h2>
<p>We can achieve something by applying arithmetic and logic operations on images as well. You will see how and why shortly. Two or more images are taken as input and according to the operator and pixel-by-pixel fashion, generate output pixels of the resultant image. Input images are usually in binary form or if they are in integer form, then operations are performed bit-wise.</p>
<ol>
  <li><strong>Adding two or more images can help in noise reduction.</strong> Like if there is a same scene and images are taken at different points in time then those images can be added, ignoring what happened in between the time span (possibly noise in case of any movement).<br>
While doing the actual programming, pixels are represented mostly by integers or bytes which allows us to use limited bits. Like in an 8bbp image, the maximum value of pixel allowed in that range is 255 which is 11111111 in binary (8 bits). So in that case, <strong>overflow</strong> happens.<br>
Either we do <strong>wrapping</strong> or perform<strong> saturation</strong> when this happens.<br>
<em><strong>In wrapping, we subtract the maximum pixel range value from overflown pixel entry, so to start again with the minimum value.</strong></em><em><br>
</em><em><strong>In saturation, all the overflown values are set to the maximum possible value in the allowed range.<br>
</strong></em>Saturation maybe good, if there are less overflown pixel values. But if there are more overflown values and all are set to the same value (for instance 255) then the image will be white/bright in most areas and we may lose important information or detail.<br>
<strong>One solution is to represent pixels as float while programming because float gives us much larger range of numbers.<br>
</strong></li>
  <li><strong>Subtraction of two or more images helps in motion detection or finding contrast.<br>
</strong>To deal with negative numbers in the output pixel we use wrapping here too or we set all negative pixels to zero which means black pixels. Again it may end up in the loss of information. So the proper solution is to manipulate absolute values only.<br>
<br>
<center><sub>Do you know?</sub></center>
<center><sub>Contrast = Maximum pixel intensity of an image - Minimum pixel intensity of an image</sub></center><br>
<br>
</li>
  <li><strong>Multiplication can help in making the image brighter or darker.</strong> If pixels are multiplied with larger number then we get high values i.e move to brighter side. If pixels are multiplied with numbers less than 1 then we get lower values i.e move to darker side.<br>
</li>
  <li><strong>Division</strong> can help in motion detection like Subtraction. Unlike calculating absolute change in subtraction, <strong>we get fractional change through division.<br>
</strong></li>
  <li><strong>AND-ing is intersection of images. </strong>It helps us find the objects in images which didn't move ( have same pixel values).<br>
</li>
  <li><strong>OR-ing is union of images. </strong>It helps to find all the objects that have represented that image in some point of time.<br>
</li>
  <li>XOR-ing helps in change detection as well. If you see the truth table of XOR , it is like this:<br>
0 <strong>xor</strong> 0 = 0<br>
0 <strong>xor</strong> 1 = 1<br>
1 <strong>xor</strong> 0 = 1<br>
1 <strong>xor</strong> 1 = 0<br>
It suggests that zero in resultant pixels means there is no change and 1 means there had been a change.</li>
</ol>
<h2>Concepts of Mask, Convolution and Filtering</h2>
<p>Masking, Filtering and Convolution are all from the same boat.</p>
<p>Mask is applied to each point/pixel of an image and resultant image depends on the mask, &nbsp;it has been applied with. The process is called Convolution.</p>
<p>Like an image, Mask/Filter is a matrix with odd number of entries (Odd because we need to find middle entry for convolution process).</p>
<p><strong>How convolution is done?</strong></p>
<p>It is best described in this <a href = "https://www.tutorialspoint.com/dip/concept_of_convolution.htm">  link </a>. The explanation couldn't be more simpler than that.</p>
<p><strong>Purpose of Masking or Filtering</strong></p>
<ol>
  <li>Blurring Effect</li>
  <li>Edge Detection</li>
  <li>Noise Reduction</li>
  <li>Sharpness</li>
</ol>
<div class = "pull-right">
<div class = "pull-right">
https://steemitimages.com/DQmYmyf1gATwUjh9djUYD4L3Piv3s2fkRGo3HhgvoPyQeSy/blur.png<br> 
<center><sub>Blur Effect</sub></center></div></div>
<p><strong>Blurring</strong> effect is sometimes applied to suppress the insignificant details so that significant ones can out stand.</p>
<p>Blurring is different from zooming because if you remember from my previous post, zooming increases the number of pixels and blurring doesn't.</p>
<div class = "pull-right">
<div class = "pull-right">
https://steemitimages.com/DQmcVnCZjwL8FXy5TXgm7Z3DD98QQ18wCMY4B7h1f7sk7kj/edge%20detection.png<br>
<center><sub> Edge Detection </sub></center>
</div></div>
<p><strong>Edge Detection</strong> is applied so that objects can be told apart in an image only when they have clear or sharp boundaries or edges. </p>
<hr>
These were the basic concepts related to Spatial Domain in Image Enhancement. We will move to Frequency Domain in next post soon.
<hr>

<h3>Book Reference</h3>
<p>Gonzalez C.R, Woods E.R, <em>Digital Image Processing</em>, 2nd Ed, 2000. Prentice</p>
<h3>Internet References</h3>
<ol>
  <li>https://sisu.ut.ee/imageprocessing/</li>
  <li>https://www.tutorialspoint.com/dip/concept_of_convolution.htm</li>
</ol>
<h3>Image Tools</h3>
<p>Non-credited images are edited with the help of this tool.</p>
<p>http://pinetools.com/c-images/</p>

Note: I have used black and white images on purpose. Color Image Processing will be discussed later.
<hr>
<h1><br>
<br>
<center> Thank you for your Patience </center></h1>
<hr>
<p><br></p>
<p><br></p>
<p><br></p>
<p>&nbsp;</p>
<p><br></p>
</html>
👍  , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , and 44 others
properties (23)
authorevent-horizon
permlinkdigital-images-or-image-enhancement
categorysteemstem
json_metadata{"tags":["steemstem","digital","science","technology"],"image":["https://steemitimages.com/DQmZF6Uo4aB1iq1ZZypGWSKrrTjVP5dcJC3Xob7QAba2ywf/mario%20title.jpg","https://steemitimages.com/DQmWqZ2YtP3yu2DEAWLDiFzg1kr1C1uqkxs2M1FCi2mBjVr/mario%20pixel.png","https://steemitimages.com/DQman7s3Za5N1xbc3trf42gLY646vHzSRfngZ1RZGLAGiyB/WristSpatialFiltering.jpg","https://steemitimages.com/DQmR1CAgNNwM6rYWMpn8AEDf4as6Xw1PBWdqPVYCgy4paRZ/mario%20negative.png","https://steemitimages.com/DQmcXmHG4zaPWKNkQcCM7ocS2eiNwaZfRX2Rs5x9e1NR3uy/log.png","https://steemitimages.com/DQmcHjVNDopzGHPLP1Y1UH9D6PA7wt166FYV6wm2DsrLNx8/gamma%200.7.png","https://steemitimages.com/DQmU3FM87r5jdjorcB81AxQcQinY3eoiENQGYn65gUCU6gS/gamma%201.3.png","https://steemitimages.com/DQmZWDDn9yR3fFc5MSBTQ99HpgsgiKBoRnym25aePQkCN2x/gamma%202.png","https://steemitimages.com/DQmRP181heCz7QvStbALBGUr34n5yZh4MQLFHBbtE681ru9/histogram%20example.png","https://steemitimages.com/DQmd52WMZU2nLyuWxtjPJJFjtGPN5oX3hWn7qVDP9yagcpL/BRIGHT%20MARIO.png","https://steemitimages.com/DQmWJBHVBFJ3iWhNhot6aD8guCTrYGxVfEFyE7BtTnhnVou/bright%20graph.png","https://steemitimages.com/DQmZqHnYwAhBZVo9pDFn8FYLpxjEY8UiBwEquNjH8FoE81X/DARK%20MARIO.png","https://steemitimages.com/DQmcBYHvcydDEiBv9FwmS4XUbscHRaFBaCwHvjzsto7uvzC/dark%20graph.png","https://steemitimages.com/DQmbq19dybk49bJvYFNeCDqP5yF6kYhPwsw5Gqvc6TxnmRm/HIGH%20CONTRAST%20MARIO.png","https://steemitimages.com/DQme8NqmsHPNqSjyLiEkzb2HAUKskBrFuyRVn7yEtJcU5Ne/high%20c.png","https://steemitimages.com/DQmaUYMVdoqetHuUau11KRELLii2t16zAcYY1A9aRBskVUC/LOW%20CONTRAST%20mARIO.png","https://steemitimages.com/DQmZvrgPg8fQMPhicMZHuzCbhaB9FWQouKVZMxbV4HRLyUe/high%20c.jpg","https://steemitimages.com/DQmdYjAfyqCzggsJeCRbyvLuKWZchoZbi3FczNPyj2jk2kw/equalize.png","https://steemitimages.com/DQmeQcTh2FB1Ke4juW2XRXL2Xcin9GfQRYu9aykC83fVTkd/equalzie%20graph.png","https://steemitimages.com/DQmYmyf1gATwUjh9djUYD4L3Piv3s2fkRGo3HhgvoPyQeSy/blur.png","https://steemitimages.com/DQmcVnCZjwL8FXy5TXgm7Z3DD98QQ18wCMY4B7h1f7sk7kj/edge%20detection.png"],"links":["https://pixabay.com/en/super-mario-mario-mario-bros-2690254/","https://commons.wikimedia.org/wiki/File:WristSpatialFiltering.jpg","https://eu.wikipedia.org/wiki/Maiztasun-poligono","https://www.tutorialspoint.com/dip/concept_of_convolution.htm","https://sisu.ut.ee/imageprocessing/","http://pinetools.com/c-images/"],"app":"steemit/0.1","format":"html"}
created2018-05-01 21:22:48
last_update2018-05-01 21:22:48
depth0
children2
last_payout2018-05-08 21:22:48
cashout_time1969-12-31 23:59:59
total_payout_value12.036 HBD
curator_payout_value3.737 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length14,034
author_reputation5,759,852,439,635
root_title"Digital Images | Image Enhancement"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,313,658
net_rshares2,754,597,481,437
author_curate_reward""
vote details (108)
@james1122 ·
 Awesome post!! Keep it up and check out [THIS POST](https://steemit.com/life/@cryptopaparazzi/chapter-one-let-there-be-the-man-and-there-was-a-man-let-there-be-a-woman-and-there-was-sex) as well as I have something similar. 
properties (22)
authorjames1122
permlinkre-digital-images-or-image-enhancement-20180502t220925
categorysteemstem
json_metadata""
created2018-05-02 22:09:24
last_update2018-05-02 22:09:24
depth1
children0
last_payout2018-05-09 22:09:24
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length225
author_reputation-1,569,261,196,247
root_title"Digital Images | Image Enhancement"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,522,481
net_rshares0
@steembottrackerr ·
<center>https://steemitimages.com/200x200/https://s-media-cache-ak0.pinimg.com/originals/81/28/3c/81283c6aed7bdb5b9f8ad73b8ce62c2f.jpg</center>
---
<center>Hello @event-horizon , Congratulations ✅ . Your content began to appear in the hot section.
I am the information account of "SteemBotTracker" site.
</center>
---
<center>
Your Informations
Total SBD: 24.814
Total STEEM: 0.003
</center>
---
<center>
I recommend to increase this;
You can make "Resteem" and advertise to the followers of the whale accounts.
"Resteem Bot" for you;
✅ The most profitable Resteem Whale @byresteem  has 25.500 Followers + 7000 Sp + Upvote with min +55 accounts. 
</center>
---
<center>
You can purchase "upvote" by bid bots.
"Upvote Bot"
✅ The most profitable whale in the last round. @upme
</center>
---
<center>
I'm taking this message once. You need to use the #steembottrackerr tag for more information.
Those who "upvote" this interpretation will be awarded a "UpVote" prize of 100 Sbd per week per person.
I am a bot, I can not answer the comment. I hope I could help. Good luck. Sorry if I disturbed you.
</center>
properties (22)
authorsteembottrackerr
permlink20180510t174500916z
categorysteemstem
json_metadata{"tags":["advice"],"app":"steemjs/test"}
created2018-05-10 17:45:15
last_update2018-05-10 17:45:15
depth1
children0
last_payout2018-05-17 17:45:15
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,134
author_reputation-1,493,369,324,060
root_title"Digital Images | Image Enhancement"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,996,710
net_rshares0