<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>gaussian Archives - Creatronix</title>
	<atom:link href="https://creatronix.de/tag/gaussian/feed/" rel="self" type="application/rss+xml" />
	<link>https://creatronix.de/tag/gaussian/</link>
	<description>My adventures in code &#38; business</description>
	<lastBuildDate>Tue, 23 Dec 2025 08:33:29 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>
	<item>
		<title>Intro to OpenCV with Python</title>
		<link>https://creatronix.de/intro-to-opencv-with-python/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Mon, 23 Jul 2018 19:11:18 +0000</pubDate>
				<category><![CDATA[Data Science & SQL]]></category>
		<category><![CDATA[bgr]]></category>
		<category><![CDATA[blur]]></category>
		<category><![CDATA[gaussian]]></category>
		<category><![CDATA[noise]]></category>
		<category><![CDATA[opencv]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[rgb]]></category>
		<category><![CDATA[smoothing]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=1593</guid>

					<description><![CDATA[<p>Installation To work with OpenCV from python, you need to install it first. We additionally install numpy and matplotlib as well pip install opencv-python numpy matplotlib Reading Images from file After we import cv2 we can directly work with images like so: import cv2 img = cv2.imread("doc_brown.png") For showing the image, it is recommended to&#8230;</p>
<p>The post <a href="https://creatronix.de/intro-to-opencv-with-python/">Intro to OpenCV with Python</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2>Installation</h2>
<p>To work with OpenCV from python, you need to install it first. We additionally install numpy and matplotlib as well</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-bash" data-lang="Bash"><code>pip install opencv-python numpy matplotlib</code></pre>
</div>
<h2>Reading Images from file</h2>
<p>After we import cv2 we can directly work with images like so:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>import cv2 
img = cv2.imread("doc_brown.png")</code></pre>
</div>
<p>For showing the image, it is recommended to use matplotlib</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>import matplotlib.pyplot as plt 
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) 
plt.imshow(img) 
plt.show()</code></pre>
</div>
<p>OpenCV stores images internally in the BGR format &#8211; blue &#8211; green &#8211; red so we have to convert to RGB before displaying them.</p>
<h2><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-1748" src="https://creatronix.de/wp-content/uploads/2018/07/doc_brown.png" alt="" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/07/doc_brown.png 640w, https://creatronix.de/wp-content/uploads/2018/07/doc_brown-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></h2>
<h2>Image Shape</h2>
<p>We have now an image object which can already tell us more about the image itself:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>print(img.shape) 
(205, 236, 3)</code></pre>
</div>
<p>The tuple shows us the number of (rows, columns, channels)</p>
<h2>Manipulate brightness</h2>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>import numpy as np 
brightness = np.zeros(img.shape, dtype="uint8") + 30 
img = cv2.add(img, brightness)</code></pre>
</div>
<p>Manipulating brightness works like this: you need a numpy array with the size of the image, add your brightness and add the brightness array to the original image.</p>
<h2><img decoding="async" class="alignnone size-full wp-image-1749" src="https://creatronix.de/wp-content/uploads/2018/07/bright_doc_30.png" alt="" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/07/bright_doc_30.png 640w, https://creatronix.de/wp-content/uploads/2018/07/bright_doc_30-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></h2>
<h2>Adding noise</h2>
<p>Adding noise works the same way, but instead of adding a fixed value to every pixel you add normal distributed values.</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>noise = np.random.randint(0, 100, size=img.shape, dtype="uint8") 
img = cv2.add(img, noise)</code></pre>
</div>
<p><img decoding="async" class="alignnone size-full wp-image-1811" src="https://creatronix.de/wp-content/uploads/2018/07/noisy_doc.png" alt="" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/07/noisy_doc.png 640w, https://creatronix.de/wp-content/uploads/2018/07/noisy_doc-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<h2>Smoothing</h2>
<p>Smoothing is reducing the noise of an image by adding a Gaussian blur:</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>img = cv2.GaussianBlur(img, ksize=(31, 31), sigmaX=5)</code></pre>
</div>
<h2><img decoding="async" class="alignnone size-full wp-image-1812" src="https://creatronix.de/wp-content/uploads/2018/07/smooth_doc.png" alt="" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/07/smooth_doc.png 640w, https://creatronix.de/wp-content/uploads/2018/07/smooth_doc-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></h2>
<h2>Gray-scale conversion</h2>
<p>Last but not least we can convert an image to a gray scale. Beware that for showing / storing the image you need to add the flag cmap=&#8221;gray&#8221;</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) 
plt.imshow(img, cmap='gray')</code></pre>
</div>
<p><img decoding="async" class="alignnone size-full wp-image-1815" src="https://creatronix.de/wp-content/uploads/2018/07/gray_doc.png" alt="" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/07/gray_doc.png 640w, https://creatronix.de/wp-content/uploads/2018/07/gray_doc-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></p>
<p>Have fun fiddling around with OpenCV!</p>
<h2>Github Repo</h2>
<p><a href="https://github.com/jboegeholz/introduction_to_opencv">https://github.com/jboegeholz/introduction_to_opencv</a></p>
<p>The post <a href="https://creatronix.de/intro-to-opencv-with-python/">Intro to OpenCV with Python</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
		<item>
		<title>The Normal Distribution</title>
		<link>https://creatronix.de/the-normal-distribution/</link>
		
		<dc:creator><![CDATA[Jörn]]></dc:creator>
		<pubDate>Wed, 25 Apr 2018 10:47:03 +0000</pubDate>
				<category><![CDATA[Data Science & SQL]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[gauss]]></category>
		<category><![CDATA[gaussian]]></category>
		<category><![CDATA[normal distribution]]></category>
		<guid isPermaLink="false">http://creatronix.de/?p=1240</guid>

					<description><![CDATA[<p>Diving deeper into data science I started to brush up my knowledge about math especially statistics. The Mother of all Distributions The normal distribution was formulated by Carl Friedrich Gauß in 1809 and can be implemented in Python like the following : def normal_distribution_pdf(x, mu=0, sigma=1): sqrt_two_pi = math.sqrt(2*math.pi) return (1 / (sqrt_two_pi * sigma))&#8230;</p>
<p>The post <a href="https://creatronix.de/the-normal-distribution/">The Normal Distribution</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p>Diving deeper into data science I started to brush up my knowledge about math especially statistics.</p>
<h2>The Mother of all Distributions</h2>
<p><img decoding="async" class="alignnone size-full wp-image-1243" src="https://creatronix.de/wp-content/uploads/2017/12/normal_distribution.png" alt="" width="493" height="469" srcset="https://creatronix.de/wp-content/uploads/2017/12/normal_distribution.png 493w, https://creatronix.de/wp-content/uploads/2017/12/normal_distribution-300x285.png 300w" sizes="(max-width: 493px) 100vw, 493px" /></p>
<p>The normal distribution was formulated by Carl Friedrich Gauß in 1809 and can be implemented in Python like the following :</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>def normal_distribution_pdf(x, mu=0, sigma=1): 
    sqrt_two_pi = math.sqrt(2*math.pi) 
    return (1 / (sqrt_two_pi * sigma)) * math.exp(-((x - mu) ** 2) / (2 * sigma ** 2))</code></pre>
</div>
<h3>Scipy</h3>
<p>For professional use you should packages like scipy to generate the pdf of a normal distribution</p>
<div class="hcb_wrap">
<pre class="prism line-numbers lang-python" data-lang="Python"><code>import matplotlib.pyplot as plt
import numpy as np
from scipy.stats import norm

if __name__ == '__main__':
    fig, ax = plt.subplots(1, 1)
    x = np.linspace(norm.ppf(0.01), norm.ppf(0.99), 100)
    ax.plot(x, norm.pdf(x), 'r-', label='norm pdf')
    plt.savefig("pdf.png")
</code></pre>
</div>
<h3><img decoding="async" src="https://creatronix.de/wp-content/uploads/2018/04/pdf.png" alt="" class="alignnone size-full wp-image-5944" width="640" height="480" srcset="https://creatronix.de/wp-content/uploads/2018/04/pdf.png 640w, https://creatronix.de/wp-content/uploads/2018/04/pdf-300x225.png 300w" sizes="(max-width: 640px) 100vw, 640px" /></h3>
<h3>Further reading</h3>
<p><a href="https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html">https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.norm.html</a></p>
<p>The post <a href="https://creatronix.de/the-normal-distribution/">The Normal Distribution</a> appeared first on <a href="https://creatronix.de">Creatronix</a>.</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
