|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.sourceforge.jiu.ops.Operation
net.sourceforge.jiu.ops.ImageToImageOperation
net.sourceforge.jiu.ops.LookupTableOperation
net.sourceforge.jiu.color.adjustment.Contrast
public class Contrast
Adjusts the contrast of an image. The amount of adjustment is given to the constructor as a percentage value between -100 and 100. -100 will make the resulting image middle-gray, 0 will leave it unchanged, 100 will map it to the eight corners of the color cube.
If all you want is to create a new image with adjusted contrast from the image data of an existing image, simply use the static helper method:
PixelImage adjustedImage = Contrast.adjust(inputImage, 30);This leaves the original image inputImage unchanged and allocates a second image object which is here assigned to the variable adjustedImage.
If you want more control over parameters, create your own Contrast object. You can then reuse image objects, e.g. to write the adjusted image data to the original image object:
Contrast op = new Contrast(); op.setInputImage(image); op.setOutputImage(image); op.setContrast(30); op.process(); // at this point, image will contain the adjusted image data, // the original data wil be overwritten
Constructor Summary | |
---|---|
Contrast()
|
Method Summary | |
---|---|
static PixelImage |
adjust(PixelImage input,
int percentage)
This static helper method is more simple to use when all you need are the standard options. |
int |
getContrast()
Returns the contrast adjustment value associated with this opperation. |
void |
process()
This method does the actual work of the operation. |
void |
setContrast(int newContrast)
Sets the value for contrast adjustment to be used within this operation. |
Methods inherited from class net.sourceforge.jiu.ops.LookupTableOperation |
---|
getNumTables, getTable, prepareImages, setNumTables, setTable, setTables |
Methods inherited from class net.sourceforge.jiu.ops.ImageToImageOperation |
---|
canInputAndOutputBeEqual, ensureImagesHaveSameResolution, ensureInputImageIsAvailable, ensureOutputImageResolution, getInputImage, getOutputImage, setCanInputAndOutputBeEqual, setInputImage, setOutputImage |
Methods inherited from class net.sourceforge.jiu.ops.Operation |
---|
addProgressListener, addProgressListeners, getAbort, removeProgressListener, setAbort, setProgress, setProgress |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Contrast()
Method Detail |
---|
public static PixelImage adjust(PixelImage input, int percentage)
input
- the image to work onpercentage
- contrast modification, from -100 to 100
public int getContrast()
setContrast(int)
public void process() throws MissingParameterException, WrongParameterException
Operation
process
in class LookupTableOperation
MissingParameterException
- if any mandatory parameter was not given to the operation
WrongParameterException
- if at least one of the input parameters was
not initialized appropriately (values out of the valid interval, etc.)public void setContrast(int newContrast)
newContrast
- new contrast, between -100 and 100 (including both values)
IllegalArgumentException
- if the new contrast value is not in the above mentioned intervalgetContrast()
|
JIU 0.14.3 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |