|
-
May 9th, 2013, 08:32 AM
#1
Thread Starter
Member
Detect straight lines from an Image
I am developing a form filling application in vb6 or vb.net. In this
I want to detect the location straight lines from scanned image and in this user will input the data and will print.
Is there any Idea how I can do it.Kindly suggest any solution
Thanks in advance
-
May 9th, 2013, 09:17 AM
#2
Re: Detect straight lines from an Image
What is this obsession with doing things the most difficult way possible? Just explain to me how you imagine that you would determine that there is a line present. If it's perfectly aligned, you could perhaps sample a number of points with a particular y value but then how many would you need to sample to check that isn't just a line of text that happens to have those particular points occupied by characters? And if the image isn't perfectly aligned (and it would only take a couple of degrees error) you've no hope at all.
If you want to fill in a form in this way (and it's beyond me to understand why you can't just use a biro like anybody else) you will need to get yourself a pixel ruler, create a form template and measure the positions for typed entries. Or do the sensible thing and create an HTML or pdf form that has purpose built input areas! Letting the machine 'guess' what a straight line is is a recipe for disaster!
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 9th, 2013, 12:26 PM
#3
Thread Starter
Member
Re: Detect straight lines from an Image
Thanks for your reply
Actually my requirement is cheque printing, for this I have two option
1.Create template of the each cheque and select the template and enter the information and print
2.Auto detect the position of the fields and prints.
Here I cannot use the first method since the client have more than 200 types of cheque formats.
So here I want to the second option.The user first scans the cheque leaf and from the scanned image it auto identifies the location of the fields and inputs the infomation and prints the cheque.
How can I identify the lines position of the scanned image?
thanks in advance
-
May 9th, 2013, 01:20 PM
#4
Re: Detect straight lines from an Image
Here I cannot use the first method since the client have more than 200 types of cheque formats.
What? While my mind boggles at that, surely they don't all have different layouts. That would be plain crazy! Their bank let's them get away with that?
The user first scans the cheque leaf
Seriously? So you're actually trying to slow down cheque writing (and who uses cheques anymore anyway?) to a crawl?
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
-
May 9th, 2013, 01:54 PM
#5
Re: Detect straight lines from an Image
Try scanning a couple of the cheques and take a look at the images. Unless scanning technology has improved greatly from the last time I looked, I think you will realize that the task you propose is going to be nearly impossible. Technically, what you are talking about is roughly a form of Optical Character Recognition (OCR), except that you are looking for a particular kind of shape rather than a particular character. OCR wouldn't be all that hard because you could find third-party libraries to perform the task, but since you aren't really doing OCR, you may not be able to find a library that does it for you. At that point, you get into the problem that OCR was such a difficult problem that it took decades to solve and there have been numerous books written about the theory behind it (and it still isn't perfect). If you can't find a library that does the work, then you get to implement your own....with a twist.
Personally, I wouldn't even attempt it, since I feel that there would be too many unusual cases for me to ever feel comfortable about my solution as anything other than a hobby, and it doesn't seem like an interesting hobby project.
My usual boring signature: Nothing
 
-
May 9th, 2013, 02:04 PM
#6
Thread Starter
Member
Re: Detect straight lines from an Image
My Client's customers may bring any kind of cheques, here we have 55+ banks, and they might bring old cheque which we might not have readymade template with us, and they dont want to take risk by printing in different layout(at this time spoling a chq leaf will be a big burden)
and the customers required to print multple cheques for their vehicle loan and other loans...
Now I need solution for
I need to compare the newly scanned one with the pre-scanned image database
is there any method to find the most matching images ......
Thanks,
are you there online now....?
-
May 9th, 2013, 02:10 PM
#7
Fanatic Member
Re: Detect straight lines from an Image
if your seriously want to do this reccognition thing your going to haveto study 2 things to start off
first calculus (analytic geometry)
equations of curves(which can also be applied to lines, this will allow you to check for straight lines certain angles etc) and limits which you will use as a threshold to determine if the line/curve is within an acceptable range of what your looking for.
second, digital imaging
again your going to have to apply thresholds to a color, basically set a colour range which is considered acceptable or part of the same object.
then you have apply all that into an algorythm to find an object, lots and lots of if's and cases, or lots of spinning equations round on each pixel good luck
it will take a while,
id do several stages
1 basic templates, large block areas with approximate fields
then check each block for approximate lines, and shapes
and narrow and narrow it until u have what you want
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work

-
May 9th, 2013, 02:27 PM
#8
Fanatic Member
Re: Detect straight lines from an Image
if you have a database of pre-scanned images then all you need is to apply a check between the images, using again thresholds.
is it within an acceptable range
overlay the database image with the image you have, subract the colors from each one, a perfect match would result in a blank image afterwards, again move the images around a little find the best result, apply thresholds again.
Yes!!!
Working from home is so much better than working in an office...
Nothing can beat the combined stress of getting your work done on time whilst
1. one toddler keeps pressing your AVR's power button
2. one baby keeps crying for milk
3. one child keeps running in and out of the house screaming and shouting
4. one wife keeps nagging you to stop playing on the pc and do some real work.. house chores
5. working at 1 O'clock in the morning because nobody is awake at that time
6. being grossly underpaid for all your hard work

-
May 9th, 2013, 03:15 PM
#9
Re: Detect straight lines from an Image
Even then I'd want all the images in the database to be black and white. The scanned image is liable to be any color, but the one thing you should be able to count on is that the lines will be high contrast with the empty space. Therefore, you can first take any image and set all pixels below a certain value to 0 and above a different value to 1. That should create a pretty good, simplistic, image of the cheque for you to work with. If you try to work with the straight scan you'll have to deal with all the colors being different on each image.
To give you an idea of how difficult this is, you are effectively trying to do a simplified version of cracking the very Captcha images used to verify that a user is actually a person and not a bot on a login screen.
My usual boring signature: Nothing
 
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|