Create an image from three pointers to the pixels (red/green/blue).
The operator gen_image3 creates a three-channel image of the size Width * Height. The pixels in PixelPointerRed, PixelPointerGreen and PixelPointerBlue are stored line-sequentially. The type of the given pixels (PixelPointerRed etc.) must correspond to the name of the pixels (Type). The storage for the new image is newly created by HALCON . Thus, it can be released after the call. Since the type of the parameters (PixelPointerRed etc.) is generic (long) a ``cast'' must be used for the call.
|
ImageRGB (output_object) |
image -> object : byte / direction / cyclic / int1 / int2 / uint2 / int4 / real |
| Created image with new image matrix. | |
|
Type (input_control) |
string -> string |
| Pixel type. | |
| Default value: 'byte' | |
| List of values: 'byte', 'direction', 'cyclic', 'int1', 'int2', 'uint2', 'int4', 'real' | |
|
Width (input_control) |
extent.x -> integer |
| Width of image. | |
| Default value: 512 | |
| Suggested values: 128, 256, 512, 1024 | |
| Typical range of values: 1 <= Width <= 512 (lin) | |
| Minimum increment: 1 | |
|
Recommended increment: 10 | |
|
Height (input_control) |
extent.y -> integer |
| Height of image. | |
| Default value: 512 | |
| Suggested values: 128, 256, 512, 1024 | |
| Typical range of values: 1 <= Height <= 512 (lin) | |
| Minimum increment: 1 | |
|
Recommended increment: 10 | |
|
PixelPointerRed (input_control) |
integer -> integer |
| Pointer to first red value (channel 1). | |
|
PixelPointerGreen (input_control) |
integer -> integer |
| Pointer to first green value (channel 2). | |
|
PixelPointerBlue (input_control) |
integer -> integer |
| Pointer to first blue value (channel 3). | |
void NewRGBImage(Hobject *new)
{
unsigned char red[768*525];
unsigned char green[768*525];
unsigned char blue[768*525];
int r,c;
for (r=0; r<525; r++)
for (c=0; c<768; c++)
{
red[r*768+c] = c % 255;
green[r*768+c] = (767 - c) % 255;
blue[r*768+c] = r % 255;
}
gen_image3(new,"byte",768,525,(long)red,(long)green,(long)blue);
}
main()
{
Hobject rgb;
open_window(0,0,768,525,0,"","",&WindowHandle);
NewRGBImage(&rgb);
disp_color(rgb,WindowHandle);
clear_obj(rgb);
}If the parameter values are correct, the operator gen_image3 returns the value 2 (H_MSG_TRUE). Otherwise an exception handling is raised.
gen_image3 is reentrant and processed without parallelization.
gen_image_const, get_image_pointer1
gen_image1, compose3, gen_image_const
reduce_domain, paint_gray, paint_region, set_grayval, get_image_pointer1, decompose3
Image / region / XLD management