|
A sparse graph is useful for representing a matrix when you know most of the elements are going to be zero. It only represents the non-zero elements and their positions, which saves a lot of memory. Processing is faster too.
|
|
|
|
|
Using a sparse vs. dense representation is a decision driven mostly by the requirements of your algorithms and your memory constraints. Certain graphs lend themselves better to sparse representations, because they are sparse in nature. For example, the density of a graph of street segments, where intersections represent vertexes, and street segments between them represent edges, is very close to zero even for a city of a modest size.
The only time I needed a sparse graph representation in production was when I modeled a sparse multilevel whole-part relationship that contained a significant number of individual parts, and a relatively small number of groups.
|
|
|
|
|
Hi Everyone,
I am building a robotic turret with an airsoft gun monted on a set of tank tracks, i have found some code for tracking movement on a video feed from a static camera, the problem is everytime the turret moves to aquire the target the camera moves with the gun screwing up the tracking, what i am looking for is some kind of algorithm that allows for the video feed to track and center the target while sending the commands to the turret to pan and tilt (aiming), the camera is mounted on the barrel for aiming and the gun is mounted on a 2 axis servo system, i dont know what i would call an algorithm like this to look for one.
Any help would be greatly appricated.
Thanks
Andrew
|
|
|
|
|
So you want our help writing an application to shoot people? You're sick.
|
|
|
|
|
I would say sick if I was going to strap an ACTUAL gun to the rig, airsoft is a game.
|
|
|
|
|
Calculate the centroid of the target outline relative to the center of the screen, then command the aiming system to move in the directions required to center that point. Remember that the airsoft pellets are ballistic, and will drop with distance; once you have the azimuth on target, you'll need to move the barrel upward to overcome that. This will have the effect of causing your image centroid to appear below the center of the display, if the camera is mounted above the barrel, and above the center if mounted below. If you have room for a laser rangefinder on that rig, use it to paint the target and provide ranging information to adjust for gravitational error. Tack on an anemometer if there's room, too, so you can estimate windage corrections.
If you want it to be truly useful, make that video camera an infrared type so you can hunt cats at night.
Will Rogers never met me.
|
|
|
|
|
the issue is I am able to locate the target as it moves (detection), it draws a square around the target, but as soon as the pan and tilt operations happen to move the target center the camera moves and picks up movement accross the whole screen which makes the entire video feed the target (square changes to the whole screen) this is what i am trying to fix now.... as for range finding i was thinking of using a stereo camera rig and calculating distance to target from the angle offset in each feed relative to the space between the two cameras, first prize for now would be to sort the motion tracking and target aquisition system. but i will look into laser range finding.
I didnt think of using a anemometer for windage this would be great as this will be used for outdoor combat. it going to be about the size of a lawn mower when it finished. as for Hunting Cats i happen to have two and dont think they would enjoy being shot at, this will however be used at airsoft games.
|
|
|
|
|
Other people's jobs are much more interesting than mine.......
|
|
|
|
|
i wish this was my nine to five, its actually a side home project, in my normal life i build ERP business software for a logistics company.... dead boring...
|
|
|
|
|
|
I have worked on several tracking algorithm. In many algorithm we need to give the boundary of the object to track. So if its not possible in your case, first you need to do some motion segmentation, then you need to track.
Tracking is definitely complicated, so if you have time i would suggest you to look into active contours and SIFT feature tracking , otherwise try to implement mean shift algorithm, the problem with mean shift is it is not scale invariant. You also need to predict the camera object movement ( using kallman filter )
Hopes this will give you a very high level introduction.
If u can Dream... U can do it
|
|
|
|
|
Thanks JK, the Kallman Filter approach seems to be the best option, you have definatly given me some good direction, thanks again.
|
|
|
|
|
Tell me If you got it working.am just curious.
If u can Dream... U can do it
|
|
|
|
|
|
You saw what happened yesterday when you didn't follow the guidelines. Why do you think it will be any different today?
Albert Einstein once said "The definition of insanity is doing the same thing over and over again and expecting different results". refer here
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
forum, u identify the installshield application send me the name i don't know?
|
|
|
|
|
Wow, you really are stupid. I just saw the email from you saying sorry for multiple posts and now you immediately post your question for a seventh time. That should guarantee that nobody will respond to you.
I must get a clever new signature for 2011.
|
|
|
|
|
You should post your question at the InstallShield forums[^] in the forum specific to the product/version you are using.
Jack of all trades ~ Master of none.
|
|
|
|
|
I agree!
"Program testing can be used to show the presence of bugs, but never to show their absence."
<< please vote!! >>
|
|
|
|
|
SOLVED
For anyone interested here is the solution to my problem:
public IEnumerable<Tile> PathFind(Tile startNode, Tile endNode)
{
List<Tile> openNodes = new List<Tile>() { startNode };
List<Tile> closedNodes = new List<Tile>();
Tile lowestFScore = null;
while (openNodes.Count > 0 && lowestFScore != endNode)
{
lowestFScore = GetLowestScoringTile(openNodes, endNode);
openNodes.Remove(lowestFScore);
if (lowestFScore == null)
return null;
SwitchFromOpenToClosedList(lowestFScore, openNodes, closedNodes);
IEnumerable<Tile> neighbouringTile = GetNeighbouringTiles(lowestFScore);
foreach (Tile n in neighbouringTile)
{
if (IgnoreTile(n))
{
SwitchFromOpenToClosedList(n, openNodes, closedNodes);
continue;
}
if (closedNodes.Contains(n)) continue;
if (!openNodes.Contains(n))
{
openNodes.Add(n);
n.Parent = lowestFScore;
}
}
}
return RenderToGrid(endNode);
}
I have done my research and attempted several times to create my version of the infamous A* path-finding algorithm.
The algorithm I have made does seem to work though!...(unsurprisingly)
If anyone can help me it would be great, I am sure it is just a logic problem in the main part of the method:
public void PathFind(Tile startNode, Tile endNode)
{
List<Tile> openNodes = new List<Tile>() { startNode };
List<Tile> closedNodes = new List<Tile>();
Tile currentNode = startNode;
while (true)
{
foreach (Tile n in GetNeighbouringTiles(currentNode))
{
if (closedNodes.Contains(n)) continue;
if (IgnoreTile(n))
{
if (!closedNodes.Contains(n))
{
closedNodes.Add(n);
continue;
}
}
n.Parent = currentNode;
if (!openNodes.Contains(n))
openNodes.Add(n);
}
if (openNodes.Contains(currentNode))
openNodes.Remove(currentNode);
Tile lowestScoring = GetLowestScoringTile(openNodes, endNode);
if (lowestScoring == null) lowestScoring = currentNode;
if (openNodes.Contains(lowestScoring))
{
openNodes.Remove(lowestScoring);
}
foreach (Tile n in GetNeighbouringTiles(lowestScoring))
{
if (closedNodes.Contains(n)) continue;
if (IgnoreTile(n))
{
if (!closedNodes.Contains(n))
{
closedNodes.Add(n);
continue;
}
}
n.Parent = lowestScoring;
if (!openNodes.Contains(n))
openNodes.Add(n);
else
{
if (Tile.GetCost(lowestScoring, endNode) > Tile.GetCost(n, endNode))
{
n.Parent = lowestScoring;
lowestScoring = n;
}
}
}
currentNode = lowestScoring;
if (openNodes.Count == 0 || currentNode == endNode)
return;
}
}
I am expecting the method to return when there are no more nodes remaining (which tells me that there is no way of getting from a to b), or the current node is the end node (which should mean that I can just re-curse through each "Parent" attribute of the endNode to cycle through the path.
Edit1: I noticed that the first " n.Parent = currentNode;" is never reached!
Edit2: The "GetNeighbouringTiles" method was incorrect, it didn't search for moving down... The pathfinding method hits an infinite loop now...
It only ever does the former result
modified on Tuesday, January 4, 2011 1:40 PM
|
|
|
|
|
|
Thank Espen,
I was trying to do it based on the concept, I didn't want to use other code and instead build from the concept
|
|
|
|
|
|
.. A few comments on this, if your using XNA and want to use this code on the XBOX, you should get rid of the Foreach loop, it is a performance killer due to GC on the XBOX....
Also you should look into the weighting Heuristics, because this approach albeit closed and complete is not as efficient as it could be....
Also your sucking up memory as you use this algo... have you tested it against a large number of bots representative to the normal in game load...., I'd wadger it won't run inside your game loop propperly for more then 125 or so bots (using a 256x256 tile map).... just trying to give you the heads up...
I'd blame it on the Brain farts.. But let's be honest, it really is more like a Methane factory between my ears some days then it is anything else...
-----
"The conversations he was having with himself were becoming ominous."-.. On the radio...
|
|
|
|
|
I used to be pretty good at this stuff, but I just can't get a handle on how to express this properly. Thirty years takes a toll on remembered math, so I hope someone more recently experienced with probability can steer me back on course.
In the game of Keno there is a field of 80 numbers, from which 20 are selected for each round. Players pick from n = 3 to 20 numbers and hope that n of them will come up in the next round. In reality, far fewer than n usually pop up, and I'd like to know the probability of each combination occurring. For instance, suppose I pick 6 numbers. How can I calculate the probability that 3 of my numbers will be among the 20 drawn? 5?
The simple approach of calculating draws doesn't work, since the classic method I remember determines the probability of all 3 numbers coming up in 3 draws. But given that 20 draws are made regardless of how many I pick changes things considerably. I just can't figure out how to express it.
Anyone care to take a crack at it?
Will Rogers never met me.
|
|
|
|