Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
add ColorImages.print() method
  • Loading branch information
dlegland committed Jul 31, 2017
1 parent df24db8 commit 0755e1e
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/main/java/inra/ijpb/data/image/ColorImages.java
Expand Up @@ -48,6 +48,29 @@ private ColorImages()
{
}

/**
* Prints the content of the input color image on the console. This can be
* used for debugging (small) images.
*
* @param image
* the color image to display on the console
*/
public static final void print(ColorProcessor image)
{
for (int y = 0; y < image.getHeight(); y++)
{
for (int x = 0; x < image.getWidth(); x++)
{
int intCode = image.get(x, y);
int r = (intCode & 0xFF0000) >> 16;
int g = (intCode & 0xFF00) >> 8;
int b = (intCode & 0xFF);
System.out.print(String.format("(%3d,%3d,%3d) ", r, g, b));
}
System.out.println("");
}
}

/**
* Splits the channels of the color image into three new instances of
* ByteProcessor.
Expand Down

0 comments on commit 0755e1e

Please sign in to comment.