i'm new in programming. i wanted to code a program that can identify which banana is ripe. basically i have 2 image of banana, one yellow in color and another one is green.
first, i want to get the image. then i need to get the rgb values from the image. next, i have to get the pixel but i stuck there. can anyone help? i have here some code i wrote but its not much because i dunno how to proceed. please help.
import java.io.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;
public class banana
{
public static void main(String [] args)throws Exception
{
//get image
File imageFile= new File("yellowbanana.jpg");
BufferedImage image = ImageIO.read(imageFile);
//if file not exist
if(!(imageFile.exists())){
System.out.println("File NOT exists");
System.exit(0);}
int w = image.getWidth();
int h = image.getHeight();
System.out.println("w=" + w + ", h=" + h);
Edited by Roger, 16 December 2011 - 08:29 AM.
moved to correct forum + added code tags


Sign In
Create Account

Back to top










