12.07.2015 Views

Digital Image Processing (using Java)

Digital Image Processing (using Java)

Digital Image Processing (using Java)

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

public abstract void computeMapping(int low, int high);public Buffered<strong>Image</strong> filter(Buffered<strong>Image</strong> src, Buffered<strong>Image</strong> dest) {check<strong>Image</strong>(src);if (dest == null)dest = createCompatibleDest<strong>Image</strong>(src, null);LookupOp operation = new LookupOp(new ByteLookupTable(0, table), null);operation.filter(src, dest);return dest;}}(p.117)LISTING 6.4 A subclass of GreyMapOp that applies a linear grey level mappingfunction to an image.public class LinearOp extends GreyMapOp {public LinearOp() {}computeMapping();public LinearOp(int low, int high) {}computeMapping(low, high);public void computeMapping(int low, int high) {if (low < 0 || high > 255 || low >= high)throw new java.awt.image.ImagingOpException("invalid mapping limits");float scaling = 255.0f / (high - low);for (int i = 0; i < 256; ++i)setTableEntry(i, Math.round(scaling*(i - low)));}}- 24 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!