TIEVisionLibrary.createImage
Declaration
function createImage(): TIEVisionImage; overload; safecall;
function createImage(width: int32_t; height: int32_t; channelFormat: TIEVisionChannelFormat; channels: int32_t): TIEVisionImage; overload; safecall;
function createImage(c: TIEVisionImage): TIEVisionImage; overload; safecall;
function createImage(filename: PAnsiChar): TIEVisionImage; overload; safecall;
function createImage(width: int32_t; height: int32_t; channelFormat: TIEVisionChannelFormat; channels: int32_t; rowlen: int32_t; data: pointer): TIEVisionImage; overload; safecall;
Description
First overload creates a new empty image object.
Second overload creates a new image object of the specified size and format.
Third overload creates a new image object from another
TIEVisionImage object.
Fourth overload creates a new image from the specified file. Currently supported file formats are: TIFF, JPEG, BMP, PNG, PXM, J2K (JPEG2000) and RAS.
Fifth overload creates a new image from the specified buffer (shares the same content). The buffer will be not released on destroy.
| Parameter | Description |
| width | Image width |
| height | Image height |
| channelFormat | Channel format |
| channels | Number of channels |
| c | Source image to copy |
| rowlen | Row length in bytes |
| data | Raw data buffer |
| filename | Filename to load |
// create 1000x1000 RGB image
image := IEVisionLib.createImage(1000, 1000, ievUINT8, 3);
// Create and load 'input.jpg'
image := IEVisionLib.createImage('input.jpeg');
// share ImageEnView1 bitmap
ImageEnView1.IEBitmap.Origin := ieboTOPLEFT;
image := IEVisionLib.createImage(ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height,
ievUINT8, 3, ImageEnView1.IEBitmap.Rowlen,
ImageEnView1.IEBitmap.ScanLine[0]);
// the same result of previous code
image := ImageEnView1.IEBitmap.GetIEVisionImage();
// Create a 3x3 matrix
const
sharpenKernel: array [0..2] of array [0..2] of single = ((-1, -1, -1), (-1, 8, -1), (-1, -1, -1));
var
k: TIEVisionImage; // Or TIEVisionMatrix
i, j: integer;
l: PSingleArray;
begin
// convert the kernel to TIEVisionImage
k := IEVisionLib().createImage(3, 3, ievFLOAT32, 1);
for i := 0 to 2 do
begin
l := k.getScanline(i);
for j := 0 to 2 do
l[j] := sharpenKernel[i, j];
end;
...