⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.cs

📁 Unicode Optical Character Recognition
💻 CS
📖 第 1 页 / 共 4 页
字号:
			this.groupBox5.Controls.Add(this.label30);
			this.groupBox5.Controls.Add(this.richTextBox1);
			this.groupBox5.Controls.Add(this.button13);
			this.groupBox5.Controls.Add(this.textBox8);
			this.groupBox5.Controls.Add(this.label12);
			this.groupBox5.Controls.Add(this.label11);
			this.groupBox5.Controls.Add(this.label9);
			this.groupBox5.Controls.Add(this.label25);
			this.groupBox5.Controls.Add(this.comboBox3);
			this.groupBox5.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox5.ForeColor = System.Drawing.Color.Crimson;
			this.groupBox5.Location = new System.Drawing.Point(480, 312);
			this.groupBox5.Name = "groupBox5";
			this.groupBox5.Size = new System.Drawing.Size(270, 192);
			this.groupBox5.TabIndex = 27;
			this.groupBox5.TabStop = false;
			this.groupBox5.Text = "Output";
			// 
			// label30
			// 
			this.label30.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.label30.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label30.ForeColor = System.Drawing.Color.Black;
			this.label30.Location = new System.Drawing.Point(80, 6);
			this.label30.Name = "label30";
			this.label30.Size = new System.Drawing.Size(64, 16);
			this.label30.TabIndex = 39;
			this.label30.Text = "   UTF-16";
			// 
			// richTextBox1
			// 
			this.richTextBox1.BackColor = System.Drawing.SystemColors.ControlLight;
			this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.richTextBox1.Location = new System.Drawing.Point(8, 72);
			this.richTextBox1.Name = "richTextBox1";
			this.richTextBox1.ReadOnly = true;
			this.richTextBox1.Size = new System.Drawing.Size(256, 88);
			this.richTextBox1.TabIndex = 38;
			this.richTextBox1.Text = "";
			// 
			// button13
			// 
			this.button13.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.button13.ForeColor = System.Drawing.Color.Black;
			this.button13.Location = new System.Drawing.Point(144, 164);
			this.button13.Name = "button13";
			this.button13.Size = new System.Drawing.Size(120, 24);
			this.button13.TabIndex = 5;
			this.button13.Text = "Save Output";
			this.button13.Click += new System.EventHandler(this.button13_Click);
			// 
			// textBox8
			// 
			this.textBox8.BackColor = System.Drawing.SystemColors.ActiveBorder;
			this.textBox8.Font = new System.Drawing.Font("Microsoft Sans Serif", 20F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.textBox8.Location = new System.Drawing.Point(224, 32);
			this.textBox8.Name = "textBox8";
			this.textBox8.ReadOnly = true;
			this.textBox8.Size = new System.Drawing.Size(40, 38);
			this.textBox8.TabIndex = 3;
			this.textBox8.Text = "";
			// 
			// label12
			// 
			this.label12.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label12.ForeColor = System.Drawing.Color.Black;
			this.label12.Location = new System.Drawing.Point(168, 32);
			this.label12.Name = "label12";
			this.label12.Size = new System.Drawing.Size(64, 16);
			this.label12.TabIndex = 2;
			this.label12.Text = "Symbol :";
			// 
			// label11
			// 
			this.label11.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.label11.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label11.ForeColor = System.Drawing.Color.Black;
			this.label11.Location = new System.Drawing.Point(80, 32);
			this.label11.Name = "label11";
			this.label11.Size = new System.Drawing.Size(64, 16);
			this.label11.TabIndex = 1;
			// 
			// label9
			// 
			this.label9.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label9.ForeColor = System.Drawing.Color.Black;
			this.label9.Location = new System.Drawing.Point(28, 32);
			this.label9.Name = "label9";
			this.label9.Size = new System.Drawing.Size(56, 16);
			this.label9.TabIndex = 0;
			this.label9.Text = "Hex      :";
			// 
			// label25
			// 
			this.label25.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label25.ForeColor = System.Drawing.Color.Black;
			this.label25.Location = new System.Drawing.Point(28, 52);
			this.label25.Name = "label25";
			this.label25.Size = new System.Drawing.Size(52, 16);
			this.label25.TabIndex = 36;
			this.label25.Text = "Binary :";
			// 
			// comboBox3
			// 
			this.comboBox3.BackColor = System.Drawing.SystemColors.InactiveBorder;
			this.comboBox3.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.comboBox3.Location = new System.Drawing.Point(80, 50);
			this.comboBox3.Name = "comboBox3";
			this.comboBox3.Size = new System.Drawing.Size(65, 21);
			this.comboBox3.TabIndex = 37;
			// 
			// groupBox6
			// 
			this.groupBox6.Controls.Add(this.label29);
			this.groupBox6.Controls.Add(this.label28);
			this.groupBox6.Controls.Add(this.label24);
			this.groupBox6.Controls.Add(this.label19);
			this.groupBox6.Controls.Add(this.label18);
			this.groupBox6.Controls.Add(this.button14);
			this.groupBox6.Controls.Add(this.button15);
			this.groupBox6.Font = new System.Drawing.Font("Microsoft Sans Serif", 16F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.groupBox6.ForeColor = System.Drawing.Color.Crimson;
			this.groupBox6.Location = new System.Drawing.Point(8, 0);
			this.groupBox6.Name = "groupBox6";
			this.groupBox6.Size = new System.Drawing.Size(616, 304);
			this.groupBox6.TabIndex = 28;
			this.groupBox6.TabStop = false;
			this.groupBox6.Text = "Testing";
			this.groupBox6.Paint += new System.Windows.Forms.PaintEventHandler(this.groupBox6_Paint);
			// 
			// label29
			// 
			this.label29.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label29.ForeColor = System.Drawing.Color.Black;
			this.label29.Location = new System.Drawing.Point(482, 260);
			this.label29.Name = "label29";
			this.label29.Size = new System.Drawing.Size(16, 16);
			this.label29.TabIndex = 25;
			this.label29.Text = "29";
			// 
			// label28
			// 
			this.label28.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label28.ForeColor = System.Drawing.Color.Black;
			this.label28.Location = new System.Drawing.Point(488, 118);
			this.label28.Name = "label28";
			this.label28.Size = new System.Drawing.Size(8, 16);
			this.label28.TabIndex = 24;
			this.label28.Text = "0";
			// 
			// label24
			// 
			this.label24.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label24.ForeColor = System.Drawing.Color.Black;
			this.label24.Location = new System.Drawing.Point(586, 272);
			this.label24.Name = "label24";
			this.label24.Size = new System.Drawing.Size(16, 16);
			this.label24.TabIndex = 23;
			this.label24.Text = "19";
			// 
			// label19
			// 
			this.label19.Font = new System.Drawing.Font("Microsoft Sans Serif", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label19.ForeColor = System.Drawing.Color.Black;
			this.label19.Location = new System.Drawing.Point(496, 272);
			this.label19.Name = "label19";
			this.label19.Size = new System.Drawing.Size(16, 16);
			this.label19.TabIndex = 22;
			this.label19.Text = "0";
			// 
			// label18
			// 
			this.label18.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
			this.label18.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.label18.ForeColor = System.Drawing.Color.Blue;
			this.label18.Location = new System.Drawing.Point(104, 6);
			this.label18.Name = "label18";
			this.label18.Size = new System.Drawing.Size(240, 16);
			this.label18.TabIndex = 21;
			// 
			// button14
			// 
			this.button14.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.button14.ForeColor = System.Drawing.Color.Blue;
			this.button14.Location = new System.Drawing.Point(248, 272);
			this.button14.Name = "button14";
			this.button14.Size = new System.Drawing.Size(96, 24);
			this.button14.TabIndex = 0;
			this.button14.Text = "Start";
			this.button14.Click += new System.EventHandler(this.button14_Click);
			// 
			// button15
			// 
			this.button15.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
			this.button15.ForeColor = System.Drawing.Color.Black;
			this.button15.Location = new System.Drawing.Point(496, 38);
			this.button15.Name = "button15";
			this.button15.Size = new System.Drawing.Size(104, 26);
			this.button15.TabIndex = 20;
			this.button15.Text = "Load Network";
			this.button15.Click += new System.EventHandler(this.button15_Click);
			// 
			// button5
			// 
			this.button5.Location = new System.Drawing.Point(660, 12);
			this.button5.Name = "button5";
			this.button5.Size = new System.Drawing.Size(88, 24);
			this.button5.TabIndex = 29;
			this.button5.Text = "About";
			this.button5.Click += new System.EventHandler(this.button5_Click);
			// 
			// button6
			// 
			this.button6.Location = new System.Drawing.Point(660, 40);
			this.button6.Name = "button6";
			this.button6.Size = new System.Drawing.Size(88, 24);
			this.button6.TabIndex = 30;
			this.button6.Text = "Exit";
			this.button6.Click += new System.EventHandler(this.button6_Click);
			// 
			// saveFileDialog1
			// 
			this.saveFileDialog1.DefaultExt = "ann";
			// 
			// Form1
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.BackColor = System.Drawing.SystemColors.ActiveBorder;
			this.ClientSize = new System.Drawing.Size(754, 512);
			this.Controls.Add(this.button6);
			this.Controls.Add(this.button5);
			this.Controls.Add(this.groupBox5);
			this.Controls.Add(this.groupBox4);
			this.Controls.Add(this.label8);
			this.Controls.Add(this.label10);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.comboBox1);
			this.Controls.Add(this.label5);
			this.Controls.Add(this.groupBox1);
			this.Controls.Add(this.button3);
			this.Controls.Add(this.pictureBox2);
			this.Controls.Add(this.button2);
			this.Controls.Add(this.pictureBox1);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox6);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.MaximizeBox = false;
			this.Name = "Form1";
			this.Text = "Unicode OCR - Daniel Admassu";
			this.Paint += new System.Windows.Forms.PaintEventHandler(this.Form1_Paint);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox3.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
			this.groupBox5.ResumeLayout(false);
			this.groupBox6.ResumeLayout(false);
			this.ResumeLayout(false);

		}
		#endregion

		/// <summary>
		/// The main entry point for the application.
		/// </summary>
		[STAThread]
		static void Main() 
		{
			Application.Run(new Form1());			
		}		
		private void button2_Click(object sender, System.EventArgs e)
		{									
			load_image();
		}
		private void button3_Click(object sender, System.EventArgs e)
		{
			detect_next_character();			
		}
		private void button14_Click(object sender, System.EventArgs e)
		{	
			output_string="";
			current_line=0;
			while(character_present)
				detect_next_character();		
		}	
		private void button1_Click(object sender, System.EventArgs e)
		{	
			load_character_trainer_set();			
		}
		private void button7_Click(object sender, System.EventArgs e)
		{
			save_network();
		}
		private void button15_Click(object sender, System.EventArgs e)
		{
			load_network();
		}
		private void button13_Click(object sender, System.EventArgs e)
		{
			save_output();
		}

	////////////////////////////////////////////////////////////////////////////////////
	////                    IMAGE ANALYSIS AND MANIPULATION CODE                   /////
	////////////////////////////////////////////////////////////////////////////////////
	////////////////////////////////////////////////////////////////////////////////////
	
		
		public void load_character_trainer_set()
		{	
			string line;
			openFileDialog1.Filter = "Character Trainer Set (*.cts)|*.cts" ;
			if(openFileDialog1.ShowDialog() == DialogResult.OK)
			{				
				character_trainer_set_file_stream = new	System.IO.StreamReader(openFileDialog1.FileName);				
				trainer_string="";
				while((line=character_trainer_set_file_stream.ReadLine ())!=null)
					trainer_string=trainer_string+line;																	
				number_of_input_sets=trainer_string.Length ;
				character_trainer_set_file_name=Path.GetFileNameWithoutExtension(openFileDialog1.FileName );
				character_trainer_set_file_path=Path.GetDirectoryName(openFileDialog1.FileName);
				label20.Text =character_trainer_set_file_name;
				character_trainer_set_file_stream.Close();

				image_file_name=character_trainer_set_file_path + "\\"+ character_trainer_set_file_name + ".bmp";
				image_file_stream =new System.IO.StreamReader(image_file_name);
				input_image=new Bitmap (image_file_name);
				pictureBox1.Image =input_image;	
				input_image_height=input_image.Height ;
				input_image_width=input_image.Width ;
				if(input_image_width>pictureBox1.Width ) 
					pictureBox1.SizeMode= PictureBoxSizeMode.StretchImage;
				else
					pictureBox1.SizeMode= PictureBoxSizeMode.Normal;
				right=1;
				image_start_pixel_x=0;
				image_start_pixel_y=0;
				identify_lines();
				current_line=0;
				character_present=true;
				character_valid=true;
				output_string="";				
				label5.Text ="Input Image : ["+character_trainer_set_file_name+".bmp]";
			}
		}
		public void load_image()
		{
			openFileDialog1.Filter = "Bitmap Image (*.bmp)|*.bmp" ;
			if(openFileDialog1.ShowDialog() == DialogResult.OK)
			{				
				System.IO.StreamReader image_file_stream = new	System.IO.StreamReader(openFileDialog1.FileName);				
				input_image=new Bitmap (openFileDialog1.FileName);		
				pictureBox1.Image =input_image;								

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -