Notices
Results 1 to 11 of 11

Thread: Java program I made!

  1. #1 Java program I made! 
    Forum Junior DivideByZero's Avatar
    Join Date
    Dec 2007
    Posts
    260
    I created this neat Java applet where you click around anywhere as many times you want then click "calculate". After its done thinking, it will find the pixel closest to all of the places you clicked.

    I can't really explain it well so please view my applet
    http://braintyrant.googlepages.com/java

    What do you think of it? I'm a new developer so please critique.

    I put a map of italy on the background and clicked every city except rome then clicked calculate. And then the closest pixel was very close to rome.


    Reply With Quote  
     

  2.  
     

  3. #2  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,810
    i don't seem to get past the stage where it says 'Loading Java Applet'
    the page remains like that for the last few minutes - far too long for anyone to hang around + wait to see whether it will ever appear


    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  4. #3  
    The Doctor Quantime's Avatar
    Join Date
    Jun 2007
    Location
    United Kingdom
    Posts
    4,546
    It stops 'thinking' at 99%. Much like humans really .

    I have got an image of lines (green lines) going in funny directions from the plotted co-ordinates I placed randomly:



    The colour is not accurate because I saved it as a J-PEG.
    "If you wish to make an apple pie from scratch, you must first invent the universe". - Carl Sagan
    Reply With Quote  
     

  5. #4  
    Forum Junior DivideByZero's Avatar
    Join Date
    Dec 2007
    Posts
    260
    marnixR, you might not have the current version of java or your computer might be just a bit slow.

    svwillmer, try going back to the applet and clicking randomly. Then click calculate and just wait. Don't click anything else (i.e. clicking around different tabs or minimizing the window). Also you should only click calculate once. If you want to run the applet again then refresh the page. Hope this helps.
    Reply With Quote  
     

  6. #5  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,810
    Quote Originally Posted by DivideByZero
    marnixR, you might not have the current version of java or your computer might be just a bit slow.
    the version i have on my PC runs Java 2 SDK Standard Edition v1.3 - which one is required ?
    i doubt whether it's the PC being slow - 3.4GHz and 2GB RAM should be plenty
    on the other hand we sometimes have a slow network, so that could be a contributing factor
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  7. #6  
    Forum Professor sunshinewarrior's Avatar
    Join Date
    Sep 2007
    Location
    London
    Posts
    1,525
    Hey there dividebyzero (or is it ok to call you Nishant?)

    I tried it and it worked and I think it could be quite a neat little thing (the example you provided showed how).

    Two things I noted:

    1. It seems to work quite slowly

    2. Is there a possibility of copy-pasting a designed shape in the form of a series of points onto it?

    Nice one.

    cheer

    shanks
    Reply With Quote  
     

  8. #7  
    Forum Junior DivideByZero's Avatar
    Join Date
    Dec 2007
    Posts
    260
    Quote Originally Posted by sunshinewarrio
    Hey there dividebyzero (or is it ok to call you Nishant?)

    I tried it and it worked and I think it could be quite a neat little thing (the example you provided showed how).

    Two things I noted:

    1. It seems to work quite slowly

    2. Is there a possibility of copy-pasting a designed shape in the form of a series of points onto it?

    Nice one.

    cheer

    shanks
    It worked slowly because the program goes through each pixel to calculate it's distance from the points. After all that it orders all the distances from least to greatest.

    What do you mean by #2?
    a designed shape? Like a picture of a hexagon being copy and pasted over onto the background of the program?
    Reply With Quote  
     

  9. #8  
    WYSIWYG Moderator marnixR's Avatar
    Join Date
    Apr 2007
    Location
    Cardiff, Wales
    Posts
    5,810
    seems to work at home

    but yeah, i agree with shanks : it's a bit slow
    "Reality is that which, when you stop believing in it, doesn't go away." (Philip K. Dick)
    Reply With Quote  
     

  10. #9  
    Forum Professor serpicojr's Avatar
    Join Date
    Jul 2007
    Location
    JRZ
    Posts
    1,069
    Quote Originally Posted by DivideByZero
    It worked slowly because the program goes through each pixel to calculate it's distance from the points. After all that it orders all the distances from least to greatest.
    Surely you must be able to come up with a better algorithm...
    Reply With Quote  
     

  11. #10  
    Forum Professor sunshinewarrior's Avatar
    Join Date
    Sep 2007
    Location
    London
    Posts
    1,525
    Quote Originally Posted by DivideByZero
    What do you mean by #2?
    a designed shape? Like a picture of a hexagon being copy and pasted over onto the background of the program?
    A picture made of dots or points, yes. If I converted the outline of the Mona Lisa to a set of dots, would it calculate, as it were, the planar centre-of-gravity of her face?
    Reply With Quote  
     

  12. #11  
    Forum Junior DivideByZero's Avatar
    Join Date
    Dec 2007
    Posts
    260
    Quote Originally Posted by sunshinewarrio
    Quote Originally Posted by DivideByZero
    What do you mean by #2?
    a designed shape? Like a picture of a hexagon being copy and pasted over onto the background of the program?
    A picture made of dots or points, yes. If I converted the outline of the Mona Lisa to a set of dots, would it calculate, as it were, the planar centre-of-gravity of her face?
    Oh I see what you mean.
    I should try that!
    Well before I do that, my next project is to make shape recognition eyes.
    I'll have 2 webcams 6 inches away from each other that project what they see to the computer. Then I'll write a code to find the difference of the displacement of a pixel from the two cameras. I'll try to figure out some ratio to convert that pixel-distance to centimeters. That way with those two eyes I can measure distance!
    Once I'm done with that I'm going to make a quick color recognition software (not hard).
    Then a shape recognition software (lot harder).
    Then a face recognition software!!! (impossible!!! lol)
    Reply With Quote  
     

Bookmarks
Bookmarks
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •