|
Hi,
1.
I think something is wrong in the line p1 += 2; p2 += 2; p3 +=2;
isnt the idea here to move to the next scanline ?
2.
I suspect the Bitmap class also has a "stride" or "scanwidth" indicating the exact
distance you should move forward to get to the next scanline. It is not necessaraly true
that stride=width. I am not familiar with the details, but have a look at BitmapData
and LockBits.
3.
may I suggest you use pre and /pre tags to isolate code snippets; it (almost) preserves
all white space; and finally there is a checkbox that prevents HTML interpretation (so
your less than operators dont get eaten, see your for statements). Unfortunately if
you check it, pre tags dont work anymore...
Good luck with your image processing !
Luc Pattyn
|
|
|
|
|
I´m looking for a algorithm to calculate the sun up. Who can help me.
|
|
|
|
|
Can you be more specific? Do you mean to say that you need a function to calculate when sunrise is? In different timezones? It's hard to tell what you are talking about.
|
|
|
|
|
Rigth, I need fucntion to calculate when sunrise is.
|
|
|
|
|
|
daniel99 wrote: I´m looking for a algorithm to calculate the sun up. Who can help me.
The Sun API DLL[^]
but if you prefer the algorithms itself (not a DLL) then you might want to look at the bottom Middle of this[^] (Ben always has to go add stuff before I reference it )
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
Does anybody know of a path finding algorithm that can find the longest path as opposed to the shortest? This is to be used in a tile based game where I have to connect two tiles using 3 or less lines. The longer the line the higher the score and the least number of lines the higher the score.
I am familiar with the Astar algorithm and have been trying to modify it to suit my needs. I'm not sure exactly how I should calculate the movement cost. I'm thinking I should give a high cost to a direction change and a low cost to a short line. But I can't get it to work correctly
|
|
|
|
|
WalderMort wrote: I'm not sure exactly how I should calculate the movement cost.
1/dist. What this does is say that the longer the distance, the shorter the cost, the result is the A* suddenly starts thinking the longer path is the better one. You can still use large numbers for cost to designate running into lines, etc to stop the path.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
http://siderite.blogspot.com/2007/01/super-fast-string-distance-algorithm.html[^]
I hope I am not reinventing an old and rusty wheel, even if I am sure someone somewhere had the same idea as I did, however, I didn't find it on Google, so I am presenting this algorithm I've created to compare two strings, as a fast replacement for Levenstein.
I think it's pretty accurate for its speed. I have tested it on 60000 company detail records and the average dispersion from levenshtein is 3%, with 15% max, and the greatest errors when strings were fairly different in length. (when strings are equal in length, the average error is 1%)
So, I submit this is a good algorithm to see if strings are similar or fairly different, leaving it to levenshtein to compute exact distance values when sift2 values go above a certain threshold. The complexity is almost linear O(n*constant). What do you guys think?
-- modified at 9:46 Wednesday 10th January, 2007
-- modified at 5:05 Tuesday 16th January, 2007
Made it slightly faster and a lot more precise.
|
|
|
|
|
Siderite Zaqwedex wrote: What do you guys think?
It's an interesting read. Seems like you should write an article on it.
|
|
|
|
|
I'm trying to build a postfix parser for some kind of expressions. I used stack and so on I got the result correctly with binary operator.
But when I add in factorial sign "!" things got messed up.
For example: 3+4 --> 3 4 +
But 3! + 4 --> 3 4 ! + or 3 ! +4 (it take "+" as a signed value)
How should I treat this case ? The correct result should be 3 ! 4 +, but because "!" isnt an operand, my algorithm just treat it as other operator.
Any solution ? Thanks for reading
|
|
|
|
|
Hi,
first rule in postfix is: push operands on operand stack
a) if you dont have any operator yet (in "awaiting operand" state), or
b) if you dont have enough operands yet.
so with "3 + 4" you push 3 because of a) and 4 because of b)
but with "3! + 4" you push 3 because of a) and you execute ! as soon as it has all its
operands (only one), so the 3 gets popped from operand stack and the result of 3!
gets pushed, before dealing with the + and the 4
That's what monadic operators are about
remark: there are two kinds of monadics: compare -3 and 3!
Luc Pattyn
|
|
|
|
|
Thanks for your reply.
But my problem is I do NOT want to calculate the result of 3! before hand, because I'm using that to build a parse tree, and for some other reasons, I have to convert the infix expression into postfix before using that postfix expression to build the tree.
Is there a solution for this ?
Me newbie
|
|
|
|
|
OK,
the postfix of 3+4 is 34+ (operands first, then operator)
so the postfix of -3 is 3- (you may want use two different minus symbols, one for biadic,
one for monadic, although even in postfix it is clear: there is only one operand available)
and the postfix of 3! is 3! (again operand(s) first, then operator).
Luc Pattyn
|
|
|
|
|
Thanks, I think I got some hold of it now.
Currently my algorithm is like this:
-If next token is an operand, add it to output array, change state to not readingOperator
-If next token is an operator:
------If state is readingOperator, and token is + or -, acknowledge it as signed value
------If state is not, change state to readingOperator.
------If operator is "!", add it to output array, and change state to not readingOperator
------If operator stack is empty, push token into stack
------If top of operator stack is a higher precedent operator, pop it out and add to output array. Repeat this step.
------If top of operator stack is a lower precedent operator, push token into operator stack.
-Repeat till there is no more token.
Will this algorithm be ok ? Is there any problem with it ?
|
|
|
|
|
Well, it may be right, it sure is close. I am not going to check all the details for you,
you should figure it out yourself
I suggest you experiment with say 5 expressions, first symbolically
(=parsing), then by executing your postfix as well as the original to compare results.
So you could try e.g.
6*5+4
6+5*4
if allowed by your input language also 6*(5+4) and the like
once all of these are correct, you could try longer expressions (but it would be hard
to mess them up once you got the basics)
so now is the time to replace one of the numbers by -2 or by 3!
if you know how to handle parentheses, you could introduce functions such as in 3+sqrt(4*5)-2
this is not very hard
and if you think everything is fine, then go for exponentiation:
6+5^4 (looks simple)
but what about: 2^3^2 (remember, exponentiation goes right-to-left,
whereas ! does not, so 3!! is nothing special but 2^3^2 is)
but don't try the more difficult ones as long as the simpler ones are not absolutely correct
It is up to you how far you want to go...
Luc Pattyn
|
|
|
|
|
Thanks, it's good to know I'm on the right track.
|
|
|
|
|
Hi All,
i try to create the fibonacci code ( 0,1,1,2,3,5,8,13,....etc) in vb6, but i feel dificulty to get the amount from entire fibonaci number. please help me. the amount is in sum.text
Dim N As Long
Dim X As Long
Dim F As Long
Dim F2 As Long
Dim M As Long
Dim R As String
F = 1
F2 = 1
N = Val(Text1.Text)
For M = 2 To N
X = F2
F2 = F2 + F
F = X
R = R + Str(F2) + ","
Next M
sum.Text = F2 + f
Text3.Text = "1," + R
End Sub
please help me.
|
|
|
|
|
I guess you want the sum of all the numbers belonging to the sequence, so:
F = 1
F2 = 1
N = Val(Text1.Text)
X = 1 'X holds the Sum
For M = 2 To N
F2 = F2 + F
X = X + F2
F = F2
R = R + Str(F2) + ","
Next M
Sum.Text = X
I'm assuming the sequence you generated is correct.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hello All,
On another forum a while back I did a post on Fuzzy Matching where I made available source code for string matching algorithms.
As it is I am an Access/VB programmer. There is an Access database I developed as a demo that illustrates the use of certain string matching algorithms that achieve a precision/recall of 99%.
For those who may be interested the original post is at:
<a href="http://www.kdkeys.net/forums/thread/6432.aspx">http://www.kdkeys.net/forums/thread/6432.aspx</a>[<a href="http://www.kdkeys.net/forums/thread/6432.aspx" target="_blank" title="New Window">^</a>]
How to use the database for your own purpose is also posted at:
<a href="http://www.kdkeys.net/forums/thread/6983.aspx">http://www.kdkeys.net/forums/thread/6983.aspx</a>[<a href="http://www.kdkeys.net/forums/thread/6983.aspx" target="_blank" title="New Window">^</a>]
Within those posts is a link for downloading the package (database, algorithm source, etc.)
At this site I am DataClean - there I am OpnSeason.
Matching is divine....
|
|
|
|
|
Can you please make public available your package (at the moment a registration to Free Data Mining Source Code is required)?
Thanks...
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
That would have to be done by the moderator.
|
|
|
|
|
You can post here an article about.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Does anybody have algorithm for character extraction from image ?
Where characters are deformed but in one horizontal line and vertically they are overlapping (i.e. it is not possible to separate two character through a vertical line ).........
Waiting for ur response ????
Sumit Mishra
email iit.sumit@gmail.com
|
|
|
|
|
Don't post in multiple forums. Choose an appropriate one and wait for answers. Multposting is considered spamming and rude.
|
|
|
|