Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Analyzing the Waterline, and Sand Bed Profiles using Java
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Spartan_117




PostPosted: Wed Jul 20, 2005 10:05 am   Post subject: Analyzing the Waterline, and Sand Bed Profiles using Java

Im making a program that will analyze an image and distinguish between the sand, the water, and the air. To do this i need to analyze RGB (Red, Green, and Blue) values. How do i do this in Java? I know of the Robot class and the method getPixelColor, but that keeps giving me an error saying, u must throw AWT Exception or something. Also, this wont give me the RGB values, and i will also need to know the co-ordinates of the mouse (something like mousewhere in Turing) so if anyone knows how I can do this it would be of great help.

Thx
Sponsor
Sponsor
Sponsor
sponsor
1of42




PostPosted: Wed Jul 20, 2005 3:05 pm   Post subject: Re: Analyzing the Waterline, and Sand Bed Profiles using Jav

Spartan_117 wrote:
Im making a program that will analyze an image and distinguish between the sand, the water, and the air. To do this i need to analyze RGB (Red, Green, and Blue) values. How do i do this in Java? I know of the Robot class and the method getPixelColor, but that keeps giving me an error saying, u must throw AWT Exception or something. Also, this wont give me the RGB values, and i will also need to know the co-ordinates of the mouse (something like mousewhere in Turing) so if anyone knows how I can do this it would be of great help.

Thx


Honestly, I think that's a misuse of the Robot class. I believe that class is meant for testing your graphical apps as opposed to being the app itself.

I think what you'd have to do would be to write an algorithm that analyses the actual image file in some way, and use those values to find RGB values.
Hikaru79




PostPosted: Wed Jul 20, 2005 5:40 pm   Post subject: (No subject)

That is a misuse of the Robot class. I know I mentioned it myself in an earlier thread, but that was in order to take a screenshot of the entire display, not just to look at image. You can load an Image into Java and do things with it using the Image class. Using the Robot class for this is bad.

Here's a neat little applet showing some Java Image processing.
http://figment.csee.usf.edu/~mpowell/javaip.html
Spartan_117




PostPosted: Wed Jul 20, 2005 7:02 pm   Post subject: (No subject)

U wrote:
I think what you'd have to do would be to write an algorithm that analyses the actual image file in some way, and use those values to find RGB values.


an algorithm that analyses the image in some way, well no offense but thats not that specific, and im a lil newb wen it comes to graphics especially. Thx for telling me the Robot class was not a good idea, cuz i was kinda new to that too and i had no clue wut i was doing. And i looked at ur link Hikaru and its pretty cool, ill have to read more to get somewhere, but im still a lil lost Confused Right now im doin the program in turing so i hav something for now cuz its got an RGB class already so its much easier. But Java is just more.... better, than Turing. So i wanna do it in Java as well; in fact its better that i do it in Java.
rizzix




PostPosted: Wed Jul 20, 2005 7:12 pm   Post subject: (No subject)

Ehm, once you are comfortable with reading the JAVA API Specifications then you will realise Java is the easiest language to master, provided you have good javadocs.

The Java Standard API is fairly well documented. Learn to use it (those javadocs i.e) and you will find your self better able to cope with many new situtations on your own. That is what I would recommend you to master first. Just try and read through the stuff you already know how to use, then compare that knowledge you gained and apply it with the stuff that is new to you. That is the best way to learn.

Mastering the skill to read the javadocs is basically mastering the most important aspect of being an independent java programmer.

Either way, as a hint look up the javax.imageio package, specifically its ImageIO class and then also the java.awt's Image & BufferedImage classes. That should be all you need to know to do basic image manipulations.

If you are still lost, please post.
Spartan_117




PostPosted: Wed Jul 20, 2005 9:06 pm   Post subject: (No subject)

rizzix wrote:
Ehm, once you are comfortable with reading the JAVA API Specifications then you will realise Java is the easiest language to master, provided you have good javadocs.

The Java Standard API is fairly well documented. Learn to use it (those javadocs i.e) and you will find your self better able to cope with many new situtations on your own. That is what I would first recommend you to master. Just try and read through the stuff you already know how to use, then compare that knowledge you gained and apply it with the stuff that is new to you. That is the best way to learn.

Mastering the skill to read the javadocs is basically mastering the most important aspect of being an independent java programmer.

Either way, as a hint look up the javax.imageio package, specifically its ImageIO class and then also the java.awt's Image & BufferedImage classes. That should be all you need to know to do basic image manipulations.

If you are still lost, please post.



Thanx a lot man great help. I gotta check out javadocs, is it www.javadocs.org? or i think some IDE's come with it. Where can i find the Java API?
THx again
Hikaru79




PostPosted: Wed Jul 20, 2005 9:39 pm   Post subject: (No subject)

Spartan_117 wrote:
Thanx a lot man great help. I gotta check out javadocs, is it www.javadocs.org? or i think some IDE's come with it. Where can i find the Java API?
THx again

javadocs.org will work, as its a searchable index of the core docs as well as some third-party libraries if I'm not mistaken. But I believe the one that rizzix was reffering to is at: http://java.sun.com/j2se/1.5.0/docs/api/index.html

Basically what the JavaDoc (also known as the API specification -- JavaDoc is a bit of a misnomer since that's the name of the tool used to generate the HTML you see) is a nicely formatted description of everything you need to know to implement just about anything in the Java Standard Library. It will list all an object's relevant methods, fields, exceptions, etc. As Rizzix said, learn to use it wisely.

I should make a tutorial on how to decipher those things, as it seems a lot of people don't know what the API specification is, where it is located, or how to get the most of it.
rizzix




PostPosted: Wed Jul 20, 2005 10:33 pm   Post subject: (No subject)

Hikaru79 wrote:
JavaDoc is a bit of a misnomer since that's the name of the tool used to generate the HTML you see
Yes it is the name of the tool but it is also the name of the technology and the product as a whole, i.e the hyperlinked html documentation, the tags, the concept etc.

Nevertheless by javadocs I wasn't just refering to the Java Standard API Specifications. That is just one of the many documentations available. One does not always have to rely only on the Standard set of API. It is best to explore and try out other stuff, but of course only if he or she has mastered the skill to read those docs and understand them. Most java projects are well documented. So I say take advantage of this fact and get all the more productive. There is not point in re-inventing the wheel, only of course if your objective is to learn the basics, but once you have passed that level, it is even better to build new more complex (but not necessarily complicated) projects over these well designed and tested libraries.

To clarify a missconception or infrom those who are unaware: the "Java Standard API Reference" is a special type of documentation. It is special because it is more than just a mere documentation. It is a "Specification" and not just simply a "Reference". It defines what the Java SE/EE/ME API is to look like in any implementation of Java. It defines a standard.

Yet for us mere programmer, of course, it is nothing but just a mere reference and nothing more...
Sponsor
Sponsor
Sponsor
sponsor
Spartan_117




PostPosted: Thu Jul 21, 2005 7:56 am   Post subject: (No subject)

Hikaru79 wrote:
Spartan_117 wrote:
Thanx a lot man great help. I gotta check out javadocs, is it www.javadocs.org? or i think some IDE's come with it. Where can i find the Java API?
THx again

javadocs.org will work, as its a searchable index of the core docs as well as some third-party libraries if I'm not mistaken. But I believe the one that rizzix was reffering to is at: http://java.sun.com/j2se/1.5.0/docs/api/index.html

Basically what the JavaDoc (also known as the API specification -- JavaDoc is a bit of a misnomer since that's the name of the tool used to generate the HTML you see) is a nicely formatted description of everything you need to know to implement just about anything in the Java Standard Library. It will list all an object's relevant methods, fields, exceptions, etc. As Rizzix said, learn to use it wisely.

I should make a tutorial on how to decipher those things, as it seems a lot of people don't know what the API specification is, where it is located, or how to get the most of it.


Yes i believe i've been to this website before and it is quite useful. But i didnt really get the most out of it being new to it and everything. Thx for the help and i'd love to see ur tutorial for it!
Spartan_117




PostPosted: Thu Jul 21, 2005 8:02 am   Post subject: (No subject)

I took a look at BufferedImage and at the top this is what it gave me

java.awt.image
Class BufferedImage

java.lang.Object
java.awt.Image
java.awt.image.BufferedImage


Does this mean i have to import all of these, or jus java.lang.Object?

Also is there a website that has simple examples usings these classes? I believe i've been to one on the java site, but i dont remember where
Hikaru79




PostPosted: Thu Jul 21, 2005 3:30 pm   Post subject: (No subject)

Spartan_117 wrote:
I took a look at BufferedImage and at the top this is what it gave me

java.awt.image
Class BufferedImage

java.lang.Object
java.awt.Image
java.awt.image.BufferedImage


Does this mean i have to import all of these, or jus java.lang.Object?

Neither. The part at the bottom that lists three classes shows its hierarchy. What it is saying is that BufferedImage is a subclass of Image which is a subclass of Object. The only thing you need to import it
Java:
import java.awt.image.*;
Spartan_117




PostPosted: Tue Jul 26, 2005 2:12 pm   Post subject: (No subject)

Spartan_117 wrote:
Also is there a website that has simple examples usings these classes? I believe i've been to one on the java site, but i dont remember where


Is there?
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 12 Posts ]
Jump to:   


Style:  
Search: