菜鸟教程小白 发表于 2022-12-13 05:36:40

ios - 我们如何检测和保存写在 iPhone/iPad 触摸屏上的文本?


                                            <p><div>
            <aside class="s-notice s-notice__info post-notice js-post-notice mb16"role="status">
      <div class="d-flex fd-column fw-nowrap">
            <div class="d-flex fw-nowrap">
                <div class="flex--item wmn0 fl1 lh-lg">
                  <div class="flex--item fl1 lh-lg">
                        <b>已结束。</b>此问题不符合 <a href="https://stackoverflow.com/help/closed-questions" rel="noreferrer noopener nofollow">Stack Overflow guidelines</a> .它目前不接受答案。
                        
                  <br><hr><h1><strong>Best Answer-推荐答案</ strong></h1><br>
                                            <p><p>你的问题很高级,所以我会建议你可以追查的高级方法。</p>

<p>1) 从应用程序中,您必须实现手势识别器,例如 </p>

<pre><code>– touchesBegan:withEvent:
– touchesMoved:withEvent:
– touchesEnded:withEvent:
</code></pre>

<p>2) 这将为您提供用户触摸的坐标或路径。使用</p>将它们转换为内存位图

<pre><code>CGContextRef con = CGBitmapContextCreate(NULL,,rgbColorSpace, kCGImageAlphaPremultipliedFirst);
</code></pre>

<p>3) 使用从 Step1 捕获的路径,通过 CoreGraphics 函数绘制位图上下文。最后你会得到一个 UIImage。</p>

<p>4) 使用 OCR,例如 <a href="https://code.google.com/p/tesseract-ocr/" rel="noreferrer noopener nofollow">Tesseract</a>从图像中获取文本,你应该已经准备好了。</p>

<p>祝你好运!</p></p>
                                   
                                                <p style="font-size: 20px;">关于ios - 我们如何检测和保存写在 iPhone/iPad 触摸屏上的文本?,我们在Stack Overflow上找到一个类似的问题:
                                                        <a href="https://stackoverflow.com/questions/20469780/" rel="noreferrer noopener nofollow" style="color: red;">
                                                                https://stackoverflow.com/questions/20469780/
                                                        </a>
                                                </p>
                                       
页: [1]
查看完整版本: ios - 我们如何检测和保存写在 iPhone/iPad 触摸屏上的文本?