|
You have to account for the fact that no two scans of the exact same card will result in a pixel-by-pixel equality. Every pixel is going to be a slightly different color than the same pixel in the previous scan.
If all you're doing is OCR'ing the business cards, why even bother comparing two images of the cards and just compare the data that's coming off them?
If you have to compare the images, then you'll have to implement a filter (in C#, not VB.NET!) to process the image to equalize the colors. For example, if you look at the white part of a business card, you'll see a scattering of pixels of different colors, not an even white acrossed all of them. You have to implement a filter to remove all those color variations to generate the nice flat color acrossed all pixels.
Search the articles for "image processing for dummies" and you'll find some good examples by Christian Graus.
Ph, you can't do this in VB.NET. If you wanted any speed at all, it has to be done in C#, or some other managed language that supports pointers. VB.NET doesn't.
|
|
|
|
|
dear dave... all you wroted isnt corect! download the archive which i posted and try to compare two images...
|
|
|
|
|
Dave Kreskowiak wrote: You have to account for the fact that no two scans of the exact same card will result in a pixel-by-pixel equality. Every pixel is going to be a slightly different color than the same pixel in the previous scan.
i know that and understand what you mean so i made:
Private Function CheckPixel(ByVal source_color As Color, ByVal search_color As Color, ByVal tolerancy As Integer) As Boolean
Dim sense As Long
sense = 255 - tolerancy * 5
CheckPixel = (System.Math.Sqrt((Val(source_color.R.ToString) - Val(search_color.R.ToString)) * (Val(source_color.R.ToString) - Val(search_color.R.ToString)) + (Val(source_color.G.ToString) - Val(search_color.G.ToString)) * (Val(source_color.G.ToString) - Val(search_color.G.ToString)) + (Val(source_color.B.ToString) - Val(search_color.B.ToString)) * (Val(source_color.B.ToString) - Val(search_color.B.ToString))) > sense)
End Function
wich is working ok for pixelbypixel search! but i dont want pixelbypixel search or do want i dont know thats why i posted a link to rapidshare file and application with source wich contains my needs!
Dave Kreskowiak wrote: If all you're doing is OCR'ing the business cards, why even bother comparing two images of the cards and just compare the data that's coming off them?
no i am not doing ocr. i have button "start" and then i scan image and compare to an image that is stored to database and detect difference on those two images and pixelbypixel is slow and not good result but with the code for detect difference from link i posted would do what i want! Here are images you can try with the application i posted and see what i want!
ORIGINAL : http://img96.imageshack.us/img96/3540/originalsp.jpg[^]
SCANED : http://img717.imageshack.us/img717/3461/damaged.jpg[^]
COMPARED : http://img32.imageshack.us/img32/5895/comparator.jpg[^]
Dave Kreskowiak wrote: If you have to compare the images, then you'll have to implement a filter (in C#, not VB.NET!) to process the image to equalize the colors. For example, if you look at the white part of a business card, you'll see a scattering of pixels of different colors, not an even white acrossed all of them. You have to implement a filter to remove all those color variations to generate the nice flat color acrossed all pixels.
yes i want compare... look at compared picture!
Dave Kreskowiak wrote: Search the articles for "image processing for dummies" and you'll find some good examples by Christian Graus.
thanks i will!
|
|
|
|
|
Pf course your search is slow! First, you're using GetPixel, which takes an eternity to execute. Second, this code is garbage:
CheckPixel = (System.Math.Sqrt((Val(source_color.R.ToString) - Val(search_color.R.ToString)) * (Val(source_color.R.ToString) - Val(search_color.R.ToString)) + (Val(source_color.G.ToString) - Val(search_color.G.ToString)) * (Val(source_color.G.ToString) - Val(search_color.G.ToString)) + (Val(source_color.B.ToString) - Val(search_color.B.ToString)) * (Val(source_color.B.ToString) - Val(search_color.B.ToString))) > sense)
Your converting each RGB value component, say R, to a string, then back to a value. This is VERY time consuming an completely unnecessary. Not only are you doing it at all, you're doing it several times for each time you use the same value!
The only way you're going to improve performance is to scrap this code and rewrite it in C# and directly access the image data. You cannot do this in VB.NET because it requires the use of unsafe pointers, which VB.NET does not support.
Search the articles for "image processing for dummies" and you'll find a very good series of articles by Christian Graus explaining just how this is done.
|
|
|
|
|
|
i removed video becose of some e-mails i got last 2 hours
|
|
|
|
|
FeRtoll wrote: I concluded from this only one thing, you dont like vb.net annymore and force to the c#!
First, I already told you why you could not do this entirely in VB.NET. Go back and re-read it.
FeRtoll wrote: Dave Kreskowiak wrote:
Visual Developer - Visual Basic
2006, 2007, 2008
But no longer in 2009...
Because I've spent far more time with my son than here. That's all...
FeRtoll wrote: in c# yes, but i am here asking for vb.net!
There is no equivilent in VB.NET. I already told you VB.NET does not support pointers, making writing it in VB.NET impossible.
FeRtoll wrote: I would prefer to learn assembler rather than c#,
Waste your time however you want. C# is so very close to VB.NET, so you know more about it than you realize.
FeRtoll wrote: and how people say it... i am joking!
I'm not...
|
|
|
|
|
Don't worry , be happy!
hey dont get mad, i respect your opinion and help!
|
|
|
|
|
Hello everyone,
I currently have an infragistics ultrawingrid that takes input in a cell and when tabbed, it updates database and refreshes the grid but the tab goes to the next control. I need the tab to go to the next cell. This is not a problem in the designer its a problem with the grid being refreshed in the hard code and it has to be refreshed because other values have dependency on the values being entered. does anyone have any ideas or any reference to how i can achieve this.
Any comment or suggestion is appreciated
|
|
|
|
|
A better place to ask this question is here[^].
|
|
|
|
|
Hi,
How can I find out what type of disc is in the dvd/cd reader.
I found
- System.IO.DriveInfo(driveLetter)
- FileSystemobject with drives
- Directory.GetLogicalDrives
But non of these tells me what type of disc is in the machine. How can I find this?
Jan
|
|
|
|
|
I don't think there's a direct property but System.IO.DriveInfo has Totalsize so you could work it out from that, no?
|
|
|
|
|
|
Press eject
|
|
|
|
|
you can do that by a simple P/Invoke:
mciSendStringA("set CDAudio door open", "", 0, 0)
and that also works for data CD and DVD
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
How do you make an input that the user key in a textbox to be a percentage number?
|
|
|
|
|
Ummmm, Divide (/) by 100
I don't speak Idiot - please talk slowly and clearly
'This space for rent'
Driven to the arms of Heineken by the wife
|
|
|
|
|
Just make it a number and put a label with "%" in it behind.
Then on change parse the value to %
Easier than messing around with controlling inputs.
------------------------------------
I will never again mention that I was the poster of the One Millionth Lounge Post, nor that it was complete drivel. Dalek Dave
|
|
|
|
|
Use a NumericUpDown with the max/min set to 100/0, and a label next to it for the % sign.
|
|
|
|
|
Hello Everybody,
I am trying to print the Image which have the text. It printing properly. But in Text Portion Displays some distervence in printing.
Thanks
If you can think then I Can.
|
|
|
|
|
Sorry, but i haven't got a clue what you are talking about, it doesn't make alot of sense.
Can you maybe reword it.....
|
|
|
|
|
I am Creating an Image by using Text. It is showing fine. But I am Trying to print this Image then the Text Quality is not Fine.
Code Is simple
g.DrawImage(this.Ibarcode , DrawRectangle)
If you can think then I Can.
|
|
|
|
|
It's hard to say without being able to see what the image looks like when it is printed. It could be some scaling problem or resolution problem.
You could perhaps try sending the image and the text to the printer separately instead of writing the text on the image?!?!
|
|
|
|
|
But my requirement is crating image by using text. then it's depend on user to print or Export in Image.
If you can think then I Can.
|
|
|
|
|
i am trying to convert c# to vb.net of this project!
.NET TWAIN image scanner[^]
i did it and it works on select source, and scan preview but not when i click scan then it throws me error "Arithmetic operation resulted in an overflow." in winmsga.x = CShort(pos)
much of code!
here is what i have done:
TwainLib[^]
Twain[^]
GDIPlusLib[^]
And my form[^]
only two things got errors when i converted code!
first one is:
<StructLayout(LayoutKind.Sequential, Pack:=4)> _
Friend Structure WINMSG
Public hwnd As IntPtr
Public message As Integer
Public wParam As IntPtr
Public lParam As IntPtr
Public time As Integer
Public x As Integer
Public y As Integer
End Structure
and
Private winmsg As WINMSG
so i just renamed it to winmsga maybe i did something wrong here?
and other error was:
Protected Function GetPixelInfo(ByVal bmpptr As IntPtr) As IntPtr
bmi = New BITMAPINFOHEADER()
Marshal.PtrToStructure(bmpptr, bmi)
bmprect.X = InlineAssignHelper(bmprect.Y, 0)
bmprect.Width = bmi.biWidth
bmprect.Height = bmi.biHeight
If bmi.biSizeImage = 0 Then
bmi.biSizeImage = ((((bmi.biWidth * bmi.biBitCount) + 31) And Not 31) >> 3) * bmi.biHeight
End If
Dim p As Integer = bmi.biClrUsed
If (p = 0) AndAlso (bmi.biBitCount <= 8) Then
p = 1 << bmi.biBitCount
End If
p = (p * 4) + bmi.biSize + CInt(bmpptr)
Return New (p,IntPtr) 'so i made like this (Return New System.IntPtr(p))
End Function
can annyone help?
thanks!
|
|
|
|