Go Back   TechArena Community > Software > Software Development
Become a Member!
Forgot your username/password?
Register Tags Active Topics RSS Search Mark Forums Read

Sponsored Links



region growing method, java code

Software Development


Reply
 
Thread Tools Search this Thread
  #1  
Old 26-03-2012
Member
 
Join Date: Jul 2011
Posts: 1
region growing method, java code
  

Hi,
I’m a master student ,
I’m preparing my master right now,it’s about the images classification.
I really need “region growing methode” java code.
Thanks to help me.

Reply With Quote
  #2  
Old 27-03-2012
Member
 
Join Date: Jan 2006
Posts: 605
Re: region growing method, java code

I normally use the UntiledOpImage subclass, wich should work fine for region growing (I ask for someone confirming: even on tiled images, when computing output image the source will be presented as untiled... the method will present also a comptabile writeable raster:

Here is a snippet of my code:
Code:
Stack pstack = new Stack(); /* Keep track of neightboor pixel */
Vector visited = new Vector(0); /* Keep track of visited pixel */

/* Getfundamental informations */
Raster r = source0.getTile(x, y);
int minX = 0;
int minY = 0;
int width = source0.getTileWidth();
int height = source0.getTileHeight();

/* Compute the resulting image */
WritableRaster wr = r.createCompatibleWritableRaster(minX, minY, width, height);

/* Set all pixel black XXX Necessary? */
for (int a = 0; a < height; a++) {
for (int b = 0; b < width; b++)
wr.setSample(b + minX, a + minY, 0, 0);
}

/* Iterate on all origins */
for (int i = 0; i < origins.length; i++) {
/* Push origin */
pstack.push(origins[i]);

while (pstack.empty() == false) {
Point point = (Point)pstack.pop();

if (visited.contains(point) == false) {
int value = r.getSample(point.x + minX, point.y + minY, 0);

visited.add(point);

if ((value >= low) && (value <= high)) {
Point border;

/* Write the current pixel (within intervall) to the destination raster */
wr.setSample(point.x + minX, point.y + minY, 0, value);

/* Push all border pixel for region growing */
if (point.x - 1 >= minX) { /* Left border */
border = new Point(point.x - 1, point.y);
if (pstack.search(border) == -1)
pstack.push(border);
}
if (point.y - 1 >= minY) { /* Upper border */
border = new Point(point.x, point.y - 1);
if (pstack.search(border) == -1)
pstack.push(border);
}
if (point.x + 1 < width) { /* Right border */
border = new Point(point.x + 1, point.y);
if (pstack.search(border) == -1)
pstack.push(border);
}
if (point.y + 1 < height) { /* Bottom order */
border = new Point(point.x, point.y + 1);
if (pstack.search(border) == -1)
pstack.push(border);
}
}
}
}
}

/* Returns the filtered raster with regions grown */
return (wr);
Reply With Quote
Reply

  TechArena Community > Software > Software Development
Tags: , ,



Thread Tools Search this Thread
Search this Thread:

Advanced Search


Similar Threads for: "region growing method, java code"
Thread Thread Starter Forum Replies Last Post
How to change the region code for printer. Limitless Hardware Peripherals 6 26-11-2011 06:59 AM
DVD decrypter to remove region code protection Mahendra varma Hardware Peripherals 4 15-12-2010 03:20 PM
What is method overriding and method overloading in java beelow Software Development 3 17-11-2009 08:20 AM
Java: How can I call one method in another method? biohazard 76 Software Development 3 16-07-2009 08:12 PM
Error - region code weird issues dECLANn Media Player 2 28-01-2009 01:05 PM


All times are GMT +5.5. The time now is 11:10 AM.