Here you can find the source of thresholdFilter(int threshholdLevel, BufferedImage image)
public static BufferedImage thresholdFilter(int threshholdLevel, BufferedImage image)
//package com.java2s; /*/*from w w w. j av a 2 s . co m*/ * $Id: PixelUtil.java,v 1.3 2007/01/29 09:08:46 eiki Exp $ Created on May 29, * 2006 * * Copyright (C) 2006 Idega Software hf. All Rights Reserved. * * This software is the proprietary information of Idega hf. Use is subject to * license terms. */ import java.awt.image.BufferedImage; import java.awt.image.LookupOp; import java.awt.image.LookupTable; import java.awt.image.ShortLookupTable; public class Main { /** * Create the filter to execute a threshold setting on the color component * values. */ public static BufferedImage thresholdFilter(int threshholdLevel, BufferedImage image) { short[] threshold = new short[256]; for (int i = threshholdLevel; i < 256; i++) threshold[i] = (short) i; LookupTable threshold_table = new ShortLookupTable(0, threshold); LookupOp threshold_op = new LookupOp(threshold_table, null); return threshold_op.filter(image, image); } }