<?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/"
	
	xmlns:georss="http://www.georss.org/georss"
	xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#"
	>

<channel>
	<title>OpenCV Project Archives - Indian AI Production</title>
	<atom:link href="https://indianaiproduction.com/opencv-project/feed/" rel="self" type="application/rss+xml" />
	<link>https://indianaiproduction.com/opencv-project/</link>
	<description>Artificial Intelligence Education Free for Everyone</description>
	<lastBuildDate>Thu, 30 Sep 2021 03:58:45 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	

<image>
	<url>https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2019/06/Channel-logo-in-circle-473-x-472-px.png?fit=32%2C32&#038;ssl=1</url>
	<title>OpenCV Project Archives - Indian AI Production</title>
	<link>https://indianaiproduction.com/opencv-project/</link>
	<width>32</width>
	<height>32</height>
</image> 
<site xmlns="com-wordpress:feed-additions:1">163118462</site>	<item>
		<title>How to Change Image File Extension</title>
		<link>https://indianaiproduction.com/change-image-extension-opencv-python/</link>
					<comments>https://indianaiproduction.com/change-image-extension-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Thu, 30 Sep 2021 03:58:42 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1836</guid>

					<description><![CDATA[<p>In Python OpenCV Tutorial, we are going to change the image file extension from one form to another using  cv2.imwrite() function. Like JPG to PNG or PNG to JPG. Change Image File Format Supported Image file format by OpenCV Opencv Support Below Image file format to read &#38; write(Save): Windows bitmaps &#8211; *.bmp, *.dib (always &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/change-image-extension-opencv-python/"> <span class="screen-reader-text">How to Change Image File Extension</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/change-image-extension-opencv-python/">How to Change Image File Extension</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In Python OpenCV Tutorial, we are going to change the image file extension from one form to another using  cv2.imwrite() function. Like JPG to PNG or PNG to JPG.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img fetchpriority="high" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention-1024x576.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1837" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/09/change-image-file-extention.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Change Image File Format</h2>



<h3 class="wp-block-heading">Supported Image file format by OpenCV</h3>



<p><strong>Opencv Support Below Image file format to read &amp; write(Save)</strong>:</p>



<p>Windows bitmaps &#8211; *.bmp, *.dib (always supported)<br>JPEG files &#8211; *.jpeg, *.jpg, *.jpe (see the Notes section)<br>JPEG 2000 files &#8211; *.jp2 (see the Notes section)<br>Portable Network Graphics &#8211; *.png (see the Notes section)<br>Portable image format &#8211; *.pbm, *.pgm, *.ppm (always supported)<br>Sun rasters &#8211; *.sr, *.ras (always supported)<br>TIFF files &#8211; *.tiff, *.tif (see the Notes section)</p>



<h4 class="wp-block-heading">Read Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Import Libraries
import cv2

## Read Image
#img_path = r&quot;data/pexels-bess-hamiti-35188.jpg&quot;
img_path = r&quot;data/girl_face.png&quot;
img = cv2.imread(img_path)
#img = cv2.resize(img, (1280,720))

cv2.imshow(&quot;Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Change Image extension JPG to PNG</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_output_path = r&quot;data/output/girl_boy.png&quot;
responce = cv2.imwrite(img_output_path, img)

if responce:
    print(&quot;image stored at location: &quot;,img_output_path)
</pre></div>


<h4 class="wp-block-heading">Change Image extension PNG to JPG</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_output_path = r&quot;data/output/girl_model.jpg&quot;
responce = cv2.imwrite(img_output_path, img)

if responce:
    print(&quot;image stored at location: &quot;,img_output_path)
</pre></div>


<h4 class="wp-block-heading">Change Image Extension from any format to another Format</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_output_path = r&quot;data/output/girl_model_tiff.tiff&quot;
responce = cv2.imwrite(img_output_path, img)

if responce:
    print(&quot;image stored at location: &quot;,img_output_path)
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/change-image-extension-opencv-python/">How to Change Image File Extension</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/change-image-extension-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1836</post-id>	</item>
		<item>
		<title>Change the Pixel Value of an Image in OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/change-image-pixels-opencv-python/</link>
					<comments>https://indianaiproduction.com/change-image-pixels-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Sat, 14 Aug 2021 05:32:21 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1831</guid>

					<description><![CDATA[<p>In Python OpenCV Tutorial, Explained How to Change Pixels Color in an image using NumPy Slicing and indexing. Get the answers of below questions: What is pixel? What is resolution? How to read image pixel? How to get image pixel? How to print image pixel? How to change the pixel value of an image in python &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/change-image-pixels-opencv-python/"> <span class="screen-reader-text">Change the Pixel Value of an Image in OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/change-image-pixels-opencv-python/">Change the Pixel Value of an Image in OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In <strong>Python OpenCV Tutorial</strong>, Explained How to <strong>Change Pixels Color in an image</strong> using NumPy Slicing and indexing.</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>What is pixel?</li><li>What is resolution?</li><li>How to read image pixel?</li><li>How to get image pixel?</li><li>How to print image pixel?</li><li>How to change the pixel value of an image in python opencv?</li><li>How do I pixelate an image in OpenCV?</li><li>How do I change the pixel value of an image in OpenCV Python?</li></ol>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1832" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/22_2-add-new-color-pixels-in-a-image.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Add colour pixels in Image</h2>



<h4 class="wp-block-heading">Impor Libraries</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
&quot;&quot;&quot;
Video Tutorial Link:
Change the Pixel Value of an Image in OpenCV Python | | OpenCV Tutorial in Hindi | Computer Vision: https://youtu.be/8gI3NSfCpKw
&quot;&quot;&quot;
import cv2
import numpy as np
import time
import random
</pre></div>


<h4 class="wp-block-heading">Read and Show Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_path = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\pexels-bess-hamiti-35188.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))
cv2.imshow(&quot;Image&quot;, img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Add New single color pixel in a Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;0]&#x5B;0] ## Read pixel
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Add white pixels
img_copy = img.copy()
img_copy&#x5B;0]&#x5B;0] = np.array(&#x5B;255,255,255])

cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Add white, black, Red, Green, Blue pixels
img_copy = img.copy()
img_copy&#x5B;0]&#x5B;0] = np.array(&#x5B;255,255,255]) # White pixel
img_copy&#x5B;0]&#x5B;1] = np.array(&#x5B;0,0,0]) #  Black pixel
img_copy&#x5B;0]&#x5B;2] = np.array(&#x5B;0,0,255]) # Red pixel
img_copy&#x5B;0]&#x5B;3] = np.array(&#x5B;0,255,0]) # Green Pixel
img_copy&#x5B;0]&#x5B;4] = np.array(&#x5B;255,0,0]) # Blue pixel

cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Add New color pixel in a row of Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for cols_index in range(img_width):
    img_copy&#x5B;0]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # White pixel
    img_copy&#x5B;1]&#x5B;cols_index] = np.array(&#x5B;0,0,0]) #  Black pixel
    img_copy&#x5B;2]&#x5B;cols_index] = np.array(&#x5B;0,0,255]) # Red pixel
    img_copy&#x5B;3]&#x5B;cols_index] = np.array(&#x5B;0,255,0]) # Green Pixel
    img_copy&#x5B;4]&#x5B;cols_index] = np.array(&#x5B;255,0,0]) # Blue pixel
    
cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Add New color pixel in a row of Image with logic/alternatively</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for cols_index in range(img_width):
    if cols_index%2 == 0:
        img_copy&#x5B;0]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # White pixel
        img_copy&#x5B;1]&#x5B;cols_index] = np.array(&#x5B;0,0,0]) #  Black pixel
        img_copy&#x5B;2]&#x5B;cols_index] = np.array(&#x5B;0,0,255]) # Red pixel
        img_copy&#x5B;3]&#x5B;cols_index] = np.array(&#x5B;0,255,0]) # Green Pixel
        img_copy&#x5B;4]&#x5B;cols_index] = np.array(&#x5B;255,0,0]) # Blue pixel
    
cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Add New color pixel in a Image with logic/alternatively</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for rows_index in range(img_height):
    for cols_index in range(img_width):
        #if cols_index%2 == 0:
        if cols_index%50 == 0:
            #img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # White pixel
            img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;0,0,255]) # Red pixel

cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for rows_index in range(img_height):
    if rows_index%2 == 0:
    #if rows_index%20 == 0:
        for cols_index in range(img_width):
            if cols_index%2 == 0:
            #if cols_index%50 == 0:
                img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # White pixel
                #img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;0,0,255]) # Red pixel

cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Add New random color pixel randomly in a Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for rows_index in range(img_height):
    if rows_index%2 == 0:
    #if rows_index%20 == 0:
        for cols_index in range(random.randint(0,1000)):
            #if cols_index%2 == 0:
            #if cols_index%50 == 0:
                b_pixel = random.randint(0,255)
                g_pixel = random.randint(0,255)
                r_pixel = random.randint(0,255)
                rand_cols_index = random.randint(0,img_width-1)
                img_copy&#x5B;rows_index]&#x5B;rand_cols_index] = np.array(&#x5B;b_pixel,g_pixel,r_pixel]) # random pixel
                #img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # white pixel

cv2.imshow(&quot;Image&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
random.randint(0,255)
</pre></div>


<h4 class="wp-block-heading">Add New color pixels in portion or any location of Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = img.copy()

img_width= img_copy.shape&#x5B;1]
img_height= img_copy.shape&#x5B;0]

print(&quot;img_width: &quot;, img_width)
print(&quot;img_height: &quot;, img_height)

for rows_index in range(55, 700):
    if rows_index%2 == 0:
    #if rows_index%20 == 0:
        for cols_index in range(380, 950):
            if cols_index%2 == 0:
            #if cols_index%50 == 0:
                b_pixel = random.randint(0,255)
                g_pixel = random.randint(0,255)
                r_pixel = random.randint(0,255)
                #rand_cols_index = random.randint(0,img_width-1)
                #img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;b_pixel,g_pixel,r_pixel]) # random pixel
                #img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;255,255,255]) # white pixel
                img_copy&#x5B;rows_index]&#x5B;cols_index] = np.array(&#x5B;255,0,0]) # blue pixel
cv2.imshow(&quot;Image&quot;, img_copy)
cv2.imwrite(&quot;effect_img.png&quot;, img_copy)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/change-image-pixels-opencv-python/">Change the Pixel Value of an Image in OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/change-image-pixels-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1831</post-id>	</item>
		<item>
		<title>Get Image Pixels Using OpenCV Python &#124; OpenCV Tutorial in Hindi</title>
		<link>https://indianaiproduction.com/get-image-opencv-python/</link>
					<comments>https://indianaiproduction.com/get-image-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Sun, 08 Aug 2021 08:16:09 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1818</guid>

					<description><![CDATA[<p>In Python OpenCV Tutorial, Explained How to get image pixel using NumPy Slicing and indexing. How to access image pixels Below code executed on Jupyter Notebook Access Single Pixel of Image Show single pixel of Image as Image Access the row of Image Access the row of single &#38; double channel Image Access the column of &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/get-image-opencv-python/"> <span class="screen-reader-text">Get Image Pixels Using OpenCV Python &#124; OpenCV Tutorial in Hindi</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/get-image-opencv-python/">Get Image Pixels Using OpenCV Python | OpenCV Tutorial in Hindi</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In <strong>Python OpenCV Tutorial</strong>, Explained How to get image pixel using NumPy Slicing and indexing.</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1819" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-pixels-access-modification.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">How to access image pixels</h2>



<blockquote class="wp-block-quote"><p>Below code executed on Jupyter Notebook</p></blockquote>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Import Library

import cv2
import numpy as np

# Read &amp; Show Image
img_path = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\pexels-rafi-ahmed-haven-1253364.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img,(int(img.shape&#x5B;1]*0.5), int(img.shape&#x5B;0]*0.5)))
cv2.imshow(&quot;image&quot;, img)
cv2.waitKey(0)
cv2.destroyAllWindows()

img

img.shape

959*640

img.size
</pre></div>


<h2 class="wp-block-heading">Access Single Pixel of Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# # Access Single Pixel of Image

img&#x5B;0,0]

img&#x5B;0,0, 0]

img&#x5B;0,0, 1]

img&#x5B;0,0, 2]

img&#x5B;0]&#x5B;0]

img&#x5B;200,100]

img&#x5B;900, 150]

img&#x5B;180, 550]

</pre></div>


<h2 class="wp-block-heading">Show single pixel of Image as Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# # Show single pixel of Image as Image
cv2.imshow(&quot;image&quot;, img&#x5B;900, 150])
cv2.waitKey(0)
cv2.destroyAllWindows()

</pre></div>


<h2 class="wp-block-heading">Access the row of Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;0]

img&#x5B;0].shape

img&#x5B;0, :]

img&#x5B;700, :]
</pre></div>


<h2 class="wp-block-heading">Access the row of single &amp; double channel Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;700, :, 2]

img&#x5B;700, :, (0,1)]

img&#x5B;700, :, (2,1,0)]

cv2.imshow(&quot;image&quot;, img&#x5B;:, :, (1,0,2)])
cv2.waitKey(0)
cv2.destroyAllWindows()

</pre></div>


<h2 class="wp-block-heading">Access the column of Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;:, 0]

img&#x5B;:, 200]

</pre></div>


<h2 class="wp-block-heading">Access the column of single &amp; double channel Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;:, 200, 2]

img&#x5B;:, 200, (1,2)]

img&#x5B;:, 200, (1,2)].shape

</pre></div>


<h2 class="wp-block-heading">Access the part of Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img&#x5B;80:400, 100:450] # &#x5B;y1:y2, x1:x2] #, x1= 100, y1=80, x2= 450   y2= 400

cv2.imshow(&quot;image&quot;, img&#x5B;80:400, 100:450])
cv2.waitKey(0)
cv2.destroyAllWindows()

x1 = 150, y1 = 850, x2 = 550, y2 = 900

cv2.imshow(&quot;image&quot;, img&#x5B;750:900, 220:400])
cv2.imwrite(&quot;img_part.jpg&quot;, img&#x5B;750:900, 220:400])
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Show image Row wise</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
for i in range(img.shape&#x5B;0]):
    cv2.imshow(&quot;image&quot;, img&#x5B;0:i+1, :])

    if cv2.waitKey(27) &amp; 0xff == ord('q'):
        break
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Show image Column wise</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
for i in range(img.shape&#x5B;1]):
    cv2.imshow(&quot;image&quot;, img&#x5B;:, 0:i+1])

    if cv2.waitKey(27) &amp; 0xff == ord('q'):
        break
cv2.destroyAllWindows()

</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/get-image-opencv-python/">Get Image Pixels Using OpenCV Python | OpenCV Tutorial in Hindi</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/get-image-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1818</post-id>	</item>
		<item>
		<title>How to Dilate(Dilation) Image using OpenCV Python</title>
		<link>https://indianaiproduction.com/image-dilation-opencv-python/</link>
					<comments>https://indianaiproduction.com/image-dilation-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Sun, 01 Aug 2021 06:23:56 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1812</guid>

					<description><![CDATA[<p>Morphological Operations Morphological transformations are some simple operations based on the image shape. It is normally performed on binary images. It needs two inputs, one is our original image, the second one is called structuring element or kernel which decides the nature of the operation. Two basic morphological operators are Erosion and Dilation. Then its variant &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/image-dilation-opencv-python/"> <span class="screen-reader-text">How to Dilate(Dilation) Image using OpenCV Python</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/image-dilation-opencv-python/">How to Dilate(Dilation) Image using OpenCV Python</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Morphological Operations</h2>



<p>Morphological transformations are some simple operations based on the image shape. It is normally performed on <strong>binary images</strong>.</p>



<p>It needs two inputs, one is our original image, the second one is called structuring element or kernel which decides the nature of the operation.</p>



<p>Two basic morphological operators are Erosion and Dilation. Then its variant forms like Opening, Closing, Gradient etc also comes into play. We will see them one-by-one with help of the following image:</p>



<h2 class="wp-block-heading">Dilation</h2>



<p>It is just the opposite of erosion. Here, a pixel element is &#8216;1&#8217; if at least one pixel under the kernel is &#8216;1&#8217;. So it increases the white region in the image or the size of the foreground object increases. Normally, in cases like noise removal, erosion is followed by dilation. Because, erosion removes white noises, but it also shrinks our objects. So we dilate it. Since noise is gone, they won&#8217;t come back, but our object area increases. It is also useful in joining broken parts of an object.</p>



<p><strong>Erosion Tutorial:</strong> <a href="https://indianaiproduction.com/image-erosion-opencv-python/">https://indianaiproduction.com/image-erosion-opencv-python/</a></p>



<p><strong>Syntax: cv2.dilate(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]])</strong><br><strong>Return: Dilate Image</strong></p>



<p><strong>Parameters:</strong></p>



<p>. @param src input image; the number of channels can be arbitrary, but the depth should be one of<br>. CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.<br>. @param dst output image of the same size and type as src.<br>. @param kernel structuring element used for dilation; if elemenat=Mat(), a 3 x 3 rectangular<br>. structuring element is used. Kernel can be created using #getStructuringElement<br>. @param anchor position of the anchor within the element; default value (-1, -1) means that the<br>. anchor is at the element center.<br>. @param iterations number of times dilation is applied.<br>. @param borderType pixel extrapolation method, see #BorderTypes<br>. @param borderValue border value in case of a constant border<br>. @sa erode, morphologyEx, getStructuringElement</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1813" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-dilation.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Dilation of Image Practical using OpenCV</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Import Libraries

import cv2
import numpy as np
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Read Image

img_path_road = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road1.jpg&quot;
img_path_girl_eye = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\girl-eye.jpg&quot;
img_path_iaip = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\indian ai production name.png&quot;

img_road = cv2.imread(img_path_road, 0)
img_iaip = cv2.imread(img_path_iaip, 0)
img_girl_eye = cv2.imread(img_path_girl_eye, 0)

img_road = cv2.resize(img_road, (600, 400))
img_girl_eye = cv2.resize(img_girl_eye, (600,400))

cv2.imshow(&quot;Image road&quot;, img_road)
cv2.imshow(&quot;Image iaip&quot;, img_iaip)
cv2.imshow(&quot;Image GIrl Eye&quot;, img_girl_eye)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Create Kernel

kernel = np.ones((5,5), dtype = &quot;uint8&quot;)
kernel
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Dilate girl Eye Image 

dilated_img = cv2.dilate(img_girl_eye, kernel, iterations=1)

img_girl_eye_dilated_img = np.hstack((img_girl_eye, dilated_img))

cv2.imshow(&quot;Image&quot;, img_girl_eye_dilated_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Dilate Road Image

dilated_img = cv2.dilate(img_road, kernel, iterations=2)

img_girl_eye_dilated_img = np.hstack((img_road, dilated_img))

cv2.imshow(&quot;Image&quot;, img_girl_eye_dilated_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Dilate text Image

dilated_img = cv2.dilate(img_iaip, kernel, iterations=1)

img_girl_eye_dilated_img = np.vstack((img_iaip, dilated_img))

cv2.imshow(&quot;Image&quot;, img_girl_eye_dilated_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<p>REF: https://docs.opencv.org/master/d9/d61/tutorial_py_morphological_ops.html</p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/image-dilation-opencv-python/">How to Dilate(Dilation) Image using OpenCV Python</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/image-dilation-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1812</post-id>	</item>
		<item>
		<title>How to Erode(Erosion) Image using OpenCV Python</title>
		<link>https://indianaiproduction.com/image-erosion-opencv-python/</link>
					<comments>https://indianaiproduction.com/image-erosion-opencv-python/#comments</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Sun, 01 Aug 2021 06:23:33 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1814</guid>

					<description><![CDATA[<p>Morphological Operations Morphological transformations are some simple operations based on the image shape. It is normally performed on&#160;binary images. It needs two inputs, one is our original image, the second one is called structuring element or kernel which decides the nature of the operation. Two basic morphological operators are Erosion and Dilation. Then its variant &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/image-erosion-opencv-python/"> <span class="screen-reader-text">How to Erode(Erosion) Image using OpenCV Python</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/image-erosion-opencv-python/">How to Erode(Erosion) Image using OpenCV Python</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">Morphological Operations</h2>



<p>Morphological transformations are some simple operations based on the image shape. It is normally performed on&nbsp;<strong>binary images</strong>.</p>



<p>It needs two inputs, one is our original image, the second one is called structuring element or kernel which decides the nature of the operation.</p>



<p>Two basic morphological operators are Erosion and Dilation. Then its variant forms like Opening, Closing, Gradient etc also comes into play. We will see them one-by-one with help of the following image:</p>



<h2 class="wp-block-heading">Erosion</h2>



<p>The basic idea of erosion is just like soil erosion only, it erodes away the boundaries of the foreground object (Always try to keep foreground in white). So what it does? The kernel slides through the image (as in 2D convolution). A pixel in the original image (either 1 or 0) will be considered 1 only if all the pixels under the kernel are 1, otherwise, it is eroded (made to zero).</p>



<p>So what happens is that all the pixels near the boundary will be discarded depending upon the size of the kernel. So the thickness or size of the foreground object decreases or simply the white region decreases in the image. It is useful for removing small white noises (as we have seen in the colorspace chapter), detach two connected objects, etc.</p>



<p><strong>Dilation Tutorial:</strong> <a href="https://indianaiproduction.com/image-erosion-opencv-python/">https://indianaiproduction.com/image-dilation-opencv-python/</a></p>



<p><strong>Syntax: cv2.erode(src, kernel[, dst[, anchor[, iterations[, borderType[, borderValue]]]]])<br>Return: Erode Image</strong></p>



<p><strong>Parameters: </strong></p>



<pre class="wp-block-preformatted">.   @param src input image; the number of channels can be arbitrary, but the depth should be one of
.   CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
.   @param dst output image of the same size and type as src.
.   @param kernel structuring element used for erosion; if `element=Mat()`, a `3 x 3` rectangular
.   structuring element is used. Kernel can be created using #getStructuringElement.
.   @param anchor position of the anchor within the element; default value (-1, -1) means that the
.   anchor is at the element center.
.   @param iterations number of times erosion is applied.
.   @param borderType pixel extrapolation method, see #BorderTypes
.   @param borderValue border value in case of a constant border
.   @sa  dilate, morphologyEx, getStructuringElement</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion-1024x576.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1815" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/08/image-erosion.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Erosion of Image Practical using OpenCV</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Import Libraries

import cv2
import numpy as np
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Read Image

img_path_road = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road1.jpg&quot;
img_path_girl_eye = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\girl-eye.jpg&quot;
img_path_iaip = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\indian ai production name.png&quot;

img_road = cv2.imread(img_path_road, 0)
img_iaip = cv2.imread(img_path_iaip, 0)
img_girl_eye = cv2.imread(img_path_girl_eye, 0)

img_road = cv2.resize(img_road, (600, 400))
img_girl_eye = cv2.resize(img_girl_eye, (600,400))

cv2.imshow(&quot;Image road&quot;, img_road)
cv2.imshow(&quot;Image iaip&quot;, img_iaip)
cv2.imshow(&quot;Image GIrl Eye&quot;, img_girl_eye)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Create Kernel

kernel = np.ones((5,5), dtype = &quot;uint8&quot;)
kernel

</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Erode girl eye image

erode_img = cv2.erode(img_girl_eye, kernel, iterations=1)

org_img_erode_img = np.hstack((img_girl_eye, erode_img))

cv2.imshow(&quot;Image&quot;, org_img_erode_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Erode road image

erode_img = cv2.erode(img_road, kernel, iterations=1)

org_img_erode_img = np.hstack((img_road, erode_img))

cv2.imshow(&quot;Image&quot;, org_img_erode_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Erode text image

erode_img = cv2.erode(img_iaip, kernel, iterations=2)

org_img_erode_img = np.vstack((img_iaip, erode_img))

cv2.imshow(&quot;Image&quot;, org_img_erode_img)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<p>REF: https://docs.opencv.org/master/d9/d61/tutorial_py_morphological_ops.html</p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/image-erosion-opencv-python/">How to Erode(Erosion) Image using OpenCV Python</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/image-erosion-opencv-python/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1814</post-id>	</item>
		<item>
		<title>Blur Image using Gaussian Filter OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/</link>
					<comments>https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Wed, 12 May 2021 04:21:06 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1767</guid>

					<description><![CDATA[<p>In&#160;Python OpenCV Tutorial, Explained How to Blur image using cv2.GaussianBlur() opencv function. Get the answers of below questions: How do I blur an image in OpenCV? How do you blur an image in Python? Why do we blur image? How do you blur part of a picture? Syntax: cv2.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]]) -> &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/"> <span class="screen-reader-text">Blur Image using Gaussian Filter OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/">Blur Image using Gaussian Filter OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<strong>Python OpenCV Tutorial</strong>, Explained How to Blur image using cv2.GaussianBlur() opencv function.</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>How do I blur an image in OpenCV?</li><li>How do you blur an image in Python?</li><li>Why do we blur image?</li><li>How do you blur part of a picture?</li></ol>



<p><strong>Syntax:</strong></p>



<p><strong>cv2.GaussianBlur(src, ksize, sigmaX[, dst[, sigmaY[, borderType]]]) -> dst</strong></p>



<pre class="wp-block-preformatted">.   @brief Blurs an image using a Gaussian filter.
 .   
 .   The function convolves the source image with the specified Gaussian kernel. In-place filtering is
 .   supported.

.   @param src input image; the image can have any number of channels, which are processed
.   independently, but the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F.
.   @param dst output image of the same size and type as src.
.   @param ksize Gaussian kernel size. ksize.width and ksize.height can differ but they both must be
.   positive and odd. Or, they can be zero's and then they are computed from sigma.
.   @param sigmaX Gaussian kernel standard deviation in X direction.
.   @param sigmaY Gaussian kernel standard deviation in Y direction; if sigmaY is zero, it is set to be
.   equal to sigmaX, if both sigmas are zeros, they are computed from ksize.width and ksize.height,
.   respectively (see #getGaussianKernel for details); to fully control the result regardless of
.   possible future modifications of all this semantics, it is recommended to specify all of ksize,
.   sigmaX, and sigmaY.
.   @param borderType pixel extrapolation method, see #BorderTypes</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1769" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-gaussian-filter-opencv-python.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Show Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Show Image
################## Video Tutorial: https://youtu.be/W05qMagCaR4
import cv2

img_path = r&quot;D:\Indian AI Production\OpenCV\01 Opencv Tutorial\020 Blure Image\sandeep_maheshwari.jpg&quot;

img = cv2.imread(img_path)

cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using Gaussian Blur</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Normal Blur

blur_img = cv2.GaussianBlur(img, (3,3), sigmaX=34, sigmaY=36)

cv2.imshow(&quot;Blur Image&quot;, blur_img)
cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Heavy Blur

blur_img = cv2.GaussianBlur(img, (101,101), sigmaX=40, sigmaY=30)

cv2.imshow(&quot;Blur Image&quot;, blur_img)
cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Stretch image Vertically</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
blur_img = cv2.GaussianBlur(img, (1,99), sigmaX=10, sigmaY=10)

cv2.imshow(&quot;Blur Image&quot;, blur_img)
cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Stretch image Horizontally</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
blur_img = cv2.GaussianBlur(img, (99,1), sigmaX=10, sigmaY=20)

cv2.imshow(&quot;Blur Image&quot;, blur_img)
cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Save Blur Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
cv2.imwrite(&quot;blur_img.jpg&quot;, blur_img)
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/">Blur Image using Gaussian Filter OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/blur-image-using-gaussian-filter-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1767</post-id>	</item>
		<item>
		<title>Blur Image Using cv2.blur() &#038; cv2.boxFilter()OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/</link>
					<comments>https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Fri, 07 May 2021 04:36:52 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1761</guid>

					<description><![CDATA[<p>In&#160;Python OpenCV Tutorial, Explained How to Blur image using&#160;cv2.blur() and cv2.boxFilter()&#160;opencv function. Get the answers of below questions: How do I blur an image in OpenCV? How do you blur an image in Python? Why do we blur image? How do you blur part of a picture? Syntax: cv2.blur(src, ksize[, dst[, anchor[, borderType]]]) -&#62; dst &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/"> <span class="screen-reader-text">Blur Image Using cv2.blur() &#038; cv2.boxFilter()OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/">Blur Image Using cv2.blur() &#038; cv2.boxFilter()OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<strong>Python OpenCV Tutorial</strong>, Explained How to Blur image using&nbsp;<strong>cv2.blur() and cv2.boxFilter()&nbsp;</strong>opencv function.</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>How do I blur an image in OpenCV?</li><li>How do you blur an image in Python?</li><li>Why do we blur image?</li><li>How do you blur part of a picture?</li></ol>



<p><strong>Syntax:</strong></p>



<pre class="wp-block-preformatted"><strong>cv2.blur(src, ksize[, dst[, anchor[, borderType]]]) -&gt; dst</strong>
@brief Blurs an image using the normalized box filter.

<strong>Parameters: </strong>

@param src input image; it can have any number of channels, which are processed independently, but .   the depth should be CV_8U, CV_16U, CV_16S, CV_32F or CV_64F. .   
@param dst output image of the same size and type as src. .   
@param ksize blurring kernel size. .   
@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel .   center. .   
@param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes @sa  boxFilter, bilateralFilter, GaussianBlur, medianBlur</pre>



<pre class="wp-block-preformatted"><strong>cv2.boxFilter(src, ddepth, ksize[, dst[, anchor[, normalize[, borderType]]]]) -&gt; dst</strong>
The function smooths an image using the kernel:

<strong>Parameters:</strong>

@param src input image. .   
@param dst output image of the same size and type as src. .   
@param ddepth the output image depth (-1 to use src.depth()). .   
@param ksize blurring kernel size. .   
@param anchor anchor point; default value Point(-1,-1) means that the anchor is at the kernel .   center. .   
@param normalize flag, specifying whether the kernel is normalized by its area or not. .   @param borderType border mode used to extrapolate pixels outside of the image, see #BorderTypes @sa  blur, bilateralFilter, GaussianBlur, medianBlur, integral</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1765" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-blur-and-boxfilter-opencv-python.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Read &amp; Show Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
#### OpenCV Video Tutorial Playlist: https://www.youtube.com/watch?v=-rm0P7A4Jbc&amp;list=PLfP3JxW-T70G5FB9vcmT6T3xnmvFvqV7w ####

## Show Image

import cv2

img_path = r&quot;D:\Indian AI Production\OpenCV\01 Opencv Tutorial\020 Blure Image\vivek_bindra.jpg&quot;
img = cv2.imread(img_path)

cv2.imshow(&quot;Model&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using cv2.blur() with Kernel 3&#215;3</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_blur_3 = cv2.blur(img, (3,3))

cv2.imshow(&quot;Model Blur&quot;, img_blur_3)
cv2.imshow(&quot;Model &quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using cv2.blur() with Kernel 50&#215;50</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_blur_50 = cv2.blur(img, (50,50))

cv2.imshow(&quot;Model Blur&quot;, img_blur_50)
cv2.imshow(&quot;Model &quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using cv2.boxfilter() with Kernel 3&#215;3</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_b_blur_3 = cv2.boxFilter(img, -1, (3,3))

cv2.imshow(&quot;Model Blur&quot;, img_b_blur_3)
cv2.imshow(&quot;Model &quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Blur Image using cv2.boxfilter() with Kernel 3&#215;3 without Normalization</h4>



<h4 class="wp-block-heading"> </h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_b_blur_3 = cv2.boxFilter(img, -1, (3,3), normalize=False)

cv2.imshow(&quot;Model Blur normalize&quot;, img_b_blur_3)
cv2.imshow(&quot;Model &quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using cv2.boxfilter() with Kernel 50&#215;50</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_b_blur_50 = cv2.boxFilter(img, -1, (50,50))

cv2.imshow(&quot;Model Blur&quot;, img_b_blur_50)
cv2.imshow(&quot;Model &quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Show All Blur Image</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
import numpy as np

img_blur_3 = cv2.resize(img_blur_3, (650, 400))
img_blur_50 = cv2.resize(img_blur_50, (650, 400))

img_b_blur_3 = cv2.resize(img_b_blur_3, (650, 400))
img_b_blur_50 = cv2.resize(img_b_blur_50, (650, 400))

#putText(img, text, org, fontFace, fontScale, color&#x5B;, thickness&#x5B;, lineType&#x5B;, bottomLeftOrigin]]])
cv2.putText(img_blur_3, &quot;blur 3x3&quot;, (10,50), cv2.FONT_HERSHEY_COMPLEX, 2, (255,0,55), 3)
cv2.putText(img_blur_50, &quot;blur 50x50&quot;, (10,50), cv2.FONT_HERSHEY_COMPLEX, 2, (255,0,55), 3)
cv2.putText(img_b_blur_3, &quot;box blur 3x3&quot;, (10,50), cv2.FONT_HERSHEY_COMPLEX, 2, (255,255, 0), 3)
cv2.putText(img_b_blur_50, &quot;box blur 50x50&quot;, (10,50), cv2.FONT_HERSHEY_COMPLEX, 2, (255,255, 0), 3)


blurr_2_img = np.hstack((img_blur_3, img_blur_50))
filter_blur_2_img = np.hstack((img_b_blur_3, img_b_blur_50))

img_4 = np.vstack((blurr_2_img, filter_blur_2_img))

cv2.imshow(&quot;Show 4 Blur Image&quot;, img_4)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image in 2 Line</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
import cv2

cv2.imshow(&quot;Blur Image&quot;, cv2.blur(cv2.imread(r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\girl-eye.jpg&quot;), (50,50)))

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/">Blur Image Using cv2.blur() &#038; cv2.boxFilter()OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/blur-image-using-cv2-blur-cv2-boxfilter-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1761</post-id>	</item>
		<item>
		<title>Blur Image using filter2d OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/</link>
					<comments>https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Wed, 05 May 2021 02:46:28 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1758</guid>

					<description><![CDATA[<p>In Python OpenCV Tutorial, Explained How to Blur image using cv2.filter2d() opencv function. Get the answers of below questions: How do I blur an image in OpenCV? How do you blur an image in Python? Why do we blur image? How do you blur part of a picture? Syntax: cv2.filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/"> <span class="screen-reader-text">Blur Image using filter2d OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/">Blur Image using filter2d OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In <strong>Python OpenCV Tutorial</strong>, Explained How to Blur image using <strong>cv2.filter2d() </strong>opencv function.</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>How do I blur an image in OpenCV?</li><li>How do you blur an image in Python?</li><li>Why do we blur image?</li><li>How do you blur part of a picture?</li></ol>



<p><strong>Syntax: </strong></p>



<pre class="wp-block-preformatted"><strong>cv2.filter2D(src, ddepth, kernel[, dst[, anchor[, delta[, borderType]]]]) -> dst</strong>

<strong>Parameters:</strong></pre>



<pre class="wp-block-preformatted">.   @param src input image.
.   @param dst output image of the same size and the same number of channels as src.
.   @param ddepth desired depth of the destination image, see @ref filter_depths "combinations"
.   @param kernel convolution kernel (or rather a correlation kernel), a single-channel floating point
.   matrix; if you want to apply different kernels to different channels, split the image into
.   separate color planes using split and process them individually.
.   @param anchor anchor of the kernel that indicates the relative position of a filtered point within
.   the kernel; the anchor should lie within the kernel; default value (-1,-1) means that the anchor
.   is at the kernel center.
.   @param delta optional value added to the filtered pixels before storing them in dst.
.   @param borderType pixel extrapolation method, see #BorderTypes
.   @sa  sepFilter2D, dft, matchTemplate</pre>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1759" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/05/blur-image-using-filter2d-opencv-python.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Blur Image using Filter2D with 3&#215;3 kernel</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
#### OpenCV Video Tutorial Playlist: https://www.youtube.com/watch?v=-rm0P7A4Jbc&amp;list=PLfP3JxW-T70G5FB9vcmT6T3xnmvFvqV7w ####

# Show Image
import cv2
import numpy as np

img_path = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\adult-beauty-blond-301298.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

cv2.imshow(&quot;Model Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
one_mat_3_3 = np.ones((3,3), dtype=np.float32)/9
blur_img_3_3 = cv2.filter2D(img, -1, one_mat_3_3)


cv2.imshow(&quot;Blure image 3x3&quot;, blur_img_3_3)
cv2.imshow(&quot;Original Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using Filter2D with 5&#215;5 kernel</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
one_mat_5_5 = np.ones((5,5), dtype=np.float32)/25
blur_img_5_5 = cv2.filter2D(img, -1, one_mat_5_5)


cv2.imshow(&quot;Blure image 5x5&quot;, blur_img_5_5)
cv2.imshow(&quot;Original Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using Filter2D with 10&#215;10 kernel</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# 10*10
one_mat_10_10 = np.ones((10,10), dtype=np.float32)/100

blur_img_10_10 = cv2.filter2D(img, -1, one_mat_10_10)

cv2.imshow(&quot;Original Image&quot;, img)
cv2.imshow(&quot;Blure Image using&quot;, blur_img_10_10)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using Filter2D with 50&#215;50 kernel</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# 50*50
one_mat_50_50 = np.ones((50,50), dtype=np.float32)/2500

blur_img_50_50 = cv2.filter2D(img, -1, one_mat_50_50)

cv2.imshow(&quot;Original Image&quot;, img)
cv2.imshow(&quot;Blure Image using&quot;, blur_img_50_50)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Blur Image using Filter2D with 100&#215;100 kernel</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# 100*100
one_mat_100_100 = np.ones((100,100), dtype=np.float32)/10000

blur_img_100_100 = cv2.filter2D(img, -1, one_mat_100_100)

cv2.imshow(&quot;Original Image&quot;, img)
cv2.imshow(&quot;Blure Image using&quot;, blur_img_100_100)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h2 class="wp-block-heading">Show All Result in Single Windows(Image)</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
## Show All image Result in Single Windows(Image)

img = cv2.resize(img, (400, 350))
blur_img_3_3 = cv2.resize(blur_img_3_3, (400, 350))
blur_img_5_5 = cv2.resize(blur_img_5_5, (400, 350))
blur_img_10_10 = cv2.resize(blur_img_10_10, (400, 350))
blur_img_50_50 = cv2.resize(blur_img_50_50, (400, 350))
blur_img_100_100 = cv2.resize(blur_img_100_100, (400, 350))

cv2.putText(img, &quot;Original&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(0,0,255))
cv2.putText(blur_img_3_3, &quot;3x3 Filter&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(255,0,255))
cv2.putText(blur_img_5_5, &quot;5x5 Filter&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(255,0,255))
cv2.putText(blur_img_10_10, &quot;10x10 Filter&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(255,0,255))
cv2.putText(blur_img_50_50, &quot;50x50 Filter&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(255,0,255))
cv2.putText(blur_img_100_100, &quot;100x100 Filter&quot;, org=(20,40), fontFace=cv2.FONT_HERSHEY_PLAIN, fontScale= 2 , color=(255,0,255))

img1_3 = np.hstack((img, blur_img_3_3, blur_img_5_5))
img2_3 = np.hstack((blur_img_10_10, blur_img_50_50,blur_img_100_100))

img3_6 = np.vstack((img1_3,img2_3))

cv2.imshow(&quot;1 original and 5 Blur Image&quot;, img3_6)
cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/">Blur Image using filter2d OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/blur-image-using-filter2d-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1758</post-id>	</item>
		<item>
		<title>Color Pixels Extraction using OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/</link>
					<comments>https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Fri, 23 Apr 2021 13:37:57 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1753</guid>

					<description><![CDATA[<p>In&#160;Python OpenCV Tutorial, Explained How to Extraction or Detect Pixels Color using OpenCV Python Get the answers of below questions: How do you find the color of the pixel of an image? How do you find the color of an image in Python? How do I extract color features from an image? How do we &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/"> <span class="screen-reader-text">Color Pixels Extraction using OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/">Color Pixels Extraction using OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<strong>Python OpenCV Tutorial</strong>, Explained How to Extraction or Detect Pixels Color using OpenCV Python</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>How do you find the color of the pixel of an image?</li><li>How do you find the color of an image in Python?</li><li>How do I extract color features from an image?</li><li>How do we find items of a specific color?</li><li>How can I identify a color in an image?</li></ol>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1754" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/color-pixels-extraction-using-opencv-python.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">Color Pixels Extraction</h2>



<h3 class="wp-block-heading">How to Detect Road Marking Using OpenCV</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
# Show an Image
import cv2
import numpy as np

img_path =r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road1.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

cv2.imshow(&quot;Road Image&quot;, img)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h4 class="wp-block-heading">Conver image in gray scale</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
gray_img = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)

cv2.imshow(&quot;Gray Image&quot;, gray_img)

cv2.waitKey(0)
cv2.destroyAllWindows()

</pre></div>


<h4 class="wp-block-heading">Road Margin Detection using Gray Image</h4>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
gray_img_copy = np.copy(gray_img)

gray_img_copy&#x5B;gray_img_copy&#x5B;:, :] &lt; 200]=0

cv2.imshow(&quot;Gray Image&quot;, gray_img_copy)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
gray_img ## 0 - 255 ## 0=Black, 255= White

gray_img_copy&#x5B;:, :] &lt; 200

gray_img_copy

gray_img_copy&#x5B;:, 300]
</pre></div>


<h3 class="wp-block-heading">Road Margin Detection using Color Image</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_copy = np.copy(img)

print(&quot;img_copy.shape: &quot;, img_copy.shape)

img_copy&#x5B;(img_copy&#x5B;:, :, 0] &lt; 200) | (img_copy&#x5B;:, :, 1] &lt; 200) | (img_copy&#x5B;:, :, 2] &lt; 200)] = 0

cv2.imshow(&quot;Color Image&quot;, img_copy)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h3 class="wp-block-heading">Sign Board Detection</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_path =r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road5.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

img_copy = np.copy(img)

img_copy&#x5B;(img_copy&#x5B;:,:,0] &gt; 50) | (img_copy&#x5B;:,:,1] &lt; 150) | (img_copy&#x5B;:, :, 2] &lt; 150) ]=0

img_2 = np.hstack((cv2.resize(img, (650, 500)), cv2.resize(img_copy, (650, 500))))
cv2.imshow(&quot;Yellow Road Image&quot;, img_2)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h3 class="wp-block-heading">Red Color Pixels Extraction</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_path =r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road6.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

img_copy = np.copy(img)

img_copy&#x5B;(img_copy&#x5B;:,:,0] &gt; 50) | (img_copy&#x5B;:,:,1] &gt; 50) | (img_copy&#x5B;:, :, 2] &lt; 90) ]=0

img_2 = np.hstack(( cv2.resize(img, (650, 500)), cv2.resize(img_copy, (650, 500)) ))
cv2.imshow(&quot;Color Image VS Color Extracted Image&quot;, img_2)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h3 class="wp-block-heading">Yellow Color Pixels Extraction</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_path =r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\road4.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

img_copy = np.copy(img)

img_copy&#x5B;(img_copy&#x5B;:,:,0] &gt; 50) | (img_copy&#x5B;:,:,1] &lt; 150) | (img_copy&#x5B;:, :, 2] &lt; 150) ]=0
cv2.imshow(&quot;Yellow Road Image&quot;, img_copy)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div>


<h3 class="wp-block-heading">Human Detection</h3>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
img_path =r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\road\sunset.jpg&quot;

img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

img_copy = np.copy(img)

img_copy&#x5B;(img_copy&#x5B;:,:,0] &gt; 90) | (img_copy&#x5B;:,:,1] &gt; 90) | (img_copy&#x5B;:, :, 2] &gt; 90) ]=255

img_2 = np.hstack((cv2.resize(img, (650, 500)), cv2.resize(img_copy, (650, 500))))
cv2.imshow(&quot;Yellow Road Image&quot;, img_2)

cv2.waitKey(0)
cv2.destroyAllWindows()
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/">Color Pixels Extraction using OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/pixels-color-extraction-using-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1753</post-id>	</item>
		<item>
		<title>How to Show Histogram of Image using OpenCV Python &#124; OpenCV Tutorial</title>
		<link>https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/</link>
					<comments>https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/#respond</comments>
		
		<dc:creator><![CDATA[Indian AI Production]]></dc:creator>
		<pubDate>Sun, 18 Apr 2021 09:35:58 +0000</pubDate>
				<category><![CDATA[OpenCV Project]]></category>
		<guid isPermaLink="false">https://indianaiproduction.com/?p=1748</guid>

					<description><![CDATA[<p>In&#160;Python OpenCV Tutorial, Explained How to show the Histogram of Image to analyse the image color format using OpenCV Python Get the answers of below questions: How do you find the histogram of an image? How do you find the histogram of an image in Python? Green channel extraction in image processing python What is &#8230;</p>
<p class="read-more"> <a class="" href="https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/"> <span class="screen-reader-text">How to Show Histogram of Image using OpenCV Python &#124; OpenCV Tutorial</span> Read More &#187;</a></p>
<p>The post <a rel="nofollow" href="https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/">How to Show Histogram of Image using OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></description>
										<content:encoded><![CDATA[
<p>In&nbsp;<strong>Python OpenCV Tutorial</strong>, Explained How to show the Histogram of Image to analyse the image color format using OpenCV Python</p>



<p>Get the answers of below questions:</p>



<ol type="1"><li>How do you find the histogram of an image?</li><li>How do you find the histogram of an image in Python?</li><li>Green channel extraction in image processing python</li><li>What is histogram in OpenCV?</li><li>How do you plot a histogram of a picture?</li><li>How do you calculate a histogram?</li><li>What are the properties of histogram?</li></ol>



<div class="wp-block-image"><figure class="aligncenter size-large"><img loading="lazy" decoding="async" width="1024" height="576" src="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?resize=1024%2C576&#038;ssl=1" alt="" class="wp-image-1749" srcset="https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?resize=1024%2C576&amp;ssl=1 1024w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?resize=300%2C169&amp;ssl=1 300w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?resize=768%2C432&amp;ssl=1 768w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?resize=1536%2C864&amp;ssl=1 1536w, https://i0.wp.com/indianaiproduction.com/wp-content/uploads/2021/04/image-histogram.jpg?w=1920&amp;ssl=1 1920w" sizes="(max-width: 1024px) 100vw, 1024px" data-recalc-dims="1" /></figure></div>



<h2 class="wp-block-heading">What is histogram ?</h2>



<p><strong>You can consider histogram as a graph or plot, which gives you an overall idea about the intensity distribution of an image. It is a plot with pixel values (ranging from 0 to 255, not always) in X-axis and corresponding number of pixels in the image on Y-axis.</strong></p>



<p><strong>Syntax: cv2.calcHist(images, channels, mask, histSize, ranges[, hist[, accumulate]]) -> hist</strong></p>



<pre class="wp-block-code"><code>1. Histogram Calculation in OpenCV
So now we use cv.calcHist() function to find the histogram. Let's familiarize with the function and its parameters :

cv.calcHist(images, channels, mask, histSize, ranges&#91;, hist&#91;, accumulate]])
images : it is the source image of type uint8 or float32. it should be given in square brackets, 
    ie, "&#91;img]".
channels : it is also given in square brackets. It is the index of channel for which we calculate 
    histogram. 
    For example, if input is grayscale image, its value is &#91;0]. For color image, you can pass &#91;0],
    &#91;1] or &#91;2] to calculate histogram of blue, green or red channel respectively.
mask : mask image. To find histogram of full image, it is given as "None". But if you want to find 
    histogram of particular region of image, you have to create a mask image for that and give it 
    as mask. (I will show an example later.)
histSize : this represents our BIN count. Need to be given in square brackets. For full scale,
    we pass &#91;256].
ranges : this is our RANGE. Normally, it is &#91;0,256].
So let's start with a sample image. Simply load an image in grayscale mode and find its full histogram.

REF: https://docs.opencv.org/master/d1/db7/tutorial_py_histogram_begins.html</code></pre>



<h2 class="wp-block-heading">Code(Jupyter Notebook):</h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
## Get Prime Video free at
## OpenCV Tutorial Playlist: https://www.youtube.com/watch?v=-rm0P7A4Jbc&amp;list=PLfP3JxW-T70G5FB9vcmT6T3xnmvFvqV7w

# # How to Show Histogram of Image

# In&#x5B;1]:
# Show Image
import cv2
import matplotlib.pyplot as plt

img_path = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\data\images\banner-1235604.jpg&quot;
#img_path = r&quot;C:\Users\kashz\AI Life\AI Projects - IAIP, PTs (Web + Channel)\02 OpenCV\000 opencv tutorial\green.jpg&quot;
img = cv2.imread(img_path)
img = cv2.resize(img, (1280, 720))

cv2.imshow(&quot;Image&quot;, img)
cv2.waitKey(0)
cv2.destroyAllWindows()

# In&#x5B;2]:
img

# In&#x5B;3]:
img.ravel()

# In&#x5B;4]:
img.shape

# In&#x5B;5]:
img.ravel().shape

# In&#x5B;6]:
img.ravel().size

# ## Histogram of Image 
# In&#x5B;7]:
plt.hist(img.ravel(), bins=256, range = &#x5B;0,255])
plt.show()

# ## Histogram of All channels
# In&#x5B;8]:
colors = ('b', 'g', 'r')

img_ravel = &#x5B;img&#x5B;:, :, 0].ravel(), img&#x5B;:, :, 1].ravel(), img&#x5B;:,:, 2].ravel()] 
plt.hist(img_ravel, color=colors, label=colors)
plt.legend()
plt.show()

# In&#x5B;9]:
colors = ('b', 'g', 'r')
img_ravel = &#x5B;img&#x5B;:, :, 0].ravel(), img&#x5B;:, :, 1].ravel(), img&#x5B;:,:, 2].ravel()] 
plt.hist(img_ravel, color=colors, label=colors, bins=256, range=&#x5B;0,256])
plt.legend()
plt.show()

# ## Plot of all Channel using cv2.calcHist() Function
# In&#x5B;10]:
colors = ('b', 'g', 'r')      
plt.figure(figsize=(16, 9))
for i, color in enumerate(colors):
    histogram = cv2.calcHist(&#x5B;img], &#x5B;i], None, &#x5B;256], &#x5B;0, 256])
    plt.plot(histogram, color=color)
plt.show()

# In&#x5B;11]:
histogram
</pre></div><p>The post <a rel="nofollow" href="https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/">How to Show Histogram of Image using OpenCV Python | OpenCV Tutorial</a> appeared first on <a rel="nofollow" href="https://indianaiproduction.com">Indian AI Production</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://indianaiproduction.com/show-histogram-of-image-using-opencv-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
		<post-id xmlns="com-wordpress:feed-additions:1">1748</post-id>	</item>
	</channel>
</rss>

<!--
Performance optimized by W3 Total Cache. Learn more: https://www.boldgrid.com/w3-total-cache/

Page Caching using Disk: Enhanced 

Served from: indianaiproduction.com @ 2026-06-16 10:50:20 by W3 Total Cache
-->