|
Getting Started with IDL: Images |
|
In order to improve the look of an image, sometimes all that is necessary is a change in how the colors are represented. IDL provides several ways to manipulate the contrast.
One of the simplest contrast enhancements that can be performed on an image is thresholding. Thresholding produces a two-level mapping from all of the possible intensities into black and white. The IDL relational operators, EQ, NE, GE, GT, LE, and LT, return a value of 1 if the relation is true and 0 if the relation is false. When applied to images, the relation is evaluated for each pixel and an image of 1's and 0's results.
TVSCL,MYIMAGE GT 140
![]() |
TVSCL,MYIMAGE LT 140
![]() |
In many images, the pixels have values that are only a small subrange of the possible values. By spreading the distribution so that each range of pixel values contains an approximately equal number of members, the information content of the display is maximized, as shown in the following.
Another way to enhance the contrast of an image is to scale a subrange of pixel values to fill the entire range of displayed brightnesses. The > operator, the IDL maximum operator, returns a result equal to the larger of its two parameters. The following commands contrast the maximum and minimum operators.
TVSCL,MYIMAGE > 100
![]() |
TVSCL,MYIMAGE < 140
![]() |
| Note Although this command illustrates the use of the IDL minimum and maximum operators, the same function can be executed more efficiently by IDL with the command: TV, BYTSCL(MYIMAGE,MIN=140,MAX=200,TOP=!D.TABLE_SIZE) |
IDL Online Help (March 06, 2007)