I am working on an application which requires matching of numbers from a scanned image file to database entry and update the database with the match result.
Say I have image- employee1.jpg. This image will have two two handwritten entries - Employee number and the amount to be paid to the employee. I have to read the employee number from the image and query the database for the that number, update the employee with the amount to be paid as got from the image. Both the employee number and amount to be paid are written inside two boxes at a specified place on the image.
Is there any way to automate this. Basically I want a solution in .net using c#. I know this can be done using artificial neural networks.
Any ideas would be much appreciated.
You can use Microsoft Office Document Imaging Library (MODI), which is contained in the Office 2003/2007.
Links:
OCR with Microsoft® Office - Code
Project - example of using MODI
Microsoft Office Document Imaging -
Wikipedia - contains a simple
example in VB.NET
Pattern recognition is a basic example when neural networks are studied. I don't know if is any library/framework to work with AI in C#. If you find one, first you have to do is to train the network (supervised learning) and for this you need to prepare a big sample set of images; more examples -> result more accurate. In the other hand you can use OpenCV (C/C++, Python and Java) that is a library specialized in computer vision and has a module to implement AI methods.
Have a nice day!
Oscar.
I think this is very hard to automate. The problem is just because you need some kind of very good OCR software. And even if you got this, what if it reads something wrong, cause of the frouzy handwriting of someone? If the ID is wrong the paid is booked to the wrong employee and if the amount is wrong he got the wrong salary!
Both are things you won't really happen. Just to show you how hard a good ocr to find is, just take a look out there on how a captcha works. The principle is nothing more than an image of an hard to read text.
So my opinion would be, that you can't really automate this process. At least you can write a program to assist a human by entering the values manually (also take a look at Amazon Mechanical Turk):
Show on the right the picture with the handwritten values, or if they are always on the same position or specially marked (with a box around them, etc.), try to find these places automatically and show them to the user.
On the left offer two textboxes, where the user can enter the values.
To get this to a fast and fluent process, you have to take great care about how the user can enter easily the values by just using the keyboard:
When showing a new picture, set the focus to the id textbox
If the user id is always a specific length, switch to the next box if all numbers are entered
(If you allow this, a backspace in the empty next box should focus back to the previous one)
Otherwise allow a change to the next textbox by hitting tab or return
Normally these textboxes are arranged above each other (not side by side), thus you should support switching between them using the up down arrow keys.
After finishing the entry in the last textbox automatically show the next image.
Also in this case of a fresh new entry (nothing already entered) allow a easy switch back to the old entry by using the backspace or left arrow key)
By using such a process a single person can enter many entries into your database and the costs are much cheaper than finding wrong entries in your database afterwards.
Just a last suggestion:
Cause this is a boring process for a human which can easily leads to errors, maybe let two people enter these values and only if both are entering the same than take this value as approved. This should lead to a correct rate somewhere above 99%. If you need absolutely 100% think about letting 4-5 people checking one entry and only if all of them enter the same values take it as approved. To get also a comparsion about how good your ocr software would be, just let it also run over your images and compare this results to the human entered values to get an idea, when you can really rely on your ocr only.
OCR engines are not trained to read handwritten text, so you might have trouble with MODI. You want to try to find an ICR engine. Even so, the best ones of these are only 80% accurate on good inputs. You might get better because you know that your text is always numbers.
This SO question/answer says that OCROpus has ICR
FOSS Intelligent Character Recognition (ICR)
There is LeadTools SDK for OCR/ICR. This is very handy in recognising the handwritten characters. I am doing a feasibilty study with this, and till now I think it will work out. leadTools have provided components which can be used in your application, it supports C, C++, C#, VB.Net etc.
You can visit the following link for this:
http://www.leadtools.com/downloads/default.htm?category=
Related
We have many element(s) in a ContentPage. The goal is to take a picture of a specific element and then have access to that data - to save it or possibly other things such as cropping it.
So this question is twofold - is there a way to photographically capture a given element? Is there a way to do this if the element is not fully in view? Example a ScrollView would potentially have some of its elements not currently in view.
Our attempt at this is to use device specific screenshots and crop them to a given element. The screenshots are working, but we aren't having luck with cropping. Not to mention in the case as described above the screenshot will not work as the view isn't fully visible.
Is there a way to obtain the "graphical" (photo) data of an element at a given time even if it's not currently visible/partially visible?
Thanks for reading in advance.
After a lot of talking, this is what I understand
The Users of your application are the Workers of Your company
The application is for managing the accounts of your companies Customers
The Customers have no access to their data, in any shape or form
Part of the Customer Data is their Email Adress
You want to send a copy of their Data to the Customers
As Emails do not allow formating that well, you want to send that Data as a Screenshot of the UI.
If I got all that right:
You are neck-deep in a XY Problem. Or rather a ((XY)Y)Y Problem - a XY problem of the 3rd Generation.
The obvious solution would be to fix point 3 and give your customers access to their Data already:
You can do that via a extra Programm, App, a Webpage or anything similar. If they can receive emails, they can download a app or open a Webpage and see their data there. May need a login, but nothing special. There are even ways to encode data/direct links into Emails and register your Programm with a custom Format. Indeed, that is how Steam Links on the Desktop work.
Meanwhile the In-House user get a "Customer Management" Programm that allows more direct access to the Customers Data in the Database (I asume you got a backend Database. But it is at least possible you do not).
If you can not fix Option 3 for stupid Boss/Legal Reasons (these are the only Valid reasons I can Imagine. And I can not stress enoug how stupid the boss would have to be in that), you should at least be able to fix at Point 5/6:
The first Option would be to send Text Emails. People often underestimate jsut how much is possible with pure Text. It is basically like writing on a Console, but even that is enough medium to make a Art in it.
The other ways involve Managing the HTML limitations:
Save HTML Mail
The main security issue with HTML mails, is "downloading external content" part. Those operations can not be reliable scanned by Virus scanners and the like - especially in the age of HTTPS. Unless we talk about Kaspersky and the stupid Idea they had.
And even if they can be scanned reliable, even just the request of those files can be used for spam senders to verify the Email Adress is still in use. So it is a no-go too.
So you will need to Inline as much as possible. Inlining images is not that possible. While HTML totally has a Standart for that - you Base64 encode the binary into the HTML - this does not work reliably. At least Microsoft Outlook is known to interpret all Base64 images in the Email as Attachments - even the inlined ones. And even if they fixed this or it is no longer a relevant issue, inlining images tends to increase the HTML size significantly.
You can use CSS to some degree. But aside from inlining it, you might have to go back a step or two. In the end, Email Programms are really weak web-browsers. So they do not nessesarily support all the latest stuff instantly. Anything below CSS 3.0 should reliably work by now. But you better ask someone once you got more specific Requirements for this Email.
PDF Attachment
Somewhat more established is to create a .PDF file and send it. All those bills/other stuff in .PDF format you get - those have been created on demand from a Database, by the same code that also send the Email. In many cases the demand was automated too or the Sending Programm was a outright Background Process.
.PDF allows all Formating you could want. It can take up images inline. And there is plenty of ways to create .PDF from code. And as you can send it as a attachment, the Virus scanner has time to go over it. And we are not in the last Millenium, where a PDF Reader was a uncommon programm to have installed (I still remember the times when a current Version of Acrobat PDf Reader was delivered on every CD with a .PDF Format Handbook).
If you are stil dead serious about the whole "make a Image of the UI to send that", my only question is: How many Years have been aloted for that?
So I have a friend who is helping me and I'm really not a programmer but I can understand things when I have a template to build from.
I'm trying to create a program that accepts input from the user to generate a report for traffic accidents. Just to get started I was going to try and learn as much as I could to create the notification section which requires very little input and has little variance.
Section in CAPS would be the input requested from the user. It would be used in other areas so it should be stored as a string for other sections. Also, later there will be areas where the user has to enter parties, witnesses, and vehicles. Since there could be any number of combinations of the three it would have to be programmatically generated where as the notification could be find and replace.
Can someone point me in the right direction with an example code for just the following:
NOTIFICATION: On DATE_DISPATCHED, at approximately TIME_DISPATCHED
hours, I was dispatched to LOCATION_DISPATCHED at COLLEGE for a report
of a CALL_TYPE
NOTIFICATION: On 01-01-2000, at approximately 1000
hours, I was dispatched to South Lot at 1010 Address St for a report
of a small narrative about what happened.
If you are trying to assemble a word document based on a template and some user's input. I think HotDocs is what you need.
If you want to assemble a document programmatically you may refer to Word Add-ins or Office App from Microsoft. Or OpenXML Power Tools for more flexibility.
DOCX has the function I needed and I was able to get this almost completely fixed. I have a working version of exactly what I need but I am now having other problems with the output format. I would suggest anyone with the same goal as I had here to study using a builder to transfer variables in textboxes to a DOCx argument string which is well documented on the DOCX webpage. https://docx.codeplex.com/discussions
I am currently developing a Word-Completion application in C# and after getting the UI up and running, keyboard hooks set, and other things of that nature, I came to the realization that I need a WordList. The only issue is, I cant seem to find one with the appropriate information. I also don't want to spend an entire week formatting and gathering a WordList by hand.
The information I want is something like "TheWord, The definition, verb/etc."
So, it hit me. Why not download a basic word list with nothing but words(Already did this; there are about 109,523 words), write a program that iterates through every word, connects to the internet, retrieves the data(definition etc) from some arbitrary site, and creates XML data from said information. It could be 100% automated, and I would only have to wait for maybe an hour depending on my internet connection speed.
This however, brought me to a few questions.
How should I connect to a site to look up these words? << This my actual question.
How would I read this information from the website?
Would I piss off my ISP or the website for that matter?
Is this a really bad idea? Lol.
How do you guys think I should go about this?
EDIT
Someone noticed that Dictionary.com uses the word as a suffix in the url. This will make it easy to iterate through the word file. I also see that the webpage is stored in XHTML(Or maybe just HTML). Here is the source for the Word "Cat". http://pastebin.com/hjZj6AC1
For what you marked as your actual question - you just need to download the data from the website and find what you need.
A great tool for this is CsQuery which allows you to use jquery selectors.
You could do something like this:
var dom = CQ.CreateFromUrl("http://www.jquery.com");
string definition = dom.Select(".definitionDiv").Text();
I use RecaptchaControl, and the users complain that the image is not that clear (the black part in the the captcha is too hard to read). Is there any property to make the image less difficult (less noisy)?
<recaptcha:RecaptchaControl ID="recaptcha" runat="server" PublicKey="XXX" PrivateKey="YYY" OverrideSecureMode="true" />
To put it simply, no.
As others have said you can only customise the UI.
I'm the author of the article about the recaptcha API tutorial #web-development-blog.com and must say it's often very hard to read the text created images by recaptcha. While using the API I got sometimes better results while using a different language for the challenges.
In one of my projects I got a lot of complains and switched to a different script:
http://code.google.com/p/cool-php-captcha/
The challenges are less hard to solve and the script is very easy to use.
Possibly not what you are looking for but there are lots of custom captcha controls out there i.e.
CaptchaNET_2.aspx
With a bit of knowledge of the Graphics classes in C# it isn't a hard job to tweak the code to make the captcha simplier (or harder). We use one for a mobile phone web site and control is important otherwise it is unreadable in lower res phones
In some reCaptchas (I'm guessing this is somehow configurable), you only have to get one word right (I'm not sure how close the second word must be).
I've tested in the reCaptcha in my own website and it worked (two words wrong = fail, one word right + one wrong = success); tested in stackoverflow's reCaptcha and it didn't... I had to get both words right. That's why I think it's configurable.
I found this post along with the one below (where I read that only one word had to be right) exactly because I too am finding it too hard to get through reCaptcha's; too often having to refresh more than 5 times to get a readable pair. Other post:
Are reCAPTCHA CAPTCHAs getting harder or is just me
Google now allows you to change the difficulty setting.
I'm experimenting a bit with textual comparison/basic plagiarism detection, and want to try this on a website-to-website basis. However, I'm a bit stuck in finding a proper way to process the text.
How would you process and compare the content of two websites for plagiarism?
I'm thinking something like this pseudo-code:
// extract text
foreach website in websites
crawl website - store structure so pages are only scanned once
extract text blocks from all pages - store this is in list
// compare
foreach text in website1.textlist
compare with all text in website2.textlist
I realize that this solution could very quickly accumulate a lot of data, so it might only be possible to make it work with very small websites.
I haven't decided on the actual text comparison algorithm yet, but right now I'm more interested in getting the actual process algorithm working first.
I'm thinking it would be a good idea to extract all text as individual text pieces (from paragraphs, tables, headers and so on), as text can move around on pages.
I'm implementing this in C# (maybe ASP.NET).
I'm very interested in any input or advice you might have, so please shoot! :)
My approach to this problem would be to google for specific, fairly unique blocks of text whose copyright you are trying to protect.
Having said that, if you want to build your own solution, here are some comments:
Respect robots.txt. If they have marked the site as do-not-crawl, chances are they are not trying to profit from your content anyway.
You will need to refresh the site structure you have stored from time-to-time as websites change.
You will need to properly separate text from HTML tags and JavaScript.
You will essentially need to do a full text search in the entire text of the page (with tags/Script removed) for the text you wish to protect. There are good, published algorithms for this.
You're probably going to be more interested in fragment detection. for example, lots of pages will have the word "home" on them and you don't care. But it's fairly unlikely very many pages will have exactly the same words on the entire page. So you probably want to compare and report on pages that have exct matches of length 4,5,6,7,8, etc words and counts for each length. Assign a score and weight them and if you exceed your "magic number" report the suspected xeroxers.
For C#, you can use the webBrowser() to get a page and fairly easily get its text. Sorry, no code sample handy to copy/paste but MSDN usually has pretty good samples.