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

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

?? finderpattern.cs

?? 可以自動調(diào)用手機的攝像頭以當(dāng)作二維碼掃描頭來使用
?? CS
?? 第 1 頁 / 共 2 頁
字號:
using System;
using QRCodeDecoder = ThoughtWorks.QRCode.Codec.QRCodeDecoder;
using ThoughtWorks.QRCode.Codec.Reader;
using FinderPatternNotFoundException = ThoughtWorks.QRCode.ExceptionHandler.FinderPatternNotFoundException;
using InvalidVersionInfoException = ThoughtWorks.QRCode.ExceptionHandler.InvalidVersionInfoException;
using InvalidVersionException = ThoughtWorks.QRCode.ExceptionHandler.InvalidVersionException;
using VersionInformationException = ThoughtWorks.QRCode.ExceptionHandler.VersionInformationException;
using ThoughtWorks.QRCode.Geom;
using ThoughtWorks.QRCode.Codec.Util;

namespace ThoughtWorks.QRCode.Codec.Reader.Pattern
{
	
	public class FinderPattern
	{
        public const int UL = 0;
        public const int UR = 1;
        public const int DL = 2;

        internal static readonly int[] VersionInfoBit = new int[] { 0x07C94, 0x085BC, 0x09A99, 0x0A4D3, 0x0BBF6, 0x0C762, 0x0D847, 0x0E60D, 0x0F928, 0x10B78, 0x1145D, 0x12A17, 0x13532, 0x149A6, 0x15683, 0x168C9, 0x177EC, 0x18EC4, 0x191E1, 0x1AFAB, 0x1B08E, 0x1CC1A, 0x1D33F, 0x1ED75, 0x1F250, 0x209D5, 0x216F0, 0x228BA, 0x2379F, 0x24B0B, 0x2542E, 0x26A64, 0x27541, 0x28C69 };

        internal static DebugCanvas canvas;
        internal Point[] center;
        internal int version;
        internal int[] sincos;
        internal int[] width;
        internal int[] moduleSize;

		virtual public int Version
		{
			get
			{
				return version;
			}
			
		}
		virtual public int SqrtNumModules
		{
			get
			{
				return 17 + 4 * version;
			}
			
		}
		
		public static FinderPattern findFinderPattern(bool[][] image)
		{
			Line[] lineAcross = findLineAcross(image);
			Line[] lineCross = findLineCross(lineAcross);
			Point[] center = null;
			try
			{
				center = getCenter(lineCross);
			}
			catch (FinderPatternNotFoundException e)
			{
				throw e;
			}
			int[] sincos = getAngle(center);
			center = sort(center, sincos);
			int[] width = getWidth(image, center, sincos);
			// moduleSize for version recognition
			int[] moduleSize = new int[]{(width[UL] << QRCodeImageReader.DECIMAL_POINT) / 7, (width[UR] << QRCodeImageReader.DECIMAL_POINT) / 7, (width[DL] << QRCodeImageReader.DECIMAL_POINT) / 7};
			int version = calcRoughVersion(center, width);
			if (version > 6)
			{
				try
				{
					version = calcExactVersion(center, sincos, moduleSize, image);
				}
				catch (VersionInformationException e)
				{
					//use rough version data
					// throw e;
				}
			}
			return new FinderPattern(center, version, sincos, width, moduleSize);
		}
		
		internal FinderPattern(Point[] center, int version, int[] sincos, int[] width, int[] moduleSize)
		{
			this.center = center;
			this.version = version;
			this.sincos = sincos;
			this.width = width;
			this.moduleSize = moduleSize;
		}
		
		public virtual Point[] getCenter()
		{
			return center;
		}
		
		public virtual Point getCenter(int position)
		{
			if (position >= UL && position <= DL)
				return center[position];
			else
				return null;
		}
		
		public virtual int getWidth(int position)
		{
			return width[position];
		}
		
		public virtual int[] getAngle()
		{
			return sincos;
		}
		
		public virtual int getModuleSize()
		{
			return moduleSize[UL];
		}
		public virtual int getModuleSize(int place)
		{
			return moduleSize[place];
		}
				
		internal static Line[] findLineAcross(bool[][] image)
		{
			int READ_HORIZONTAL = 0;
			int READ_VERTICAL = 1;
			
			int imageWidth = image.Length;
			int imageHeight = image[0].Length;
			
			//int currentX = 0, currentY = 0;
			Point current = new Point();
			System.Collections.ArrayList lineAcross = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			
			//buffer contains recent length of modules which has same brightness
			int[] lengthBuffer = new int[5];
			int bufferPointer = 0;
			
			int direction = READ_HORIZONTAL; //start to read horizontally
			bool lastElement = QRCodeImageReader.POINT_LIGHT;
			
			while (true)
			{
				//check points in image
				bool currentElement = image[current.X][current.Y];
				if (currentElement == lastElement)
				{
					//target point has same brightness with last point
					lengthBuffer[bufferPointer]++;
				}
				else
				{
					//target point has different brightness with last point
					if (currentElement == QRCodeImageReader.POINT_LIGHT)
					{
						if (checkPattern(lengthBuffer, bufferPointer))
						{
							//detected pattern
							int x1, y1, x2, y2;
							if (direction == READ_HORIZONTAL)
							{
								//obtain X coordinates of both side of the detected horizontal pattern
								x1 = current.X;
								for (int j = 0; j < 5; j++)
								{
									x1 -= lengthBuffer[j];
								}
								x2 = current.X - 1; //right side is last X coordinate
								y1 = y2 = current.Y;
							}
							else
							{
								x1 = x2 = current.X;
								//obtain Y coordinates of both side of the detected vertical pattern
								// upper side is sum of length of buffer
								y1 = current.Y;
								for (int j = 0; j < 5; j++)
								{
									y1 -= lengthBuffer[j];
								}
								y2 = current.Y - 1; // bottom side is last Y coordinate
							}
							lineAcross.Add(new Line(x1, y1, x2, y2));
						}
					}
					bufferPointer = (bufferPointer + 1) % 5;
					lengthBuffer[bufferPointer] = 1;
					lastElement = !lastElement;
				}
				
				// determine if read next, change read direction or terminate this loop
				if (direction == READ_HORIZONTAL)
				{
					if (current.X < imageWidth - 1)
					{
						current.translate(1, 0);
					}
					else if (current.Y < imageHeight - 1)
					{
						current.set_Renamed(0, current.Y + 1);
						lengthBuffer = new int[5];
					}
					else
					{
						current.set_Renamed(0, 0); //reset target point
						lengthBuffer = new int[5];
						direction = READ_VERTICAL; //start to read vertically
					}
				}
				else
				{
					//reading vertically
					if (current.Y < imageHeight - 1)
						current.translate(0, 1);
					else if (current.X < imageWidth - 1)
					{
						current.set_Renamed(current.X + 1, 0);
						lengthBuffer = new int[5];
					}
					else
					{
						break;
					}
				}
			}
			
			Line[] foundLines = new Line[lineAcross.Count];
			
			for (int i = 0; i < foundLines.Length; i++)
				foundLines[i] = (Line) lineAcross[i];
			
			canvas.drawLines(foundLines, ThoughtWorks.QRCode.Codec.Util.Color_Fields.LIGHTGREEN);
			return foundLines;
		}
		
		internal static bool checkPattern(int[] buffer, int pointer)
		{
			int[] modelRatio = new int[]{1, 1, 3, 1, 1};
			
			int baselength = 0;
			for (int i = 0; i < 5; i++)
			{
				baselength += buffer[i];
			}
			// pseudo fixed point calculation. I think it needs smarter code
			baselength <<= QRCodeImageReader.DECIMAL_POINT;
			baselength /= 7;
			int i2;
			for (i2 = 0; i2 < 5; i2++)
			{
				int leastlength = baselength * modelRatio[i2] - baselength / 2;
				int mostlength = baselength * modelRatio[i2] + baselength / 2;
				
				//TODO rough finder pattern detection
				
				int targetlength = buffer[(pointer + i2 + 1) % 5] << QRCodeImageReader.DECIMAL_POINT;
				if (targetlength < leastlength || targetlength > mostlength)
				{
					return false;
				}
			}
			return true;
		}
		
		
		//obtain lines cross at the center of Finder Patterns
		
		internal static Line[] findLineCross(Line[] lineAcross)
		{
			System.Collections.ArrayList crossLines = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			System.Collections.ArrayList lineNeighbor = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			System.Collections.ArrayList lineCandidate = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
			Line compareLine;
			for (int i = 0; i < lineAcross.Length; i++)
				lineCandidate.Add(lineAcross[i]);
			
			for (int i = 0; i < lineCandidate.Count - 1; i++)
			{
				lineNeighbor.Clear();
				lineNeighbor.Add(lineCandidate[i]);
				for (int j = i + 1; j < lineCandidate.Count; j++)
				{
					if (Line.isNeighbor((Line) lineNeighbor[lineNeighbor.Count - 1], (Line) lineCandidate[j]))
					{
						lineNeighbor.Add(lineCandidate[j]);
						compareLine = (Line) lineNeighbor[lineNeighbor.Count - 1];
						if (lineNeighbor.Count * 5 > compareLine.Length && j == lineCandidate.Count - 1)
						{
							crossLines.Add(lineNeighbor[lineNeighbor.Count / 2]);
							for (int k = 0; k < lineNeighbor.Count; k++)
								lineCandidate.Remove(lineNeighbor[k]);
						}
					}
					//terminate comparison if there are no possibility for found neighbour lines
					else if (cantNeighbor((Line) lineNeighbor[lineNeighbor.Count - 1], (Line) lineCandidate[j]) || (j == lineCandidate.Count - 1))
					{
						compareLine = (Line) lineNeighbor[lineNeighbor.Count - 1];
						/*
						* determine lines across Finder Patterns when number of neighbour lines are 
						* bigger than 1/6 length of theirselves
						*/
						if (lineNeighbor.Count * 6 > compareLine.Length)
						{
							crossLines.Add(lineNeighbor[lineNeighbor.Count / 2]);
							for (int k = 0; k < lineNeighbor.Count; k++)
							{
								lineCandidate.Remove(lineNeighbor[k]);
							}
						}
						break;
					}
				}
			}
			
			Line[] foundLines = new Line[crossLines.Count];
			for (int i = 0; i < foundLines.Length; i++)
			{
				foundLines[i] = (Line) crossLines[i];
			}
			return foundLines;
		}
		
		internal static bool cantNeighbor(Line line1, Line line2)
		{
			if (Line.isCross(line1, line2))
				return true;
			
			if (line1.Horizontal)
			{
				if (System.Math.Abs(line1.getP1().Y - line2.getP1().Y) > 1)
					return true;
				else
					return false;
			}
			else
			{
				if (System.Math.Abs(line1.getP1().X - line2.getP1().X) > 1)
					return true;
				else
					return false;
			}
		}
		
		//obtain slope of symbol
		internal static int[] getAngle(Point[] centers)
		{
			
			Line[] additionalLine = new Line[3];
			
			for (int i = 0; i < additionalLine.Length; i++)
			{
				additionalLine[i] = new Line(centers[i], centers[(i + 1) % additionalLine.Length]);
			}
			// remoteLine - does not contain UL center
			Line remoteLine = Line.getLongest(additionalLine);
			Point originPoint = new Point();
			for (int i = 0; i < centers.Length; i++)
			{
				if (!remoteLine.getP1().equals(centers[i]) && !remoteLine.getP2().equals(centers[i]))
				{
					originPoint = centers[i];
					break;
				}
			}
			canvas.println("originPoint is: " + originPoint);
			Point remotePoint = new Point();
			
			//with origin that the center of Left-Up Finder Pattern, determine other two patterns center.
			//then calculate symbols angle
			if (originPoint.Y <= remoteLine.getP1().Y & originPoint.Y <= remoteLine.getP2().Y)
				if (remoteLine.getP1().X < remoteLine.getP2().X)
					remotePoint = remoteLine.getP2();
				else
					remotePoint = remoteLine.getP1();

?? 快捷鍵說明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美三级视频在线观看| 日本中文在线一区| 成人听书哪个软件好| 久久精品视频在线看| 国产一区二区三区国产| 中日韩免费视频中文字幕| 成人h动漫精品一区二区| 亚洲三级小视频| 色av成人天堂桃色av| 亚洲不卡av一区二区三区| 欧美精品色一区二区三区| 久久精品国产精品亚洲红杏| 国产欧美日韩精品a在线观看| 99这里只有久久精品视频| 一区二区三区久久| 91精品国产全国免费观看| 国产一区二区精品久久91| 亚洲丝袜另类动漫二区| 欧美日本一区二区三区| 国产一本一道久久香蕉| 成人欧美一区二区三区| 在线成人午夜影院| 国产99久久久久久免费看农村| 亚洲少妇30p| 日韩欧美国产午夜精品| 国产福利一区二区三区视频| 亚洲欧美二区三区| 日韩一区二区视频| 91在线视频观看| 美女视频黄久久| 亚洲免费电影在线| 日韩欧美一二三区| 91黄色免费版| 国产精品123| 日韩 欧美一区二区三区| 欧美国产精品v| 日韩一级欧美一级| 99久久久国产精品| 狠狠色丁香婷婷综合久久片| 一区二区三区精密机械公司| 日本一区二区视频在线| 777色狠狠一区二区三区| a在线欧美一区| 蜜臀av在线播放一区二区三区| 亚洲少妇最新在线视频| 国产亚洲一区二区三区四区| 69久久夜色精品国产69蝌蚪网| 成人av在线网| 国产精品18久久久久久久久| 午夜精品久久久久久久久久久 | 国产精品99久久久久久久女警 | 久久精品国产亚洲高清剧情介绍 | 麻豆91小视频| 亚洲国产精品久久久久秋霞影院| 欧美激情一区二区三区四区| 精品国产露脸精彩对白| 欧美日本不卡视频| 一本高清dvd不卡在线观看| 国产老妇另类xxxxx| 麻豆91精品91久久久的内涵| 亚洲www啪成人一区二区麻豆 | 日韩av中文在线观看| 亚洲尤物视频在线| 亚洲日本va在线观看| 国产精品天天看| 国产欧美日韩精品一区| 久久精品亚洲麻豆av一区二区| 精品裸体舞一区二区三区| 日韩一级在线观看| 91精品国产综合久久久久久久| 欧美日韩精品欧美日韩精品一综合| 色久综合一二码| 91成人免费在线视频| 色综合久久99| 在线免费不卡电影| 色婷婷综合久久久久中文 | 亚洲国产精品高清| 久久精品人人做人人综合 | 秋霞电影网一区二区| 日韩中文字幕91| 三级久久三级久久| 青青青爽久久午夜综合久久午夜| 日韩中文欧美在线| 卡一卡二国产精品| 九九**精品视频免费播放| 狠狠久久亚洲欧美| 国产乱码精品一区二区三区五月婷| 国产成人aaa| 91美女片黄在线观看| 在线观看国产精品网站| 欧美肥胖老妇做爰| 精品黑人一区二区三区久久| 国产校园另类小说区| 久久久久久免费毛片精品| 国产清纯白嫩初高生在线观看91| 日韩理论片网站| 亚洲成a天堂v人片| 久久99精品网久久| 国产成人av影院| av福利精品导航| 欧美日韩国产高清一区二区| 欧美一级高清大全免费观看| 久久精品一区二区三区不卡 | 亚洲国产成人午夜在线一区| 最近中文字幕一区二区三区| 亚洲电影视频在线| 极品少妇一区二区三区精品视频 | 欧美顶级少妇做爰| 久久夜色精品国产欧美乱极品| 最新成人av在线| 日韩高清一级片| 处破女av一区二区| 欧美群妇大交群的观看方式| 亚洲精品一区二区三区香蕉| 亚洲免费看黄网站| 蜜乳av一区二区| 91丝袜美腿高跟国产极品老师 | 久久精品水蜜桃av综合天堂| 亚洲精品福利视频网站| 国产做a爰片久久毛片| 色综合亚洲欧洲| 精品国产欧美一区二区| 一区二区免费看| 国产精品一区二区不卡| 欧美体内she精高潮| 久久久久久9999| 亚洲国产精品久久久久秋霞影院| 国产福利一区在线观看| 欧美日韩国产影片| 中文字幕免费不卡在线| 麻豆国产一区二区| 91搞黄在线观看| 国产欧美精品一区aⅴ影院| 天天综合色天天综合色h| 成人免费视频caoporn| 日韩欧美综合一区| 一区二区三区精密机械公司| 成人一区二区三区视频在线观看| 欧美剧情片在线观看| 综合久久给合久久狠狠狠97色| 国产原创一区二区| 91精品国产综合久久福利| 亚洲欧美国产毛片在线| 成人性视频免费网站| 26uuu久久天堂性欧美| 日韩精品一二区| 欧美日韩一区中文字幕| 亚洲日本电影在线| 99精品视频在线观看| 国产午夜精品久久久久久免费视| 久久99精品久久久久久国产越南| 欧美日本一区二区三区| 亚洲一区二区三区在线| 色婷婷久久久久swag精品 | 蜜臀久久久久久久| 欧美日本一区二区三区四区| 亚洲综合图片区| 在线亚洲一区观看| 亚洲激情六月丁香| av欧美精品.com| 亚洲欧洲一区二区在线播放| 成人黄色免费短视频| 国产精品卡一卡二卡三| 成人av在线网| 亚洲色图在线视频| 91视视频在线观看入口直接观看www| 国产精品午夜免费| 成人av网址在线| 亚洲欧美中日韩| 91香蕉视频mp4| 亚洲视频一区在线| 色屁屁一区二区| 亚洲国产精品麻豆| 欧美一区二区高清| 麻豆国产精品777777在线| 欧美精品一区二区三区四区| 国产精品一卡二卡| 国产精品传媒视频| 色婷婷久久久亚洲一区二区三区| 亚洲精品视频一区| 91精品中文字幕一区二区三区| 日本va欧美va精品| 久久综合久久综合亚洲| 国产麻豆成人精品| 18涩涩午夜精品.www| 在线中文字幕不卡| 日本人妖一区二区| 久久久久国产精品人| 成人av先锋影音| 午夜一区二区三区在线观看| 日韩免费观看2025年上映的电影| 国产一区二区视频在线播放| 国产精品成人在线观看| 欧美日韩卡一卡二| 久久精品国产秦先生| 中文字幕av一区 二区| 972aa.com艺术欧美| 日韩va亚洲va欧美va久久| 国产午夜亚洲精品午夜鲁丝片| 欧洲一区二区三区免费视频|