裁剪具有多个X和Y点的图像c# [英] Crop Image with multiple X and Y points c#

查看:80
本文介绍了裁剪具有多个X和Y点的图像c#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有需要裁剪的图像,并且有多个X,Y坐标来切出名片或纸张.最好的方法是什么.

我的共同策划人如下.X:490,y:0X:1442,y:0X:1442,y:4031X:490,y:4031

解决方案

您可以查看

免责声明:我是该nuget制造商的雇员

I have images that I need to crop and have multiple X,Y co-ordinates to cut out the business card or paper. What would be the best way to do it.

My Co Ordinates is the following. X: 490, y: 0 X: 1442, y: 0 X: 1442, y: 4031 X: 490, y: 4031

解决方案

You could check out the KeyStoneCommand from the Leadtools Image Processing Nuget

This Nuget package also includes a detect document ip command that you can use if you don't know the bounding box of the business card that will detect and give you back the 4 points of the card.

Here is a code snippet:

private RasterImage DetectAndDeskew(RasterImage image)
{
   DetectDocumentCommand detectDocumentCommand = new DetectDocumentCommand();
   detectDocumentCommand.Run(image);

   if (detectDocumentCommand.DocumentArea == null)
   {
      Console.WriteLine("No document detected");
      return null;
   }

   KeyStoneCommand command = new KeyStoneCommand(detectDocumentCommand.DocumentArea);
   command.Run(image);

   image = command.TransformedImage;
   return image;
}

Here is the output image from this process:

Disclaimer: I am an employed by the maker of this nuget

这篇关于裁剪具有多个X和Y点的图像c#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆