Scale the gray values of an image.
The operator ::scale_image scales the input images (Image) by the following transformation: g' := g * Mult + Add If an overflow or an underflow occurs the values are clipped.
This operator can be applied, e.g., to map the gray values of an image, i.e., the interval [GMin,GMax], to the maximum range [0:255]. For this, the parameters are chosen as follows:
Mult = 255 / (GMax-GMin) Add = - Mult*GMin
The values for GMin and GMax can be determined, e.g., with the operator
::min_max_gray.
|
Image (input_object) |
(multichannel-)image(-array) -> Hobject: HImage(Array) ( byte / int1 / int2 / int4 / real / direction / cyclic / complex ) |
| Image(s) whose gray values are to be scaled. | |
|
ImageScaled (output_object) |
(multichannel-)image(-array) -> Hobject * : HImage(Array) ( byte / int1 / int2 / int4 / real / direction / cyclic / complex ) |
| Result image(s) by the scale. | |
|
Mult (input_control) |
number -> HTuple.double / long |
| Scale factor. | |
| Default value: 0.01 | |
| Suggested values: 0.001, 0.003, 0.005, 0.008, 0.01, 0.02, 0.03, 0.05, 0.08, 0.1, 0.5, 1.0 | |
| Typical range of values: -255.0 <= Mult <= 255.0 | |
| Minimum increment: 0.001 | |
|
Recommended increment: 0.1 | |
|
Add (input_control) |
number -> HTuple.double / long |
| Offset. | |
| Default value: 0 | |
| Suggested values: 0, 10, 50, 100, 200, 500 | |
| Typical range of values: -512.0 <= Add <= 512.0 | |
| Minimum increment: 0.01 | |
|
Recommended increment: 1.0 | |
/* simulation of invert for type 'byte' */
byte_invert(Hobject In, Hobject *out)
{
scale_image(In,Out,-1.0,255.0);
}
The operator ::scale_image returns the value H_MSG_TRUE if the parameters are correct. The behavior in case of empty input (no input images available) is set via the operator ::set_system('no_object_result',<Result>) Otherwise an exception treatment is carried out.
::mult_image, ::add_image, ::sub_image
Image filters