找回密码
 立即注册

QQ登录

只需一步,快速开始

wjy72

初级会员

17

主题

122

帖子

287

积分

初级会员

积分
287

活字格认证微信认证勋章

wjy72
初级会员   /  发表于:2015-9-24 10:33  /   查看:15026  /  回复:29
刚购买了LEADTOOLS控件,功能强大,但技术说明是个渣,只好上来求助。
1. 选定区域后的反选,用来清除外部
2.图像裁剪
3.图像切割(分别保存为两个图像)
4.手动纠编(拉线纠偏)
5.注释(样例代码太多了,能否给个简单的?显示注释,及文本注释、固化)

谢谢。

29 个回复

倒序浏览
wjy72
初级会员   /  发表于:2015-9-24 11:10:00
沙发
第一个问题已解决了:
  //选定区域后,反选择区域,填充颜色

            LeadRect lr = rasterImageViewer1.Image.GetRegionBounds(null);

            rasterImageViewer1.Image.AddRectangleToRegion(null, lr, RasterRegionCombineMode.SetNot);

           clearInternal();//清除外部就是清除内部
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-9-24 18:01:00
板凳
回复 2楼wjy72的帖子

您好,您的问题已经收到,我这边做一下Demo后给您回复。
回复 使用道具 举报
wjy72
初级会员   /  发表于:2015-9-25 13:35:00
地板
2.图像裁剪
这个也解决了。

   //选定区域保存为图像,替换现有图像。
            CropCommand command = new CropCommand();
            command.Rectangle = rasterImageViewer1.Image.GetRegionBounds(null);
            command.Run(rasterImageViewer1.Image);
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-9-25 13:57:00
5#
回复 4楼wjy72的帖子

您好,第三个切割,将一个图像分为两个图像分别保存的实现思路如下:
RasterImage imgCopy;
// 取得您需要切割的部分
Rectangle rc = rasterImageViewer1.Image.GetRegionBounds(null);
// 将这一部分变为一张图片
imgCopy = new RasterImage(rasterImageViewer1.Image.Clone(rc));
// 调用裁剪方法对原始图像裁剪,去掉切割的部分
CropCommand command = new CropCommand();
command.Rectangle = rasterImageViewer1.Image.GetRegionBounds(null);
command.Run(rasterImageViewer1.Image);

之后调用Codec.Save(imgCopy ) 保存图片即可,原始图片由于已经去掉切割部分,所以可以直接保存

以上, 谢谢。
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-9-25 14:26:00
6#
回复 4楼wjy72的帖子

4,手动纠偏
请使用KeyStoneCommand ,使用方法如下:
LeadPoint[] PolyPoints = new LeadPoint[4];

    //The four corners of the polygon
    PolyPoints[0]= new LeadPoint(94, 94);
    PolyPoints[1]= new LeadPoint(306, 43);
    PolyPoints[2]= new LeadPoint(318, 237);
    PolyPoints[3]= new LeadPoint(98, 237);

    //Prepare the command
    KeyStoneCommand command = new KeyStoneCommand();

    command.PolygonPoints = PolyPoints;
    //Apply
    command.Run(image);
这个代码的效果请参见安装盘:\LEADTOOLS 19\Examples\DotNet\CS\OcrMultiEngineDemo,打开一张图片进行手动纠偏。
具体介绍请参见:https://www.leadtools.com/help/l ... eystonecommand.html
回复 使用道具 举报
wjy72
初级会员   /  发表于:2015-9-25 15:25:00
7#
谢谢。
手动纠偏,那个例子我用过,越用越差,根本纠不了偏。

另外,关于注释上面,LEADTOOLS网站有没有链接?样例太繁杂了,想要简单点的。

谢谢啦。
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-9-25 16:24:00
8#
回复 7楼wjy72的帖子

您好,经过测试手动纠偏功能是正常的。下面是我做的一个例子图片。
纠偏前原图:

纠偏后效果图:


使用的就是我给您介绍的Inverse Perspective功能。
如果您觉得有问题,请将您的测试图片发送给我,我会帮您测试。

以上,谢谢。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

x
回复 使用道具 举报
wjy72
初级会员   /  发表于:2015-9-25 16:32:00
9#
是Inverse Perspective功能?不是KeyStoneCommand? KeyStoneCommand  COPY过去试了试,没有用嘛
回复 使用道具 举报
AvoCaDolol活字格认证 Wyn认证
社区贡献组   /  发表于:2015-9-25 16:34:00
10#
回复 7楼wjy72的帖子

您好,关于批注,您可以参考官方在线帮助文档中的话题:
https://www.leadtools.com/help/l ... cs.annotations.html
里面有大量的代码和例子。希望能帮助到您。
以上,谢谢。
回复 使用道具 举报
123下一页
您需要登录后才可以回帖 登录 | 立即注册
返回顶部