<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>흩어진 편린들이 모이는 구름 속</title>
    <description>삶 좀 편해지고싶은 사람의 개인 블로그입니다.</description>
    <link>https://blog.dotoritos.net/</link>
    <atom:link href="https://blog.dotoritos.net/feed.xml" rel="self" type="application/rss+xml"/>
    <pubDate>Sun, 08 Nov 2026 08:24:02 +0000</pubDate>
    <lastBuildDate>Sun, 08 Nov 2026 08:24:02 +0000</lastBuildDate>
    <generator>Jekyll v4.4.1</generator>
    
      <item>
        <title>OpenCVSharp blur</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Blur&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Image Blurring&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;이웃 화소들을 평균화 합니다.&lt;/p&gt;

&lt;p&gt;다른 말로 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;low pass filter&lt;/code&gt; 라고 부릅니다.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt;public void Blur_Example()
{
	using Mat WindowImage = new Mat(&quot;./Resource.png&quot;, ImreadModes.AnyColor);
	using Mat blurImage = new Mat();
	using Mat box_filter = new Mat();
	using Mat median_blur = new Mat();
	using Mat gaussian_blur = new Mat();
	using Mat bilateral_filter = new Mat();
    
	Cv2.Blur(WindowImage, blurImage, new Size(9, 9),new Point(-1,-1));
	Cv2.BoxFilter(WindowImage, box_filter, WindowImage.Type(),new Size(5,5));
	Cv2.MedianBlur(WindowImage, median_blur, 5);
	Cv2.GaussianBlur(WindowImage, gaussian_blur, new Size(9, 9), 3);
	Cv2.BilateralFilter(WindowImage, bilateral_filter, 10,50,50);
	

	using var Blur = new Window(&quot;Blur&quot;, WindowMode.AutoSize, blurImage);
	using var BoxFilter = new Window(&quot;BoxFilter&quot;, WindowMode.AutoSize, box_filter);
	using var MedianBlur = new Window(&quot;MedianBlur&quot;, WindowMode.AutoSize, median_blur);
	using var GaussianBlur = new Window(&quot;GaussianBlur&quot;, WindowMode.AutoSize, gaussian_blur);
	using var BilateralFilter = new Window(&quot;BilateralFilter&quot;, WindowMode.AutoSize, bilateral_filter);
	
	Cv2.WaitKey();
}
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Averaging Blur&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Box 형태의 커널을 이미지에 적용하여 평균값을 Box 중심점에 적용합니다.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt;Cv2.Blur(WindowImage, blurImage, new Size(9, 9),new Point(-1,-1));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2020-03-21-1/Blur.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;BoxFilter 로도 사용할 수 있습니다.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt;Cv2.BoxFilter(WindowImage, box_filter, WindowImage.Type(),new Size(5,5));
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2020-03-21-1/BoxFilter.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;MedianBlur&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;커널 영역 내의 중앙값으로 픽셀을 대체하는 중앙값 블러 입니다.&lt;/p&gt;

&lt;p&gt;전체 이미지를 일정한 작은 영역으로 나누고 영역의 모든 화소를 크기 순으로 정렬한 뒤 중간값을 찾습니다. 그 영역을 가운데 화소를 찾아낸 중간값으로 대체합니다.&lt;/p&gt;

&lt;p&gt;정상적인 데이터를 이용하여 노이즈를 덮습니다.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt;Cv2.MedianBlur(WindowImage, median_blur, 5);
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2020-03-21-1/MedianBlur.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;GaussianBlur&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;현재 픽셀값과 주변 이웃 픽셀값들의 가중 평균을 이용해서 현재 픽셀의 값을 대체합니다..&lt;/p&gt;

&lt;p&gt;현재 픽셀에서 가까울수록 더 큰 가중치를 갖게되고 멀수록 더 작은 가중치를 갖게됩니다.&lt;/p&gt;

&lt;p&gt;가우시안 필터는 이미지는 공간적으로 천천히 변하기 때문에 가까이 있는 픽셀들은 비슷한 값들을 갖는다는 사실에 기반하여 만들어졌고 노이즈 값은 상대적으로 이웃 픽셀들 값과 상관성이 작기 때문에 이웃 픽셀값들의 가중 평균의 방식으로 완화시킬 수 있습니다.&lt;/p&gt;

&lt;div class=&quot;language-c# highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;GaussianBlur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WindowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;gaussian_blur&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Size&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;9&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;),&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;3&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2020-03-21-1/GaussianBlur.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BilateralFilter&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;경계를 보존하면서 선형으로 처리되지 않고, 선명도를 증가시키고, 가장자리와 노이즈를 줄여주어 부드러운 영상이 만들어지게 됩니다.&lt;/p&gt;

&lt;p&gt;변수의 값이 클수록 픽셀에 미치는 영향이 커져서 가중치가 커지게 됩니다.&lt;/p&gt;

&lt;div class=&quot;language-c# highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;n&quot;&gt;Cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;BilateralFilter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;WindowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;bilateral_filter&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;10&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;50&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2020-03-21-1/BilateralFilter.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Sat, 21 Mar 2020 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2020/03/21/1-OpenCVSharp-Blur</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2020/03/21/1-OpenCVSharp-Blur</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp BackgroundSubtractor</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;BackgroundSubtractor&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;배경제거알고리즘은 많은 비전기반 전처리 단계에서 주로 사용된다.&lt;/p&gt;

&lt;div class=&quot;language-c# highlighter-rouge&quot;&gt;&lt;div class=&quot;highlight&quot;&gt;&lt;pre class=&quot;highlight&quot;&gt;&lt;code&gt;&lt;span class=&quot;k&quot;&gt;public&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;void&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;BackgroundSubtractor_Example&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;()&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;VideoCapture&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;capture&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;VideoCapture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOG2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BackgroundSubtractorMOG2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOG&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BackgroundSubtractorMOG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GMG&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BackgroundSubtractorGMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;var&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;KNN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;BackgroundSubtractorKNN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Create&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Mat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Mat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOG2remove&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Mat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOGremove&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Mat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GMG2remove&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;
    &lt;span class=&quot;k&quot;&gt;using&lt;/span&gt; &lt;span class=&quot;nn&quot;&gt;Mat&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;KNNremove&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Mat&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;();&lt;/span&gt;

    &lt;span class=&quot;n&quot;&gt;Window&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;win_MOG2&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MOG2&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Window&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;win_GMG&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;GMG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Window&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;win_MOG&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;MOG&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;n&quot;&gt;Window&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;win_KNN&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;=&lt;/span&gt; &lt;span class=&quot;k&quot;&gt;new&lt;/span&gt; &lt;span class=&quot;nf&quot;&gt;Window&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;s&quot;&gt;&quot;KNN&quot;&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

    &lt;span class=&quot;k&quot;&gt;while&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;Cv2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;WaitKey&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;m&quot;&gt;1&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt; &lt;span class=&quot;p&quot;&gt;&amp;lt;&lt;/span&gt; &lt;span class=&quot;m&quot;&gt;0&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;)&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;{&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;capture&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Read&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MOG2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Apply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOG2remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;MOG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Apply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;MOGremove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;GMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Apply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;GMG2remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;KNN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;Apply&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;frame&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;,&lt;/span&gt; &lt;span class=&quot;n&quot;&gt;KNNremove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;

        &lt;span class=&quot;n&quot;&gt;win_MOG2&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ShowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MOG2remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;win_GMG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ShowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;MOGremove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;win_MOG&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ShowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;GMG2remove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
        &lt;span class=&quot;n&quot;&gt;win_KNN&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;.&lt;/span&gt;&lt;span class=&quot;nf&quot;&gt;ShowImage&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;(&lt;/span&gt;&lt;span class=&quot;n&quot;&gt;KNNremove&lt;/span&gt;&lt;span class=&quot;p&quot;&gt;);&lt;/span&gt;
    &lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;span class=&quot;p&quot;&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorMOG&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;이는 가우시안 혼합을 기반으로한 전경또는 배경을 분할하는 알고리즘이다.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;Mixture&lt;/code&gt;에 대한 가중치는 색상이 위치에 머무는 시간의 비율을 나타낸다.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorMOG2&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;이는 가우시안 혼합을 기반으로한 전경또는 배경을 분할하는 알고리즘이다.&lt;/p&gt;

&lt;p&gt;이전 MOG 알고리즘보다 조명 변화로 인한 다양한 장면에 대해서 더 나은 적응력을 보이는 알고리즘이다.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorGMG&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;이는 처음의 몇(120개) 프레임을 배경 모델링하는데 사용한다.&lt;/p&gt;

&lt;p&gt;이는 베이지안 추론을 사용하여 전경 객체일 확률을 구하는 확률적 전경 분할 알고리즘에 이용된다.&lt;/p&gt;

&lt;p&gt;이 추측은 적응적이다.&lt;/p&gt;

&lt;p&gt;변덕스러운 조명에 적응하기 위해 새로운 관측들은 기존의 관측보다 더 높은 가중치를 가진다.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;closing&lt;/code&gt;과 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;opening&lt;/code&gt;과 같은 몇몇 형태학적인필터링으로 원하지 않는 노이즈를 제거할 수 있다.&lt;/p&gt;

&lt;p&gt;처음 몇 프레임동안은 검정 창을 보게 된다.&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorKNN&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;&lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorMOG2&lt;/code&gt; 및 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorKNN&lt;/code&gt;은 서로 다른 두 개의 백그라운드 뺄셈 알고리즘을 구현한 것이다.&lt;/p&gt;

&lt;p&gt;전경 픽셀 수가 적은 경우 매우 효율적.&lt;/p&gt;

&lt;p&gt;하지만 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;BackgroundSubtractorKNN&lt;/code&gt; 알고리즘에는 &lt;code class=&quot;language-plaintext highlighter-rouge&quot;&gt;setBackgroundRatio&lt;/code&gt;가 필요하지 않다.&lt;/p&gt;
</description>
        <pubDate>Fri, 06 Mar 2020 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2020/03/06/1-OpenCVSharp-BackgroundSubtractor</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2020/03/06/1-OpenCVSharp-BackgroundSubtractor</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp CarPlateDetection</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;차량 번호판 검출&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/9-OpenCVSharp-CarPlateDetection</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/9-OpenCVSharp-CarPlateDetection</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp Template matching</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;Template matching&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/8-OpenCVSharp-Template-matching</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/8-OpenCVSharp-Template-matching</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>7 Opencvsharp convexhull</title>
        <description>
&lt;hr /&gt;
&lt;p&gt;layout: post
title: OpenCVSharp ConvexHull
categories: OpenCVSharp
—&lt;/p&gt;

&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;ConvexHull&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/7-OpenCVSharp-ConvexHull</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/7-OpenCVSharp-ConvexHull</guid>
        
        
      </item>
    
      <item>
        <title>OpenCVSharp Bounding rectangle</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;사각형 검출&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/6-OpenCVSharp-Bounding-rectangle</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/6-OpenCVSharp-Bounding-rectangle</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp Contour and corner detection</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;윤곽선과 코너 검출&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/5-OpenCVSharp-Contour-and-corner-detection</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/5-OpenCVSharp-Contour-and-corner-detection</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp Labeling</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;라벨링&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/4-OpenCVSharp-Labeling</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/4-OpenCVSharp-Labeling</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp Morpology operation</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;모폴로지 연산&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;
</description>
        <pubDate>Wed, 27 Nov 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/11/27/3-OpenCVSharp-Morphology-operation</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/11/27/3-OpenCVSharp-Morphology-operation</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
      <item>
        <title>OpenCVSharp Geometric trans</title>
        <description>&lt;blockquote&gt;
  &lt;p&gt;&lt;strong&gt;기하학적 변형&lt;/strong&gt;&lt;/p&gt;
&lt;/blockquote&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt; List&amp;lt;Point2f&amp;gt; point2Fs = new List&amp;lt;Point2f&amp;gt;();

 Point2f[] srcPoints = new Point2f[] {
     new Point2f(0, 0),
     new Point2f(0, 0),
     new Point2f(0, 0),
     new Point2f(0, 0),
 };

 Point2f[] dstPoints = new Point2f[] {
     new Point2f(0, 0),
     new Point2f(0, 480),
     new Point2f(640, 480),
     new Point2f(640, 0),
 };

 Mat OriginalImage;
 public void Geometric()
 {
     OriginalImage = new Mat(&quot;./Resource.png&quot;, ImreadModes.AnyColor);
     using var Window = new Window(&quot;result&quot;, OriginalImage);

     Cv2.SetMouseCallback(Window.Name, CallbackOpenCVAnnotate);
     Window.WaitKey();
 }
 private void CallbackOpenCVAnnotate(MouseEvent e, int x, int y, MouseEvent flags, IntPtr userdata)
 {
     if (e == MouseEvent.LButtonDown)
     {
         point2Fs.Add(new Point2f(x, y));
         if(point2Fs.Count == 4)
         {
             srcPoints = new Point2f[]
             {
                 point2Fs[0],
                 point2Fs[1],
                 point2Fs[2],
                 point2Fs[3]
             };
             using var matrix = Cv2.GetPerspectiveTransform(srcPoints, dstPoints);
             using var dst = new Mat(new Size(640, 480), MatType.CV_8UC3);
             Cv2.WarpPerspective(OriginalImage, dst, matrix, dst.Size());
             using var dsts = new Window(&quot;dst&quot;, dst);
             point2Fs.Clear();
         }
     }
 }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;Cv2 클래스의 GetPerspectiveTransform을 사용하여 이미지를 강제 변환하는 소스코드이다.&lt;/p&gt;

&lt;pre&gt;&lt;code class=&quot;language-C#&quot;&gt;point2Fs.Add(new Point2f(x, y));
         if(point2Fs.Count == 4)
         {
             srcPoints = new Point2f[]
             {
                 point2Fs[0],
                 point2Fs[1],
                 point2Fs[2],
                 point2Fs[3]
             };
             using var matrix = Cv2.GetPerspectiveTransform(srcPoints, dstPoints);
             using var dst = new Mat(new Size(640, 480), MatType.CV_8UC3);
             Cv2.WarpPerspective(OriginalImage, dst, matrix, dst.Size());
             using var dsts = new Window(&quot;dst&quot;, dst);
             point2Fs.Clear();
         }
&lt;/code&gt;&lt;/pre&gt;

&lt;p&gt;srcPoints의 좌표를 Mat에서 따와 dstPoints의 크기에 맞게 이미지를 강제 변환한다.&lt;/p&gt;

&lt;p&gt;예제 이미지:&lt;/p&gt;

&lt;p&gt;&lt;img src=&quot;https://blog.dotoritos.net/images/2019-09-21-1/1.png&quot; alt=&quot;Image Alt &quot; width=&quot;80%&quot; height=&quot;80%&quot; /&gt;&lt;/p&gt;
</description>
        <pubDate>Sat, 21 Sep 2019 00:00:00 +0000</pubDate>
        <link>https://blog.dotoritos.net/blog/2019/09/21/1-OpenCVSharp-%EA%B8%B0%ED%95%98%ED%95%99%EC%A0%81-%EB%B3%80%ED%99%98</link>
        <guid isPermaLink="true">https://blog.dotoritos.net/blog/2019/09/21/1-OpenCVSharp-%EA%B8%B0%ED%95%98%ED%95%99%EC%A0%81-%EB%B3%80%ED%99%98</guid>
        
        
        <category>OpenCVSharp</category>
        
      </item>
    
  </channel>
</rss>
