且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在.jpg / .png等图像文件中搜索文本

更新时间:2023-02-13 23:39:03

你需要做的事情取决于文本的位置:如果它是文件名,那那就非常简单了。 />
如果它在图像本身,那真的非常复杂,并且意味着首先在图像上使用一些OCR软件来识别任何文本,然后搜索它。有一个开源OCVR库的库,其中一些有.NET包装器 - Googleopen OCR C# [ ^ ]是您开始寻找的***位置,但不要期望这是一个五分钟的工作,或者让代码准备好做你想要的(也许,不要指望结果也能快速运行!)


看看这些链接试试任何一个如果实现的话仍然你遇到任何问题发布它阅读文字来自C#.net 中的图片

C#Imaging - C#.NET中的OCR识别


嗨试试这个



  string  path =  @  d:\Images跨度>; 
DirectoryInfo di = new DirectoryInfo(path);
FileInfo [] fi = new string [] { * .jpg * .png} .SelectMany(i = > di.GetFiles(i,SearchOption.AllDirectories))。Distinct()。ToArray() ;
string [] filenames = fi.Select(k = > k.Name)。 ToArray的();


Hi friends,

In My project i need to search for specific text in a folder that conatains image with extension jpg and png.
note: I need only c# code for this
please help i need it very badly!!!
Thanks in advance.

Exactly what you need to do is dependant on where the text is: if it is in teh file name, then that's pretty trivial.
If it's in the image itself, then that's really quite complex, and means using some OCR software on the image first to identify any text and then search that. There are a coupel of open-source OCVR libraries, some of which have .NET wrappers - Google "open OCR C#[^] is the best place for you to start looking, but dontt expect this to be a five minute job, or to get code ready to do exactly what you want (and probably, don't expect the results to be quick to run either!)


see these Links Try any one to implement if still you are facing any problem post it Read Text from Image in C#.net
C# Imaging - OCR Recognition in C#.NET


Hi Try this

string path = @"D:\Images";
           DirectoryInfo di = new DirectoryInfo(path);
           FileInfo[] fi = new string[] { "*.jpg", "*.png" }.SelectMany(i => di.GetFiles(i, SearchOption.AllDirectories)).Distinct().ToArray();
           string[] filenames = fi.Select(k => k.Name).ToArray();