我正在使用ZBar SDK for iPhone来扫描条形码.我希望读者只扫描一个特定的矩形而不是整个视图,这样做需要将阅读器的scanCrop属性设置为所需的矩形.
我很难理解必须设置的矩形参数.
有人可以告诉我,我应该给作为参数什么矩形如果对肖像查看其坐标是:CGRectMake( A, B, C, D )?
我正在尝试使用NTwain库与C#的兼容TWAIN的多功能打印机和扫描仪,Canon Pixma MG5750进行交互.我正在编写一个程序来将图像扫描到一个Image对象中.
在扫描图像之前扫描仪必须预热; 这样做时会显示以下弹出窗口:
完成此过程后,它将开始扫描文档.
虽然该程序确实有效,但问题在于,这种预热过程有时需要很长时间,没有明显的原因,最多几分钟.使用佳能自己的应用程序IJ扫描实用程序时,这个问题永远不会发生,它使用TWAIN并显示相同的对话框,但仅持续几秒钟.
我可以使用TWAIN功能来提高预热过程的速度吗?我试着改变ICapXResolution和ICapYResolution,但这些只会增加实际扫描的速度暖起来后,只要不影响热身本身.
我的程序如下所示.请注意,它是一个控制台应用程序,因此使用ThreadPool.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using NTwain;
using NTwain.Data;
using System.Drawing;
using System.Threading;
namespace TwainExample
{
class Program
{
[STAThread]
static void Main(string[] args)
{
ThreadPool.QueueUserWorkItem(o => TwainWork());
Console.ReadLine();
}
static void TwainWork()
{
var identity = TWIdentity.CreateFromAssembly(DataGroups.Image, Assembly.GetEntryAssembly());
var twain = new TwainSession(identity);
twain.Open();
twain.DataTransferred += (s, e) => …Run Code Online (Sandbox Code Playgroud) 我希望Java能够扫描特定颜色的屏幕.
任何想法,如果这样做?
WIA通过馈线扫描
这是我的设备属性:
Document Handling Select = 1 (2 is for flatbed, and 1 is for the feeder.)
Run Code Online (Sandbox Code Playgroud)
这是我的项目(页面)属性:
Horizontal Resolution = 150
Vertical Resolution = 150
Horizontal Extent = 500 (I want to get it first to work, then I'll play with the extents.),
Vertical Extent = 500
Bits Per Pixel = 8
Current Intent = 4
Run Code Online (Sandbox Code Playgroud)
如果我将"文档处理选择"设置为"2",我可以顺利运行一切.当我将它设置为"1"并运行它时,就在我说item.Transfer()(或item.Transfer(bmp/jpeg/pngGuid))之前我得到异常"值不在预期范围内".
这太烦人了,有什么价值?我用谷歌搜索了网络,我只能找到一些信息,但它没有多大帮助.
我有这段代码从扫描仪获取图像文件并将其保存在本地磁盘上:
IntPtr img = (IntPtr)pics[i];
SetStyle(ControlStyles.DoubleBuffer, false);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
SetStyle(ControlStyles.Opaque, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.UserPaint, true);
bmprect = new Rectangle(0, 0, 0, 0);
bmpptr = GlobalLock(img);
pixptr = GetPixelInfo(bmpptr);
Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr);
Run Code Online (Sandbox Code Playgroud)
问题出在这里Gdip.SaveDIBAs(@"C:\", bmpptr, pixptr);.保存对话框.

我想丢弃此对话框并将文件直接保存在我的驱动器中.
**Updated:**
public static bool SaveDIBAs(string picname, IntPtr bminfo, IntPtr pixdat)
{
SaveFileDialog sd = new SaveFileDialog();
sd.FileName = picname;
sd.Title = "Save bitmap as...";
sd.Filter =
"Bitmap file (*.bmp)|*.bmp|TIFF file (*.tif)|*.tif|JPEG file (*.jpg)|*.jpg|PNG file (*.png)|*.png|GIF file (*.gif)|*.gif|All files (*.*)|*.*";
sd.FilterIndex = 1;
return …Run Code Online (Sandbox Code Playgroud) 我应该使用什么免费库来在 React Native 中进行扫描?我需要一个库来扫描文档,我想在相机上设置帧大小并从照片加载数据。
我找到了一个库,但它将不再维护: https: //github.com/jonathanpalma/react-native-tesseract-ocr
确认不再支持: https: //github.com/rmtheis/tess-two
我开始考虑另一个库的原因: https://github.com/naptha/tesseract.js/issues/55
有人在 React Native 上使用过 Tesseract.js 或者有另一个免费且经过验证的库吗?
这是一个普遍的问题,我只是在寻找一个起点,而不是一个完整的解决方案。
我计划进行一些 3D 扫描,这意味着检查表面并从中生成 3D 模型。AFAIK 有两种方法:一种使用激光光栅扫描整个表面,另一种使用相机在表面上投影网格(不确定带有此网格的一张图片是否足够,或者是否需要更多完毕)。
我的问题:OpenCV 是否支持使用相机的第二种方法?如果是:涉及哪些类/函数?
欢迎所有提示:-)
我正在使用jfreesane和Apache PDFBox编写一个简单的扫描应用程序.
这是扫描码:
InetAddress address = InetAddress.getByName("192.168.0.17");
SaneSession session = SaneSession.withRemoteSane(address);
List<SaneDevice> devices = session.listDevices();
SaneDevice device = devices.get(0);
device.open();
device.getOption("resolution").setIntegerValue(300);
BufferedImage bimg = device.acquireImage();
File file = new File("test_scan.png");
ImageIO.write(bimg, "png", file);
device.close();
Run Code Online (Sandbox Code Playgroud)
并制作PDF:
PDDocument document = new PDDocument();
float width = bimg.getWidth();
float height = bimg.getHeight();
PDPage page = new PDPage(new PDRectangle(width, height));
document.addPage(page);
PDImageXObject pdimg = LosslessFactory.createFromImage(document, bimg);
PDPageContentStream stream = new PDPageContentStream(document, page, PDPageContentStream.AppendMode.APPEND, true);
stream.drawImage(pdimg, 0, 0);
stream.close();
document.save(filename);
document.close();
Run Code Online (Sandbox Code Playgroud)
这是结果: …
我尝试使用各种库(例如react-native-tesseract react-native-text-detectorExpo 中的库)来集成 OCR,但它们不起作用。这是我的代码,我想知道如何在其中集成 OCR。预先感谢您的解决方案!
takePicture = async () => {
if (this.camera) {
const options = { quality: 0.5, base64: true };
const data = await this.camera.takePictureAsync(options);
this.runOcr(data.uri);
}
};
runOcr = async (imageUri) => {
//code here
};
return (
<>
<Camera
ref={(ref) => {
this.camera = ref;
}}
style={{
flex: 1,
position: "absolute",
width: "100%",
height: "100%",
}}
type={Camera.Constants.Type.back}
autoFocus={Camera.Constants.AutoFocus.on}
flashMode={
!this.state.isFlash
? Camera.Constants.FlashMode.off
: Camera.Constants.FlashMode.on
}
/>
<View
style={{
position: "absolute",
bottom: "5%",
display: …Run Code Online (Sandbox Code Playgroud)