Search Results

Search found 3139 results on 126 pages for 'edge detection'.

Page 9/126 | < Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >

  • Collision detection of huge number of circles

    - by Tomek Tarczynski
    What is the best way to check collision of huge number of circles? It's very easy to detect collision between two circles, but if we check every combination then it is O(n^2) which definitely not an optimal solution. We can assume that circle object has following properties: -Coordinates -Radius -Velocity -Direction Velocity is constant, but direction can change. I've come up with two solutions, but maybe there are some better solutions. Solution 1 Divide whole space into overlapping squares and check for collision only with circles that are in the same square. Squares needs to overlap so there won't be a problem when circle moves from one square to another. Solution 2 At the beginning distances between every pair of circles need to be calculated. If the distance is small then these pair is stored in some list, and we need to check for collision in every update. If the distance is big then we store after which update there can be a collision (it can be calculated because we know the distance and velocitites). It needs to be stored in some kind of priority queue. After previously calculated number of updates distance needs to be checked again and then we do the same procedure - put it on the list or again in the priority queue.

    Read the article

  • Motion detection of a specific object in .net

    - by abinop
    I need to make a .net application where I must detect a specific object the user is holding, using a camera. If the object must have some specific characteristics so that it can be easily recognized and detected from the surrounding space, please give me some tips (ex a green cube?) What would be the best technique/.net library to use? I need to translate in realtime the user's hand movement and display an animation on screen accordingly.

    Read the article

  • Face detection in 100% pure PHP

    - by Yogi Yang 007
    I am looking for PHP script that will detect face in a uploaded photo and automatically crop it accordingly. The code should be in pure PHP without depending on any third party API's or Libs. This code will be a part of our existing code for processing images. In fact this is the only part that is missing! I would prefer to have code in PHP version 5.x not PHP 6.x.

    Read the article

  • Collision detection, alternatives to "push out"

    - by LaZe
    I'm moving a character (ellipsoid) around in my physics engine. The movement must be constrained by the static geometry, but should slide on the edges, so it won't be stuck. My current approach is to move it a little and then push it back out of the geometry. It seems to work, but I think it's mostly because of luck. I fear there must be some corner cases where this method will go haywire. For example a sharp corner where two walls keeps pushing the character into each other. How would a "state of the art" game engine solve this?

    Read the article

  • algorithim for simple colision detection in Java

    - by Bob Twinkles
    I'm not very experienced with Java, just started a couple weeks ago, but I have a simple applet that has two user controlled balls, drawn through java.awt and I need a way to detect a collision with between them. I have an algorithm for detecting collision with the walls: while (true){ if (xPositon > (300 - radius)){ xSpeed = -xSpeed; } else if (xPositon < radius){ xSpeed = -xSpeed; } else if (yPositon > (300 - radius)) { ySpeed = -ySpeed; } else if (yPositon < radius){ ySpeed = -ySpeed; } xPositon += xSpeed; yPositon += ySpeed; and for the second ball if (xPositon2 > (300 - radius)){ xSpeed2 = -xSpeed2; } else if (xPositon2 < radius){ xSpeed2 = -xSpeed2; } else if (yPositon2 > (300 - radius)) { ySpeed2 = -ySpeed2; } else if (yPositon2 < radius){ ySpeed2 = -ySpeed2; } xPositon2 += xSpeed2; yPositon2 += ySpeed2; the applet is 300 pixels by 300 pixels radius stores the radius of the circles xPositon and xPositon2 store the x cordanents for the two balls yPositon and yPositon store the y cordanents for the two balls xSpeed and xSpeed2 store the x velocities for the two balls ySpeed and ySpeed2 store the y velocities for the two balls I've only taken algebra 1 so please no advanced math or physics.

    Read the article

  • Cepstral Analysis for pitch detection

    - by Ohmu
    Hi! I'm looking to extract pitches from a sound signal. Someone on IRC just explain to me how taking a double FFT achieves this. Specifically: take FFT take log of square of absolute value (can be done with lookup table) take another FFT take absolute value I am attempting this using vDSP I can't understand how I didn't come across this technique earlier. I did a lot of hunting and asking questions; several weeks worth. More to the point, I can't understand why I didn't think of it. I am attempting to achieve this with vDSP library. it looks as though it has functions to handle all of these tasks. However, I'm wondering about the accuracy of the final result. I have previously used a technique which scours the frequency bins of a single FFT for local maxima. when it encounters one, it uses a cunning technique (the change in phase since the last FFT) to more accurately place the actual peak within the bin. I am worried that this precision will be lost with this technique I'm presenting here. I guess the technique could be used after the second FFT to get the fundamental accurately. But it kind of looks like the information is lost in step 2. as this is a potentially tricky process, could someone with some experience just look over what I'm doing and check it for sanity? also, I've heard there is an alternative technique involving fitting a quadratic over neighbouring bins. Is this of comparable accuracy? if so, I would favour it, as it doesn't involve remembering bin phases. so questions: does this approach makes sense? Can it be improved? I'm a bit worried about And the log square component; there seems to be a vDSP function to do exactly that: vDSP_vdbcon however, there is no indication it precalculates a log-table -- I assume it doesn't, as the FFT function requires an explicit pre-calculation function to be called and passed into it. and this function doesn't. Is there some danger of harmonics being picked up? is there any cunning way of making vDSP pull out the maxima, biggest first? Can anyone point me towards some research or literature on this technique? the main question: is it accurate enough? Can the accuracy be improved? I have just been told by an expert that the accuracy IS INDEED not sufficient. Is this the end of the line? Pi PS I get SO annoyed (npi) when I want to create tags, but cannot. :| I have suggested to the maintainers that SO keep track of attempted tags, but I'm sure I was ignored. we need tags for vDSP, accelerate framework, cepstral analysis

    Read the article

  • Browser Detection

    - by Jrgns
    What's the best / simplest / most accurate way to detect the browser of a user? Ease of extendability and implementation is a plus. The less technologies used, the better. The solution can be server side, client side, or both. The results should eventually end up at the server, though. The solution can be framework agnostic. The solution will only be used for reporting purposes.

    Read the article

  • MATLAB: Automatic detection of relations between workspace variables through functions

    - by Peterstone
    Hi all, I´m trying to write a function what detect this relation between the variables I have got in the workspace: v1 - fft(v2) = 0 Where v1, v2 are variables of my workspace. Sometimes I need to know which variables have a certain numerical relation. If I have thirty, I don´t want to be looking for this relation in "manual way", just itroducing a sentence for each pair of different variables. I would like a function in which I introuce (or I modify this function every time I need it) the sentence (for instance what I wrote before) and the function show me the pair of variables a I am looking for. Does anyone know how to do it? Thank you so much!

    Read the article

  • Oval collision detection not working properly

    - by William
    So I'm trying to implement a test where a oval can connect with a circle, but it's not working. edist = (float) Math.sqrt(Math.pow((px + ((pwidth/2) )) - (bx + (bsize/2)), 2) + Math.pow(-((py + ((pwidth/2)) ) - (bx + (bsize/2))), 2)); and here is the full code (requires Slick2D): import org.newdawn.slick.AppGameContainer; import org.newdawn.slick.BasicGame; import org.newdawn.slick.Color; import org.newdawn.slick.GameContainer; import org.newdawn.slick.Graphics; import org.newdawn.slick.Input; import org.newdawn.slick.SlickException; public class ColTest extends BasicGame{ float px = 50; float py = 50; float pheight = 50; float pwidth = 50; float bx = 200; float by = 200; float bsize = 200; float edist; float pspeed = 3; Input input; public ColTest() { super("ColTest"); } @Override public void init(GameContainer gc) throws SlickException { } @Override public void update(GameContainer gc, int delta) throws SlickException { input = gc.getInput(); try{ if(input.isKeyDown(Input.KEY_UP)) py-=pspeed; if(input.isKeyDown(Input.KEY_DOWN)) py+=pspeed; if(input.isKeyDown(Input.KEY_LEFT)) px-=pspeed; if(input.isKeyDown(Input.KEY_RIGHT)) px+=pspeed; } catch(Exception e){} } public void render(GameContainer gc, Graphics g) throws SlickException { g.setColor(new Color(255,255,255)); g.drawString("col: " + col(), 10, 10); g.drawString("edist: " + edist + " dist: " + dist, 10, 100); g.fillRect(px, py, pwidth, pheight); g.setColor(new Color(255,0,255)); g.fillOval(px, py, pwidth, pheight); g.setColor(new Color(255,255,255)); g.fillOval(200, 200, 200, 200); } public boolean col(){ edist = (float) Math.sqrt(Math.pow((px + ((pwidth/2) )) - (bx + (bsize/2)), 2) + Math.pow(-((py + ((pwidth/2)) ) - (bx + (bsize/2))), 2)); if(edist <= (bsize/2) + (px + (pwidth/2))) return true; else return false; } public float rotate(float x, float y, float ox, float oy, float a, boolean b) { float dst = (float) Math.sqrt(Math.pow(x-ox,2.0)+ Math.pow(y-oy,2.0)); float oa = (float) Math.atan2(y-oy,x-ox); if(b) return (float) Math.cos(oa + Math.toRadians(a))*dst+ox; else return (float) Math.sin(oa + Math.toRadians(a))*dst+oy; } public static void main(String[] args) throws SlickException { AppGameContainer app = new AppGameContainer( new ColTest() ); app.setShowFPS(false); app.setAlwaysRender(true); app.setTargetFrameRate(60); app.setDisplayMode(800, 600, false); app.start(); } }

    Read the article

  • how to make a simple collision detection of bitmaps in Android

    - by Dritan Berna
    I already have a code with collision but it has check for winners and ontouch method that I don't really need because my bitmaps are moving itself and I just want them to collide if they overlap. private boolean checkCollision(Grafika first, Grafika second) { boolean retValue = false; int width = first.getBitmap().getWidth(); int height = first.getBitmap().getHeight(); int x1start = first.getCoordinates().getX(); int x1end = x1start + width; int y1start = first.getCoordinates().getY(); int y1end = y1start + height; int x2start = second.getCoordinates().getX(); int x2end = x2start + width; int y2start = second.getCoordinates().getY(); int y2end = y2start + height; if ((x2start >= x1start && x2start <= x1end) || (x2end >= x1start && x2end <= x1end)) { if ((y2start >= y1start && y2start <= y1end) || (y2end >= y1start && y2end <= y1end)) { retValue = true; } } return retValue; }

    Read the article

  • Collision detection problems...

    - by thyrgle
    Hi, I have written the following: -(void) checkIfLineCollidesWithAll { float slope = ((160-L1Circle1.position.y)-(160-L1Circle2.position.y))/((240-L1Circle1.position.x)-(240-L1Circle2.position.x)); float b = (160-L1Circle1.position.y) - slope * (240-L1Circle1.position.x); if ((240-L1Sensor1.position.x) < (240-L1Circle1.position.x) && (240-L1Sensor1.position.x) < (240-L1Circle2.position.x) || ((240-L1Sensor1.position.x) > (240-L1Circle1.position.x) && (240-L1Sensor1.position.x) > (240-L1Circle2.position.x))) { [L1Sensor1 setTexture:[[CCTextureCache sharedTextureCache] addImage:@"SensorOk.png"]]; } else if (slope == INFINITY || slope == -INFINITY) { if (L1Circle1.position.y + 16 >= L1Sensor1.position.y || L1Circle1.position.y - 16 <= L1Sensor1.position.y) { [L1Sensor1 setTexture:[[CCTextureCache sharedTextureCache] addImage:@"SensorBad.png"]]; } else { [L1Sensor1 setTexture:[[CCTextureCache sharedTextureCache] addImage:@"SensorOk.png"]]; } } else if (160-L1Sensor1.position.y + 12 >= slope*(240-L1Sensor1.position.x) + b && 160-L1Sensor1.position.y - 12 <= slope*(240-L1Sensor1.position.x) + b) { [L1Sensor1 setTexture:[[CCTextureCache sharedTextureCache] addImage:@"SensorBad.png"]]; } else { [L1Sensor1 setTexture:[[CCTextureCache sharedTextureCache] addImage:@"SensorOk.png"]]; } } Basically what this does is finds m and b in the well known equation: y = mx + b and then substitutes coordinates of the L1Sensor1 (the circle I'm trying to detect if it it intersects with the line segment) to see if y = mx + b hold true. But, there are two problems, first, when slope approaches infinity the range of what the L1Sensor1 should "react" to (it "reacts" by changing its image) becomes smaller. Also, the code that should handle infinity is not working. Thanks for the help in advanced.

    Read the article

  • Collision Detection for arbitrarily sized, positioned and rotated rectangles in XNA

    - by Stefan
    I'm working with xna in C# and in my game I will have a variety of space ships flying all over the place. They will each have an arbitrary rotation, size and position in space and I need a method to determine when they collide. Ideally the method would take two Rectangles, two doubles and two Vector2s for size, rotation and position respectively and return a boolean that indicates whether they have intersected or not.

    Read the article

  • Detection screen disconnection in linux

    - by Dark Templer
    Hey Guys We have a nasty little problem. In short we can detect if a screen is connect when x11 boots (we do this by looking at the log - Xorg.0.log), but we are having trouble detect when are screen is disconnected while the machine is running (ie post x11 boot) Any one have any ideas? Cheers

    Read the article

  • Square collision detection problem (iPhone).

    - by thyrgle
    Hi, I know I've probably posted three questions related to this then deleted them, but thats only because I solved them before I got an answer. But, this one I can not solve and I don't believe it is that hard compared to the others. So, with out further ado, here is my problem: So I am using Cocos2d and one of the major problem is they don't have buttons. To compensate for there lack in buttons I am trying to detect if when a touch ended did it collide with a square (the button). Here is my code: - (void)ccTouchesEnded:(NSSet*)touches withEvent:(UIEvent*)event { UITouch *touch = [touches anyObject]; CGPoint location = [touch locationInView:touch.view]; NSLog(@"%f", 240-location.y); if (isReady == YES) { if (((240-location.y) <= (240-StartButton.position.x - 100) || -(240-location.y) >= (240-StartButton.position.x) + 100) && ((160-location.x) <= (160-StartButton.position.y) - 25 || (160-location.x) >= (160-StartButton.position.y) + 25)) { NSLog(@"Coll:%f", 240-StartButton.position.x); CCScene *scene = [PlayScene node]; [[CCDirector sharedDirector] replaceScene:[CCZoomFlipAngularTransition transitionWithDuration:2.0f scene:scene orientation:kOrientationRightOver]]; } } } Do you know what I am doing wrong?

    Read the article

  • Install ubuntu-11.10-desktop-amd64 with Logitech diNovo Edge

    - by MyGGaN
    I know there are problems (and have been for quite some time) with the diNovo Edge keyboard. The solution could be found easily and often you can use the on-screen keyboard to fix it. Now I'm installing Ubuntu from scratch and the only keyboard I have is my diNovo, am I screwed? You are able to get to System Config during the install process and from there to Accessibility menu where you usually can start the on-screen keyboard. This doesn't work, no keyboard in sight... What if I can do some ninja copy-paste with the mouse?? Nope, no pasting allowed in the feilds: username, password, etc. Is there a chance I can fix this somehow within the .iso file before I create the bootable USB drive I use to install from? Or do I have to buy a keyboard to be able to install Ubuntu?

    Read the article

  • Dealing with a developer continuously ignoring edge cases in his work

    - by Alex N.
    I have an interesting, fairly common I guess, issue with one of the developers in my team. The guy is a great developer, work fast and productive, produces fairly good quality code and all. Good engineer. But there is a problem with him - very often he fails to address edge cases in his code. We spoke with him about it many times and he is trying but I guess he just doesn't think this way. So what ends up happening is that QA would find plenty issues with his code and return it back for development again and again, ultimately resulting in missed deadlines and everyone in the team unhappy. I don't know what to do with him and how to help him overcome this problem. Perhaps someone with more experience could advise? Thank you!

    Read the article

  • Right edge border unpainted & theme drawing on non client area

    - by CodeVisio
    Basically, the problem concerns border flickering during window resizing on Windows. My first goal was to repositioning controls on a dialog during resizing of it. I think I got a good dynamic repositioning without almost any flickering during this operation, but here I'm talking about main window border flickering. However, I wasn't able to eliminate it at all. To simplify the example try to create a simple win32 app with default code VS provided. I'm testing it on Window 7(64bit) with the default theme (Windows 7 basic, no transparency) and VS2008. 1) Do not add code to the app. 2) run it in debug mode. 3) Drag the left edge of the window slowly toward the left of the screen and at the same time keep an eye on the right edge border of the window. You should see a redrawing taking in action. 4) Repeat step 3 moving rapidly the mouse, you should see the flickering on the right edge more clearly. If you invert the edge, that is moving the right edge of the window, then the left edge stay firmly there without unpainted regions. The same process happens for the top edge border vs. the bottom one. Now, enable he Classic Theme (that similar to Win2000) and repeat again the steps above. The right edge is perfectly there without flickering at all! If you keep an eye in the Output Window of Visual Studio when you run in debug mode you should see a list of dll loaded together with your exe. If you run in debug mode with the default theme you will see uxtheme.dll loaded. On the contrary, with classic theme enabled the uxtheme.dll is not loaded (dwmapi.dll is always loaded). Probably uxtheme.dll is loaded at runtime, based on desktop settings and it takes in action for redrawing your windows non-client area. Another trick you could use to see the effect of this flickering is to add a case for WM_NCPAINT and return 0 instead to call the DefWindowProc(). Repeating the steps above and moving fast you should see a big part of the right edge of the window completely erased by background windows. This doesn't happen for the top and bottom ones. Any idea to resolve this flickering? Thank you!

    Read the article

  • Bleeding Edge 2012 – session material

    - by Hugo Kornelis
    As promised, here are the slide deck and demo code I used for my presentation at the Bleeding Edge 2012 conference in Laško, Slovenia. Okay, I promised to have them up by Tuesday or Wednesday at worst, and it is now Saturday – my apologies for the delay. Thanks again to all the attendees of my session. I hope you enjoyed it, and if you have any question then please don’t hesitate to get in touch with me. I had a great time in Slovenia, both during the event and in the after hours. Even if everything...(read more)

    Read the article

  • Need to adjust touchpad edge scroll area

    - by MikeVB
    I have an Acer Aspire that I have dual booting XP and Ubuntu. On the Windows side, the driver allows you to set how close your finger has to be to the edge of the touchpad before it goes into scroll mode. In Ubuntu I don't have the option (at least in the GUI) to change the scroll area on the pad. Is there a conf file or other way to change this? I'm constantly getting into the scroll area during normal usage. I would like to leave it on without losing so much pad area to the scroll feature. Thanks a lot.

    Read the article

  • How to determine edges in an images optimally?

    - by SorinA.
    I recently was put in front of the problem of cropping and resizing images. I needed to crop the 'main content' of an image for example if i had an image similar to this: the result should be an image with the msn content without the white margins(left& right). I search on the X axis for the first and last color change and on the Y axis the same thing. The problem is that traversing the image line by line takes a while..for an image that is 2000x1600px it takes up to 2 seconds to return the CropRect = x1,y1,x2,y2 data. I tried to make for each coordinate a traversal and stop on the first value found but it didn't work in all test cases..sometimes the returned data wasn't the expected one and the duration of the operations was similar.. Any idea how to cut down the traversal time and discovery of the rectangle round the 'main content'? public static CropRect EdgeDetection(Bitmap Image, float Threshold) { CropRect cropRectangle = new CropRect(); int lowestX = 0; int lowestY = 0; int largestX = 0; int largestY = 0; lowestX = Image.Width; lowestY = Image.Height; //find the lowest X bound; for (int y = 0; y < Image.Height - 1; ++y) { for (int x = 0; x < Image.Width - 1; ++x) { Color currentColor = Image.GetPixel(x, y); Color tempXcolor = Image.GetPixel(x + 1, y); Color tempYColor = Image.GetPixel(x, y + 1); if ((Math.Sqrt(((currentColor.R - tempXcolor.R) * (currentColor.R - tempXcolor.R)) + ((currentColor.G - tempXcolor.G) * (currentColor.G - tempXcolor.G)) + ((currentColor.B - tempXcolor.B) * (currentColor.B - tempXcolor.B))) > Threshold)) { if (lowestX > x) lowestX = x; if (largestX < x) largestX = x; } if ((Math.Sqrt(((currentColor.R - tempYColor.R) * (currentColor.R - tempYColor.R)) + ((currentColor.G - tempYColor.G) * (currentColor.G - tempYColor.G)) + ((currentColor.B - tempYColor.B) * (currentColor.B - tempYColor.B))) > Threshold)) { if (lowestY > y) lowestY = y; if (largestY < y) largestY = y; } } } if (lowestX < Image.Width / 4) cropRectangle.X = lowestX - 3 > 0 ? lowestX - 3 : 0; else cropRectangle.X = 0; if (lowestY < Image.Height / 4) cropRectangle.Y = lowestY - 3 > 0 ? lowestY - 3 : 0; else cropRectangle.Y = 0; cropRectangle.Width = largestX - lowestX + 8 > Image.Width ? Image.Width : largestX - lowestX + 8; cropRectangle.Height = largestY + 8 > Image.Height ? Image.Height - lowestY : largestY - lowestY + 8; return cropRectangle; } }

    Read the article

< Previous Page | 5 6 7 8 9 10 11 12 13 14 15 16  | Next Page >