[英]Crop Image with multiple X and Y points c#
I have images that I need to crop and have multiple X,Y co-ordinates to cut out the business card or paper.我有需要裁剪的图像,并且有多个 X、Y 坐标来裁剪名片或纸张。 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
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您可以从Leadtools Image Processing Nuget查看KeyStoneCommand
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.这个 Nuget 包还包括一个检测文档 ip 命令,如果您不知道名片的边界框,您可以使用它来检测并返回名片的 4 个点。
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免责声明:我受雇于这个 nuget 的制造商
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.