Computer Science Canada

how to write java code to detect the white string?

Author:  ika [ Tue Jun 05, 2012 3:37 am ]
Post subject:  how to write java code to detect the white string?

hello fellows,

please help me to solve this problem.
i.m new in using java and i do not really understand how to use java..

my problem is, how to detect the white string on the human body from the picture

Author:  Tony [ Tue Jun 05, 2012 11:16 am ]
Post subject:  Re: how to write java code to detect the white string?

ika @ Tue Jun 05, 2012 3:37 am wrote:
i do not really understand how to use java..

Then this is definitely not the problem for you to get started with.

Author:  ika [ Mon Jun 11, 2012 4:01 am ]
Post subject:  Re: how to write java code to detect the white string?

the string have been detected, but then i still dot get the solution how to detect the shoulder and get the measurement..

help me please.. Crying or Very sad

Author:  Dan [ Mon Jun 11, 2012 10:38 am ]
Post subject:  RE:how to write java code to detect the white string?

As Tony stated, this is not a simple project for some one new to Java and algorthims for tracking objects in real time can be rather complex.

However, there are some libraries and APIs out there to help with the task and obscure some of the compleixy. I recomend you start Googling for a montion tracking or augmented reality framework for Java.

If you do want to implment it your self, I am sure there are many documents out there describe the comonly used algorithms.


Edit: If your goal is just to try and get body measurements of the person in a static image, then the task is much easier if the length of the white string is fixed. You can use the fixed length of the string to determine the scale of pixels in the image to a real mesurment and would just need to filter out the background to determine where the persons body is.

Author:  ika [ Mon Jun 18, 2012 2:58 am ]
Post subject:  Re: how to write java code to detect the white string?

this is some of my work....

import java.io.*;
import java.awt.*;
import javax.imageio.ImageIO;
import java.awt.image.BufferedImage;

public class GetPixelColor
{
private static int maxCnt;

public static void main(String args[]) throws IOException
{

File file= new File("image.jpg");
BufferedImage image = ImageIO.read(file);
int array[][] = new int [300][400];


for(int i=0; i<300; i++)
{
for(int j=0; j<400; j++)
{
// Getting pixel color by position x=j and y=j
int clr= image.getRGB(j,i);
int red = (clr & 0x00ff0000) >> 16;
int green = (clr & 0x0000ff00) >> 8;
int blue = clr & 0x000000ff;

//System.out.println("..................................");
//System.out.println("Red Color value = "+ red);
//System.out.println("Green Color value = "+ green);
//System.out.println("Blue Color value = "+ blue);
//System.out.println("..................................");

if((red >= 160 && red <= 200) && (green >= 160 && green <= 190) && (blue >= 160 && blue <= 180))
{
//if(red > 160 && green > 160 && blue > 180)
// System.out.print("{"+j+"||"+i+"[0]}");
array[i][j] = 0;
System.out.print("0");
}
else
{
array[i][j] = 1;
System.out.print("-");
}
}
System.out.println();
}

System.out.println(array[0].length);
System.out.println(array.length);

for (int i = (400-1); i >= 0; i--)
{
for(int j = (300-1); j >= 0; j--)
{
System.out.print(array[j][i]);
if(array[j][i] == 0)
{
System.out.print("position2 : x="+i+" y="+j);
i = -1;
break;
}
}
System.out.println();
}

for (int i = 0; i <400; i++)
{
for(int j = 0; j < 300; j++)
{
System.out.print(array[j][i]);
if(array[j][i] == 0)
{
System.out.print("position1 : x="+i+" y="+j);
i = 400;
break;
}
}
System.out.println();
}
}

}



//there is lots of work should i improve Sad

Author:  ika [ Mon Jun 18, 2012 3:01 am ]
Post subject:  RE:how to write java code to detect the white string?

the string on the body is 10 inches


: