The Science Forum - Scientific Discussion and Debate  
 
 Live Chat    FAQ    Search    Usergroups
 
Register  ::  Log in Log in to check your private messages
 
Science Forum Forum Index » Computer Science » Java program I made!

  
 Java program I made! « View previous topic :: View next topic » 
Author Message
DivideByZero
Posted: Tue Jan 22, 2008 7:51 pm    Post subject: Java program I made! Reply with quote

Forum Junior
Forum Junior

Joined: 02 Dec 2007
Posts: 256

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.
Back to top
View user's profile Send private message
marnixR
Posted: Wed Jan 23, 2008 12:57 am    Post subject: Reply with quote

Forum Isotope
Forum Isotope

Joined: 10 Apr 2007
Posts: 2783
Location: Cardiff, Wales

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
_________________
if you find this place too crowded or too confrontational, how about trying Philosophorum,
the amicable forum where small is beautiful and even the trolls are intelligent

biology without evolution is but stamp collecting
Back to top
View user's profile Send private message Send e-mail Visit poster's website
425 Chaotic Requisition
Posted: Wed Jan 23, 2008 4:52 am    Post subject: Reply with quote

The Doctor

Joined: 18 Jun 2007
Posts: 3443
Location: England, UK.

It stops 'thinking' at 99%. Much like humans really Laughing.

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.
_________________
"Victory is in trying. Defeat is in not". - SVRDW.
Back to top
View user's profile Send private message Send e-mail AIM Address Yahoo Messenger MSN Messenger
DivideByZero
Posted: Wed Jan 23, 2008 5:01 am    Post subject: Reply with quote

Forum Junior
Forum Junior

Joined: 02 Dec 2007
Posts: 256

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.
Back to top
View user's profile Send private message
marnixR
Posted: Wed Jan 23, 2008 6:24 am    Post subject: Reply with quote

Forum Isotope
Forum Isotope

Joined: 10 Apr 2007
Posts: 2783
Location: Cardiff, Wales

DivideByZero wrote:
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
_________________
if you find this place too crowded or too confrontational, how about trying Philosophorum,
the amicable forum where small is beautiful and even the trolls are intelligent

biology without evolution is but stamp collecting
Back to top
View user's profile Send private message Send e-mail Visit poster's website
sunshinewarrior
Posted: Wed Jan 23, 2008 7:43 am    Post subject: Reply with quote

Forum Ph.D.
Forum Ph.D.

Joined: 26 Sep 2007
Posts: 1049
Location: London

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
Back to top
View user's profile Send private message
DivideByZero
Posted: Wed Jan 23, 2008 11:46 am    Post subject: Reply with quote

Forum Junior
Forum Junior

Joined: 02 Dec 2007
Posts: 256

sunshinewarrio wrote:
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?
Back to top
View user's profile Send private message
marnixR
Posted: Wed Jan 23, 2008 12:57 pm    Post subject: Reply with quote

Forum Isotope
Forum Isotope

Joined: 10 Apr 2007
Posts: 2783
Location: Cardiff, Wales

seems to work at home

but yeah, i agree with shanks : it's a bit slow
_________________
if you find this place too crowded or too confrontational, how about trying Philosophorum,
the amicable forum where small is beautiful and even the trolls are intelligent

biology without evolution is but stamp collecting
Back to top
View user's profile Send private message Send e-mail Visit poster's website
serpicojr
Posted: Thu Jan 24, 2008 5:48 am    Post subject: Reply with quote

Forum Professor
Forum Professor

Joined: 17 Jul 2007
Posts: 1128
Location: JRZ

DivideByZero wrote:

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...
Back to top
View user's profile Send private message
sunshinewarrior
Posted: Thu Jan 24, 2008 7:08 am    Post subject: Reply with quote

Forum Ph.D.
Forum Ph.D.

Joined: 26 Sep 2007
Posts: 1049
Location: London

DivideByZero wrote:

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?
Back to top
View user's profile Send private message
DivideByZero
Posted: Thu Jan 24, 2008 11:37 am    Post subject: Reply with quote

Forum Junior
Forum Junior

Joined: 02 Dec 2007
Posts: 256

sunshinewarrio wrote:
DivideByZero wrote:

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)
Back to top
View user's profile Send private message
Display posts from previous:   
   Page 1 of 1

Science Forum Forum Index » Computer Science » Java program I made!
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
 
 


Google
 

© 2004-2008 Thescienceforum.com

Sponsored by EnluxLED

Partner Forums
Politics Forum  Radar Detector