亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? imagesegmentation.cpp

?? 圖像分割算法
?? CPP
?? 第 1 頁 / 共 5 頁
字號(hào):
//Copyright (c) 2004-2005, Baris Sumengen
//All rights reserved.
//
// CIMPL Matrix Performance Library
//
//Redistribution and use in source and binary
//forms, with or without modification, are
//permitted provided that the following
//conditions are met:
//
//    * No commercial use is allowed. 
//    This software can only be used
//    for non-commercial purposes. This 
//    distribution is mainly intended for
//    academic research and teaching.
//    * Redistributions of source code must
//    retain the above copyright notice, this
//    list of conditions and the following
//    disclaimer.
//    * Redistributions of binary form must
//    mention the above copyright notice, this
//    list of conditions and the following
//    disclaimer in a clearly visible part 
//    in associated product manual, 
//    readme, and web site of the redistributed 
//    software.
//    * Redistributions in binary form must
//    reproduce the above copyright notice,
//    this list of conditions and the
//    following disclaimer in the
//    documentation and/or other materials
//    provided with the distribution.
//    * The name of Baris Sumengen may not be
//    used to endorse or promote products
//    derived from this software without
//    specific prior written permission.
//
//THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
//HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
//EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT
//NOT LIMITED TO, THE IMPLIED WARRANTIES OF
//MERCHANTABILITY AND FITNESS FOR A PARTICULAR
//PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
//CONTRIBUTORS BE LIABLE FOR ANY
//DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
//EXEMPLARY, OR CONSEQUENTIAL DAMAGES
//(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
//OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
//DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
//HOWEVER CAUSED AND ON ANY THEORY OF
//LIABILITY, WHETHER IN CONTRACT, STRICT
//LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
//OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
//OF THIS SOFTWARE, EVEN IF ADVISED OF THE
//POSSIBILITY OF SUCH DAMAGE.


#include "./ImageSegmentation.h"
#include <queue>
#include <vector>





namespace ImageProcessing
{


// Gaussian Filter
	Matrix<float> Gaussian2D(int side, float sigma_x, float angle, float ratio)
	{
		Matrix<float> temp(2*side+1, 2*side+1); 

		float sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = 1.0/(2.0*PI*sigma_x*sigma_y)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = (float)(sum_G/T);
			}
		}
		return temp;
	}



	Matrix<double> Gaussian2D(int side, double sigma_x, double angle, double ratio)
	{
		Matrix<double> temp(2*side+1, 2*side+1); 

		double sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = 1.0/(2.0*PI*sigma_x*sigma_y)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = sum_G/T;
			}
		}
		return temp;
	}





// First Directional Derivative of Gaussian Filter


	Matrix<float> FDGaussian2D(int side, float sigma_x, float angle, float ratio)
	{
		Matrix<float> temp(2*side+1, 2*side+1);

		float sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = -x_new/(2.0*PI*sigma_x*sigma_y*sigma_x*sigma_x)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = (float)(sum_G/T);
			}
		}
		return temp;
	}



	Matrix<double> FDGaussian2D(int side, double sigma_x, double angle, double ratio)
	{
		Matrix<double> temp(2*side+1, 2*side+1);

		double sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = -x_new/(2.0*PI*sigma_x*sigma_y*sigma_x*sigma_x)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = sum_G/T;
			}
		}
		return temp;
	}


// Second Directional Derivative of Gaussian Filter


	Matrix<float> SDGaussian2D(int side, float sigma_x, float angle, float ratio)
	{
		Matrix<float> temp(2*side+1, 2*side+1);

		float sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);
		}
		else
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = (x_new*x_new-sigma_x*sigma_x)/(2.0*PI*sigma_x*sigma_y*sigma_x*sigma_x*sigma_x*sigma_x)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = (float)(sum_G/T);
			}
		}
		return temp;
	}



	Matrix<double> SDGaussian2D(int side, double sigma_x, double angle, double ratio)
	{
		Matrix<double> temp(2*side+1, 2*side+1);

		double sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = (x_new*x_new-sigma_x*sigma_x)/(2.0*PI*sigma_x*sigma_y*sigma_x*sigma_x*sigma_x*sigma_x)*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = sum_G/T;
			}
		}
		return temp;
	}





// Laplacian of Gaussian Filter
	Matrix<float> LOG(int side, float sigma_x, float angle, float ratio)
	{
		Matrix<float> temp(2*side+1, 2*side+1); 

		float sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = (x_new*x_new+y_new*y_new-sigma_x*sigma_x-sigma_y*sigma_y)
							/(2.0*PI*sigma_x*sigma_y*(sigma_x*sigma_x*sigma_x*sigma_x+sigma_y*sigma_y*sigma_y*sigma_y))
							*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = (float)(sum_G/T);
			}
		}
		return temp;
	}



	Matrix<double> LOG(int side, double sigma_x, double angle, double ratio)
	{
		Matrix<double> temp(2*side+1, 2*side+1); 

		double sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

		double T = (double) (2*sample+1)*(2*sample+1);

		for (int i=0;i<2*side+1;i++) 
		{
			for (int j=0;j<2*side+1;j++) 
			{
				double sum_G = 0.0;
				double y = (double) (j-side)-d*sample-d;
				for (int sx=0;sx<2*sample+1;sx++) 
				{
					y += d;
					double x = (double) (i-side)-d*sample-d;
					for (int sy=0;sy<2*sample+1;sy++) 
					{
						x += d;

						double x_new = x*cos_angle + y*sin_angle;
						double y_new = -x*sin_angle + y*cos_angle;
						double g = (x_new*x_new+y_new*y_new-sigma_x*sigma_x-sigma_y*sigma_y)
							/(2.0*PI*sigma_x*sigma_y*(sigma_x*sigma_x*sigma_x*sigma_x+sigma_y*sigma_y*sigma_y*sigma_y))
							*exp(-(x_new*x_new/(sigma_x*sigma_x)+y_new*y_new/(sigma_y*sigma_y))/2.0);
						sum_G += g;
					}
				}

				temp.ElemNC(j,i) = sum_G/T;
			}
		}
		return temp;
	}





// Difference of offset Gaussians filter
	Matrix<float> DOOG2D(int side, float sigma_x, float offset, float angle, float ratio)
	{
		Matrix<float> temp(2*side+1, 2*side+1);

		float sigma_y = sigma_x*ratio;

		double sin_angle = sin(angle*PI/180);
		double cos_angle = cos(angle*PI/180);

		int sample;
		double d;
		if (sigma_x < 2.0 || sigma_y < 2.0) 
		{
			// use denser sample for better filter quality 
			sample = 5;
			d = 1.0/(2.0*sample+1.0);      
		}
		else 
		{
			sample = 0;
			d = 1.0;
		}

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
一本大道久久a久久精二百| 成人app软件下载大全免费| 国产香蕉久久精品综合网| 色婷婷综合久久久中文字幕| 狠狠色丁香九九婷婷综合五月| 日韩美女视频一区二区| 精品电影一区二区| 精品1区2区3区| 成人av免费在线观看| 国产一区二区三区久久久| 亚洲图片欧美色图| 综合久久综合久久| 国产人妖乱国产精品人妖| 91麻豆精品国产91久久久资源速度 | 成人午夜视频福利| 久久精品国产亚洲高清剧情介绍| 亚洲自拍偷拍av| 国产精品福利一区二区| 久久久国际精品| 日韩精品一区二区三区三区免费| 欧美日韩国产一区| 色婷婷综合视频在线观看| 99久久久免费精品国产一区二区| 久久99精品久久久久久动态图| 午夜精品国产更新| 一区二区免费看| 亚洲精品乱码久久久久| 亚洲欧美综合网| 国产精品视频一二三区 | 中文字幕一区日韩精品欧美| 久久亚洲综合色| 亚洲精品一区二区三区影院 | 欧美视频在线观看一区二区| 色综合一个色综合亚洲| 95精品视频在线| 91美女精品福利| 91香蕉视频mp4| 色婷婷久久99综合精品jk白丝| 99久久精品99国产精品| 99久精品国产| 色婷婷亚洲精品| 91黄色免费看| 欧美精品久久天天躁| 欧美欧美欧美欧美| 欧美一区二区三区视频在线观看 | 欧美精品v日韩精品v韩国精品v| 欧美视频一区二区三区四区| 欧美日本免费一区二区三区| 91精品国产高清一区二区三区| 欧美一卡二卡三卡四卡| 欧美xxxxxxxx| 日本一区二区久久| 亚洲人成影院在线观看| 夜夜亚洲天天久久| 肉肉av福利一精品导航| 精品制服美女丁香| 国产成人一级电影| 一本一本大道香蕉久在线精品| 在线观看av不卡| 日韩一区二区影院| 久久久精品综合| 亚洲婷婷在线视频| 亚洲高清免费一级二级三级| 久久国产人妖系列| 成人黄色网址在线观看| 精品国产乱码久久久久久免费| 欧美成人国产一区二区| 国产精品色哟哟| 亚洲国产精品影院| 韩国成人福利片在线播放| 不卡的av电影| 欧美日本免费一区二区三区| 久久亚区不卡日本| 亚洲乱码国产乱码精品精98午夜 | 国产精品久久久久婷婷| 亚洲国产日韩在线一区模特| 国内精品久久久久影院一蜜桃| 成年人国产精品| 欧美一区二区不卡视频| 国产精品国产三级国产三级人妇| 亚洲电影激情视频网站| 国产做a爰片久久毛片| 一本大道久久精品懂色aⅴ| 日韩精品一区二区三区老鸭窝| 国产精品无码永久免费888| 午夜精品影院在线观看| 国产福利一区二区| 欧美精品丝袜久久久中文字幕| 久久久另类综合| 午夜久久久久久久久| 成人精品视频.| 日韩美女视频在线| 一区二区三区国产豹纹内裤在线| 精品无码三级在线观看视频| 欧美优质美女网站| 久久久久国色av免费看影院| 日韩精品一级二级| 色综合天天综合| 国产午夜精品一区二区三区嫩草 | 青青青爽久久午夜综合久久午夜| 成人综合婷婷国产精品久久| 日韩欧美国产成人一区二区| 亚洲综合清纯丝袜自拍| 成人午夜视频免费看| 精品国产人成亚洲区| 亚洲va中文字幕| 91免费看视频| 中文字幕第一页久久| 久久超级碰视频| 欧美日韩国产综合久久| 亚洲男人的天堂在线aⅴ视频| 国产精品自在在线| 欧美电影免费观看高清完整版在线 | 日韩欧美在线不卡| 亚洲自拍偷拍麻豆| 91麻豆免费看| 中文字幕一区二区日韩精品绯色| 极品尤物av久久免费看| 在线播放亚洲一区| 亚洲午夜视频在线观看| 色综合久久综合网97色综合| 中文字幕精品在线不卡| 国产一区啦啦啦在线观看| 欧美成人官网二区| 日本欧美在线观看| 欧美精品在线观看播放| 亚洲一二三区在线观看| 在线亚洲免费视频| 一区二区国产视频| 在线看不卡av| 亚洲综合久久久| 欧美日韩一区二区电影| 亚洲国产一区二区视频| 欧美视频一区二区三区| 一区二区欧美视频| 欧美日韩在线播| 午夜精品久久久久久| 91麻豆精品国产| 日韩1区2区日韩1区2区| 日韩精品在线看片z| 黄页视频在线91| 久久久精品欧美丰满| 成人精品小蝌蚪| 亚洲精品videosex极品| 欧美亚洲免费在线一区| 日韩综合一区二区| 日韩一区二区三区在线观看| 麻豆91免费看| 国产日韩欧美a| 99久久久无码国产精品| 亚洲国产cao| 日韩欧美亚洲另类制服综合在线| 精品一区二区三区视频| 国产农村妇女精品| 99re在线精品| 亚洲成人你懂的| 欧美成人精品二区三区99精品| 国产a精品视频| 一区二区三区在线视频观看58| 欧美视频日韩视频在线观看| 卡一卡二国产精品 | 青青青伊人色综合久久| 久久综合色综合88| 91一区二区三区在线观看| 亚洲国产精品久久久久婷婷884| 91精品免费观看| 国产精品亚洲第一区在线暖暖韩国 | 1024成人网| 欧美日本乱大交xxxxx| 狠狠色综合色综合网络| 中文字幕日韩精品一区| 欧美美女网站色| 国产精品18久久久久久久网站| 亚洲图片欧美激情| 日韩欧美一级二级三级久久久| 成人av在线一区二区三区| 午夜日韩在线电影| 久久久99久久| 欧美日韩国产精品成人| 日韩一区二区三区视频在线观看| 国产精品综合一区二区| 亚洲欧美日韩中文播放| 日韩精品一区二区三区视频在线观看 | 人禽交欧美网站| 国产精品每日更新在线播放网址| 欧美综合一区二区| 国产成人免费av在线| 亚洲第一电影网| 成人免费一区二区三区视频| 欧美久久一二三四区| 成人黄色大片在线观看| 日本美女一区二区三区视频| 日韩理论在线观看| 精品嫩草影院久久| 欧美日韩精品欧美日韩精品一| 国产盗摄精品一区二区三区在线| 五月婷婷欧美视频| 亚洲欧美日韩精品久久久久| 久久蜜臀中文字幕| 制服丝袜一区二区三区|