資源簡介
C#抓屏識別漢字,調用微軟MODI, 已解決OCR running error問題

代碼片段和文件信息
using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?System.IO;
using?System.Drawing.Imaging;
using?System.Drawing.Drawing2D;
using?System.Threading;
using?System.Data.OleDb;
//using?System.IO.MemoryMappedFiles;
//using?System.Runtime.InteropServices;
//using?System.Threading.Tasks;
namespace?mergebmp
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????MyWin?m_WindowDlg;
????????public?static??Image?imgBack;
???
????????///?
????????///?合并圖片
????????public?static?Bitmap?CombinImage(Image?imgBack?Image?img?int?xDeviation?=?0?int?yDeviation?=?0)
????????{
????????????Bitmap?bmp?=?new?Bitmap(imgBack.Width?imgBack.Height);
????????????Graphics?g?=?Graphics.FromImage(bmp);
????????????g.Clear(Color.White);
????????????g.DrawImage(imgBack?0?0?imgBack.Width?imgBack.Height);
????????????g.DrawImage(img?0??0?img.Width?img.Height);
????????????GC.Collect();
????????????return?bmp;
????????}
????????private?void?button2_Click(object?sender?EventArgs?e)
????????{
????????????Thread_Time.Dispose();??
????????????return;
????????}
????????public?static?Image?Rescale(Image?image?int?dpiX?int?dpiY)
????????{
????????????Bitmap?bm?=?new?Bitmap((int)(image.Width?*?dpiX?/?image.HorizontalResolution)?(int)(image.Height?*?dpiY?/?image.VerticalResolution));
????????????bm.SetResolution(dpiX?dpiY);
????????????Graphics?g?=?Graphics.FromImage(bm);
????????????g.InterpolationMode?=?InterpolationMode.Bicubic;
????????????g.PixelOffsetMode?=?PixelOffsetMode.HighQuality;
????????????g.DrawImage(image?0?0);
????????????g.Dispose();
????????????return?bm;
????????}
????????private?static?System.Drawing.Image?resizeImage(System.Drawing.Image?imgToResize?Size?size)
????????{
????????????//獲取圖片寬度
????????????int?sourceWidth?=?imgToResize.Width;
????????????//獲取圖片高度
????????????int?sourceHeight?=?imgToResize.Height;
????????????float?nPercent?=?0;
????????????float?nPercentW?=?0;
????????????float?nPercentH?=?0;
????????????//計算寬度的縮放比例
????????????nPercentW?=?((float)size.Width?/?(float)sourceWidth);
????????????//計算高度的縮放比例
????????????nPercentH?=?((float)size.Height?/?(float)sourceHeight);
????????????if?(nPercentH?????????????????nPercent?=?nPercentH;
????????????else
????????????????nPercent?=?nPercentW;
????????????//期望的寬度
????????????int?destWidth?=?(int)(sourceWidth?*?nPercent);
????????????//期望的高度
????????????int?destHeight?=?(int)(sourceHeight?*?nPercent);
????????????Bitmap?b?=?new?Bitmap(destWidth?destHeight);
????????????Graphics?g?=?Graphics.FromImage((System.Drawing.Image)b);
????????????g.InterpolationMode?=?InterpolationMode.HighQualityBicubic;
????????????//繪制圖像
????????????g.DrawImage(imgToResize?0?0?de
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????11541??2019-01-07?16:09??Form1.Designer.cs
?????文件????????5817??2019-01-07?16:09??Form1.resx
?????文件????????7173??2018-12-22?21:37??GrayBMP_File.cs
?????文件?????????714??2016-05-07?19:12??ImageConverter.cs
?????文件???????28977??2019-01-07?16:08??ImageHelper.cs
?????文件?????????478??2018-12-25?12:20??mergebmp.csproj.user
?????文件????????3588??2018-12-22?17:29??MyWin.cs
?????文件????????1943??2018-12-22?17:29??MyWin.Designer.cs
?????文件????????5814??2018-12-22?10:24??MyWin.resx
?????文件?????????489??2018-12-21?21:15??Program.cs
?????文件????????7590??2019-01-07?16:28??testbmp.csproj
?????目錄???????????0??2019-01-07?16:30??bin\Debug\
?????文件???????35328??2019-01-07?16:28??bin\Debug\mergebmp.exe
?????文件???????60928??2019-01-07?16:28??bin\Debug\mergebmp.pdb
?????文件???????11600??2019-01-07?16:30??bin\Debug\mergebmp.vshost.exe
?????文件?????????490??2010-03-17?22:39??bin\Debug\mergebmp.vshost.exe.manifest
?????文件????????3320??2019-01-07?16:28??bin\Debug\temp2831956.tif
?????文件????????3648??2019-01-07?16:30??bin\Debug\temp3019909.tif
?????目錄???????????0??2019-01-07?16:28??obj\Debug\
?????文件????????6463??2019-01-07?16:30??obj\Debug\DesignTimeResolveAssemblyReferencesInput.cache
?????文件?????????596??2019-01-07?16:28??obj\Debug\GenerateResource.read.1.tlog
?????文件????????1524??2019-01-07?16:28??obj\Debug\GenerateResource.write.1.tlog
?????文件???????33280??2019-01-07?16:26??obj\Debug\Interop.MODI.dll
?????文件???????35328??2019-01-07?16:28??obj\Debug\mergebmp.exe
?????文件?????????180??2019-01-07?16:28??obj\Debug\mergebmp.Form1.resources
?????文件?????????180??2019-01-07?16:28??obj\Debug\mergebmp.MyWin.resources
?????文件???????60928??2019-01-07?16:28??obj\Debug\mergebmp.pdb
?????文件????????2784??2019-01-07?16:28??obj\Debug\mergebmp.Properties.Resources.resources
?????目錄???????????0??2019-01-07?16:28??obj\Debug\TempPE\
?????文件????????4608??2019-01-07?16:28??obj\Debug\TempPE\Properties.Resources.Designer.cs.dll
?????文件????????1010??2019-01-07?16:30??obj\Debug\testbmp.csproj.FileListAbsolute.txt
............此處省略11個文件信息
評論
共有 條評論