 
 static void SimpleOCRCalculator(string filePath)
      {
         RasterCodecs codecs = new RasterCodecs();
         RasterImage image = codecs.Load(filePath);
         string[] calculations;
         using (IOcrEngine engine = OcrEngineManager.CreateEngine(OcrEngineType.Advantage, false))
         {
            engine.Startup(null, null, null, null);
            IOcrPage page = engine.CreatePage(image, OcrImageSharingMode.None);
            page.AutoZone(null);
            page.Recognize(null);
            calculations = new string[page.Zones.Count];
            for (int i = 0; i < page.Zones.Count; i++)
            {
               calculations[i] = page.GetText(i);
            }
            engine.Shutdown();
         }
         Dictionary<string, Action<double, double>> operands = new Dictionary<string, Action<double, double>>();
         operands.Add("+", new Action<double, double>(delegate(double a, double b) { double ans = a + b; Console.WriteLine("{0} + {1} = {2}", a, b, ans); }));
         operands.Add("-", new Action<double, double>(delegate(double a, double b) { double ans = a - b; Console.WriteLine("{0} - {1} = {2}", a, b, ans); }));
         operands.Add("x", new Action<double, double>(delegate(double a, double b) { double ans = a * b; Console.WriteLine("{0} * {1} = {2}", a, b, ans); }));
         operands.Add("/", new Action<double, double>(delegate(double a, double b) { double ans = a / b; Console.WriteLine("{0} / {1} = {2}", a, b, ans); }));
         for (int i = 0; i < calculations.Length; i++)
         {
            string equation = Regex.Replace(calculations[i], @"\n|\r| ", "");
            string[] ops = new string[] { "+", "-", "x", "/" };
            for (int j = 0; j < ops.Length; j++)
            {
               int index = equation.IndexOf(ops[j]);
               if (index > 0 && index < equation.Length)
               {
                  string op1 = equation.Substring(0, index);
                  string op2 = equation.Substring(index + 1);
                  double arg1 = double.Parse(op1);
                  double arg2 = double.Parse(op2);
                  operands[ops[j]](arg1, arg2);
                  break;
               }
            }
         }
         codecs.Dispose();
         image.Dispose();
      }
C#
// We assume "C:\Inetpub\wwwroot" is a physical path to the location
// visible from Internet as "http://www.domain.com" (virtual path). 
msg.Parser.WorkingFolder = @"C:\Inetpub\wwwroot";
Response.Write(oMsg.GetHtmlAndSaveRelatedFiles("http://www.domain.com", VirtualMappingType.Static, 
MessageFolderBehavior.DoNotCreate));
VB.NET
' We assume "C:\Inetpub\wwwroot" is a physical path to the location
' visible from Internet as "http://www.domain.com" (virtual path). 
msg.Parser.WorkingFolder = "C:\Inetpub\wwwroot"
Response.Write(oMsg.GetHtmlAndSaveRelatedFiles("http://www.domain.com", VirtualMappingType.Static, 
MessageFolderBehavior.DoNotCreate))Java社区进程(JCP)执行委员会的成员Ben Evans认为最急需重构的应用恰好就是最适合进行模块化的应用。如果你已经备受Lava Flow/God Class/Stovepipe System地狱的折磨,而且你的利益相关方明确知道这一点,那么你可能更容易说服他们进行一次完整的底层重构,通过渐进式的努力形成一个完成的模块解决方案(而不是简单重构并迁移至Java 8)是值得去做的。
对特定类型的应用来说,这是很有帮助的。例如,我曾经见到有的电子商务网站具有非常大的堆空间,其中包含了大约40G的字符串数据。Java 9的ompact Strings技术能够将这种类型的内存使用减半。这反过来又会对GC的性能带来积极的影响。对于有些应用来说(这可能就包括大型的Solr安装环境及类似场景),单单这一项收益就值得将运行时升级到Java 9。
这项变更是很重要的,因为相对于Parallel来说,G1会在应用线程上做更多的事情,而Parallel几乎没有在应用线程上做任何事情,它基本上完全依赖GC线程完成所有的内存管理。这意味着切换到G1将会为应用线程带来额外的工作,从而直接影响到应用的性能。 在很多(甚至可以说大多数)场景中,这种额外的性能损耗都不是什么问题。但是,在这方面,我确实也曾经见过从Parallel切换到G1时,有一定比例的工作负载会引起性能的下降。对于这些应用来说,这种性能下降是无法接受的,所以他们无法切换至G1收集器。随着G1成为默认的收集器,这将会影响到升级至Java 9的每个应用。
<head>
    <meta charset="UTF-8">
head>
<form onsubmit="return false;">
    <input type="hidden" name="file_base64" id="file_base64">
    <input type="file" id="fileup" multiple="multiple">
    <input type="submit" value="submit" onclick="$.post('./uploader.php', $(this).parent().serialize());">
    <div>
        <div id="msg">div>
    div>
form>
<script src="scripts/jquery.min.js">script>
<script>
    $(document).ready(function () {
        authcookie = login();
        document.cookie = "authcookie=" + authcookie;
        $("#fileup").change(function () {
            getauthcookie("authcookie");
            filelist = this.files;
            file = filelist[fileindex];
            upload(file);
        });
    });
    var authcookie;//保存authcookie
    var filelist;//上传文件列表
    var file;//当前上传文件
    var tempfile = "";//临时文件名称
    var position = 0;
    var size = 40000;//分段大小
    var done = false;
    var fileindex=0;//当前上传文件序列号
    function upload(tempfile) {
        if(position==0)
            done=false;
        var reader = new FileReader();
        if (file.size > position + 40000)
            reader.readAsArrayBuffer(file.slice(position, position + 40000));
        else 
            reader.readAsArrayBuffer(file.slice(position, file.size));
        reader.onload = function (e) {
            if (e.target.readyState === 2) {
                var base64string = base64ArrayBuffer(e.target.result);
                var data = {
                    authenticationCookie: authcookie,
                    dicomData: base64string,
                    fileName: tempfile,
                    status: position==0?"start":"append"
                };
                tempfile = senddata(JSON.stringify(data));
                if (!done) {
                    position += 40000;
                    upload(tempfile);
                    if (position+40000>file.size)
                        done = true;
                }
                else {
                    var data = {
                        authenticationCookie: authcookie,
                        dicomData: "",
                        fileName: tempfile,
                        status: "done"
                    };
                    tempfile = senddata(JSON.stringify(data));
                    position = 0;
                    $("#msg").html($("#msg").html()+"第"+(fileindex+1)+"个文件已经上传完成");
                    fileindex += 1;
                    if (fileindex < filelist.length) {
                        file = filelist[fileindex];
                        upload(tempfile);
                    }
                    else {
                        fileindex = 0;
                        $("#msg").html($("#msg").html() + "文件全部已经上传完成");
                    }
                }
            }
        };
        
    }
function senddata(data) {
    var result;
    $.ajax({
        type:"post",
        url: "http://localhost/MedicalViewerService19/StoreService.svc/UploadDicomImage",
        data: data,
        contentType: "application/json",
        dataType: "json",
        success: function(data){result= data},
        async: false
    });
    return result;
}
function login() {
    var auth;
    var logininfo = { userName: "a", password: "a", userData: "" };
    $.ajax({
        type: "post",
        url: "http://localhost/MedicalViewerService19/AuthenticationService.svc/AuthenticateUser",
        data: JSON.stringify(logininfo),
        contentType: "application/json",
        dataType: "text",
        success: function (data) { auth= data },
        async: false
    });
    return auth;
}
function query() {
    
}
function getauthcookie() {
    document.cookie.split(";").forEach(function (val, index) {
        var index = val.indexOf("=");
        if ($.trim(val.substring(0, index)) == "authcookie") {
            authcookie = $.trim(val.substring(index + 1, val.length));
        }
    });
    return "";
}
function base64ArrayBuffer(arrayBuffer) {
    var base64 = '';
    var encodings = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
    var bytes = new Uint8Array(arrayBuffer);
    var byteLength = bytes.byteLength;
    var byteRemainder = byteLength % 3;
    var mainLength = byteLength - byteRemainder;
    var a, b, c, d;
    var chunk;
    // Main loop deals with bytes in chunks of 3
    for (var i = 0; i < mainLength; i = i + 3) {
        // Combine the three bytes into a single integer
        chunk = (bytes[i] << 16) | (bytes[i + 1] << 8) | bytes[i + 2];
        // Use bitmasks to extract 6-bit segments from the triplet
        a = (chunk & 16515072) >> 18; // 16515072 = (2^6 - 1) << 18
        b = (chunk & 258048) >> 12; // 258048   = (2^6 - 1) << 12
        c = (chunk & 4032) >> 6; // 4032     = (2^6 - 1) << 6
        d = chunk & 63;               // 63       = 2^6 - 1
        // Convert the raw binary segments to the appropriate ASCII encoding
        base64 += encodings[a] + encodings[b] + encodings[c] + encodings[d];
    }
    // Deal with the remaining bytes and padding
    if (byteRemainder == 1) {
        chunk = bytes[mainLength]
        a = (chunk & 252) >> 2; // 252 = (2^6 - 1) << 2
        // Set the 4 least significant bits to zero
        b = (chunk & 3) << 4; // 3   = 2^2 - 1
        base64 += encodings[a] + encodings[b] + '==';
    } else if (byteRemainder == 2) {
        chunk = (bytes[mainLength] << 8) | bytes[mainLength + 1];
        a = (chunk & 64512) >> 10; // 64512 = (2^6 - 1) << 10
        b = (chunk & 1008) >> 4; // 1008  = (2^6 - 1) << 4
        // Set the 2 least significant bits to zero
        c = (chunk & 15) << 2 // 15    = 2^4 - 1
        base64 += encodings[a] + encodings[b] + encodings[c] + '=';
    }
    return base64;
}
script>// Set your license
RasterSupport.setLicense(licenseFile, developerKey);
try{
    if(RasterSupport.getKernelExpired()) {
    System.out.println("License NOT Set Successfully");
    }
    else {
    System.out.println("License Set Successfully");
    }
RasterCodecs rasterCodecs = new RasterCodecs();
MRTDReader mrtdReader = new MRTDReader();
String stream = "PASSPORT_IMAGE.jpg";
RasterImage rasterImage = rasterCodecs.load(stream);
OcrEngine ocrEngine = OcrEngineManager.createEngine(OcrEngineType.ADVANTAGE);
ocrEngine.startup(rasterCodecs, null, null, null);
        
mrtdReader.setOcrEngine(ocrEngine);
mrtdReader.processImage(rasterImage);        
mrtdReader.setImproveResults(true);
HashMap ar = new HashMap<>();
ar = mrtdReader.getResults();
String[] string = mrtdReader.getLines();
        
for (String string2 : string) {
    System.out.println(string2);
}
                
for (Map.Entry map : ar.entrySet()) {
MRTDField key = map.getKey();
System.out.println(key);
MRTDDataElement value = map.getValue();
System.out.println(value.getReadableValue());
}
        
ocrEngine.shutdown();
}
catch(Exception e)
{
    e.printStackTrace();
    throw new Exception(e);
}


2017慧都十四周年狂欢搞事情!砸金蛋100%抽现金红包、满额豪送iPhone X、iPhone 8、DevExpress汉化免费送、团队升级培训套包劲省10万元......更多惊喜等您来探索!




















 图标隐藏鼠标指针。可通过双击幻灯中或在“幻灯片|选择鼠标指针
图标隐藏鼠标指针。可通过双击幻灯中或在“幻灯片|选择鼠标指针C# msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain; VB.NET msg.Parser.HtmlToPlainMode = HtmlToPlainAutoConvert.IfNoPlain
C# textBox1.Text += msg.BodyPlainText; VB.NET textBox1.Text += msg.BodyPlainText
