📄 ipl.pas
字号:
Roi : PIplROI; MaskROI : PIplImage;
ImageId : Pointer;
TileInfo : PIplTileInfo) : PIplImage; stdcall;
{
Purpose: Creates an IPL image header according to the specified attributes.
Returns: The newly constructed IPL image header.
Parameters:
NChannels Number of channels in the image.
AlphaChannel Alpha channel number (0 if no alpha channel in image).
Depth Bit depth of pixels. Can be one of
IPL_DEPTH_1U,
IPL_DEPTH_8U,
IPL_DEPTH_8S,
IPL_DEPTH_16U,
IPL_DEPTH_16S,
IPL_DEPTH_32S.
IPL_DEPTH_32F.
ColorModel A four character array describing the color model,
e.g. "RGB", "GRAY", "MSI" etc.
ChannelSeq The sequence of channels in the image,
e.g. "BGR" for an RGB image.
DataOrder IPL_DATA_ORDER_PIXEL or IPL_DATA_ORDER_PLANE.
Origin The origin of the image.
Can be IPL_ORIGIN_TL or IPL_ORIGIN_BL.
Align Alignment of image data.
Can be IPL_ALIGN_4BYTES (IPL_ALIGN_DWORD) or
IPL_ALIGN_8BYTES (IPL_ALIGN_QWORD) or
IPL_ALIGN_16BYTES IPL_ALIGN_32BYTES.
Width Width of the image in pixels.
Height Height of the image in pixels.
Roi Pointer to an ROI (region of interest) structure.
This can be NULL (implying a region of interest comprising
all channels and the entire image area).
MaskROI Pointer on mask image
ImageId use of the application
TileInfo contains information on tiling
}
procedure iplAllocateImage(Image : PIplImage; DoFill : Integer;
FillValue : Integer); stdcall;
{
Purpose: Allocates memory for image data according to the specified header.
Parameters:
Image An IPL image header with a NULL image data pointer.
The image data pointer will be set to newly allocated
image data memory after calling this function.
DoFill Use a 0 to leave the pixel data uninitialized.
Use a not 0 to initialized the pixel data of FillValue
FillValue The initial value to use for pixel data.
}
procedure iplAllocateImageFP(Image : PIplImage; DoFill : Integer;
FillValue : Float); stdcall;
{
Purpose: Allocates memory for image data according to the specified header.
Parameters:
Image An IPL image header (IPL_DEPTH_32F) with a NULL image data
pointer.
The image data pointer will be set to newly allocated
image data memory after calling this function.
DoFill Use a 0 to leave the pixel data uninitialized.
Use a not 0 to initialized the pixel data of FillValue
FillValue The initial value to use for pixel data.
}
function iplCreateImageJaehne(Depth, Width, Height : Integer) : PIplImage; stdcall;
{
Purpose: Creates a gray (one channel) test image
Returns: IPL image or NULL
Parameters:
depth depth of the image to be created.
All IPL depths are possible including 32f.
For the 32f depth a data range is [0..1)
width width of the image to be created
height height of the image to be created
Notes: This test image was seen in
B.Jaehne, Digital Image Processing, third edition, 1995
}
function iplCloneImage(Img : PIplImage) : PIplImage; stdcall;
{
Purpose: Creates a clone of an image
Returns: IPL image or NULL
Parameters: img - image to be cloned.
Notes: The function creates a copy of an image img including
the field roi by copying. The following fields of the
created image are set by function
ID = 0, imageId = NULL, maskROI = NULL, tileInfo = NULL
All IPL depths are possible including 32f.
}
procedure iplDeallocateHeader(Image : PIplImage); stdcall;
{
Purpose: deallocate IPL header
Notes: if image^ImageData!=NULL, then first frees imageData
}
procedure iplDeallocateImage(Image : PIplImage); stdcall;
{
Purpose: Deallocates (frees) memory for image data pointed to in
the image header.
Parameters:
Image An IPL image header with a pointer to allocated image data memory.
Notes: The image data pointer will be set to NULL after this
function executes.
}
const
IPL_IMAGE_HEADER = 1;
IPL_IMAGE_DATA = 2;
IPL_IMAGE_ROI = 4;
IPL_IMAGE_TILE = 8;
IPL_IMAGE_MASK = 16;
IPL_IMAGE_ALL = IPL_IMAGE_HEADER or
IPL_IMAGE_DATA or
IPL_IMAGE_TILE or
IPL_IMAGE_ROI or
IPL_IMAGE_MASK;
IPL_IMAGE_ALL_WITHOUT_MASK = IPL_IMAGE_HEADER or
IPL_IMAGE_DATA or
IPL_IMAGE_TILE or
IPL_IMAGE_ROI;
procedure iplDeallocate(Image : PIplImage; Flag : Integer); stdcall;
{
Purpose: Deallocates or frees memory for image header or data or
mask ROI or rectangular ROI, etc or all.
Parameters:
Image An IPL image header
Flag what item to free:
IPL_IMAGE_HEADER - free header structure
IPL_IMAGE_DATA - free image data, set pointer to NULL
IPL_IMAGE_ROI - free image roi, set pointer to NULL
IPL_IMAGE_TILE - free image tile, set pointer to NULL
IPL_IMAGE_MASK - free image maskROI, set pointer to NULL
IPL_IMAGE_ALL - free image data, roi, header, maskROI, tile
IPL_IMAGE_ALL_WITHOUT_MASK
- as well as IPL_IMAGE_ALL, but maskROI does not release
}
function iplCreateROI(Coi : Integer;
XOffset : Integer; YOffset : Integer;
Width : Integer;
Height : Integer) : PIplROI; stdcall;
{
Purpose: Allocates and sets the region of interest (ROI) structure.
Returns: Newly constructed ROI structure.
Parameters:
Coi The channel region of interest.
It can be set to 0 (for all channels) or a specific channel number.
XOffset,
YOffset The offset from the origin of the rectangular region.
Height,
Width The size of the rectangular region.
}
procedure iplSetROI(Roi : PIplROI; Coi : Integer;
XOffset : Integer; YOffset : Integer;
Width : Integer;
Height : Integer); stdcall;
{
Purpose: Sets the IplROI structure fields.
Parameters:
Roi The ROI structure to modify.
Coi The channel region of interest.
It can be set to 0 (for all channels) or a specific
channel number.
XOffset,
YOffset The offset from the origin of the rectangular region.
Height,
Width The size of the rectangular region.
}
procedure iplDeleteROI(Roi : PIplROI); stdcall;
{
Purpose: Deletes ROI structure
Parameters:
Roi The ROI structure to be deleted.
}
function iplCreateTileInfo(CallBack : TIplCallBack;
Id : Pointer;
Width : Integer;
Height : Integer) : PIplTileInfo; stdcall;
{
Purpose: Creates the IplTileInfo structure.
Returns: Newly constructed TileInfo structure.
Parameters:
CallBack callback function
Id additional identification field
Width width of tile
Height height of tile
}
procedure iplSetTileInfo(TileInfo : PIplTileInfo;
CallBack : TIplCallBack;
Id : Pointer;
Width : Integer;
Height : Integer); stdcall;
{
Purpose: Sets attributes for an existing IplTileInfo structure.
Parameters:
TileInfo The TileInfo structure to modify.
CallBack callback function
Id additional identification field
Width width of tile
Height height of tile
}
procedure iplDeleteTileInfo(TileInfo : PIplTileInfo); stdcall;
{
Purpose: Deletes the IplTileInfo structure.
Parameters:
TileInfo The pointer to the TIplTileInfo structure.
}
{==========================================================================
Section: Windows* DIB Conversion Functions
==========================================================================}
function iplTranslateDIB(Dib : PBitmapInfoHeader;
var CloneData : BOOL) : PIplImage; stdcall;
{
Purpose: Translates a DIB image into an IPL image.
Returns: The constructed IPL image.
Parameters:
Dib The DIB image.
CloneData A boolean, result of work of the function. If true, the image
data pointer in IPL image is made to point to the DIB image data.
Otherwise the DIB image data was converting to the IPL image data.
}
procedure iplConvertFromDIB(Dib : PBitmapInfoHeader;
Image : PIplImage); stdcall;
{
Purpose: Converts a DIB image to an IPL image with specified attributes.
Parameters:
Dib The input DIB image.
Image The IPL image header with specified attributes.
Notes: If the data pointer is NULL, image data memory
will be allocated and the pointer set to it.
}
{---------- Consts of Palette conversion for iplConvertToDIB* ----------}
type
TIplPalConversion = (
IPL_PALCONV_NONE,
IPL_PALCONV_POPULATE,
IPL_PALCONV_MEDCUT);
procedure iplConvertToDIB(Image : PIplImage;
Dib : PBitmapInfoHeader;
Dither : Integer;
PaletteConversion : TIplPalConversion); stdcall;
{
Purpose: Converts an IPL image to a DIB image with specified attributes.
Parameters:
Image The input IPL image.
Dib The output DIB image.
Dither The dithering algorithm to use if applicable.
Dithering will be done if the bit depth in the DIB
is less than that of the IPL image.
The following algorithms are supported:
IPL_DITHER_NONE No dithering is done.
The most significant bits in the IPL
image pixel data are retained.
IPL_DITHER_STUCKEY The stuckey dithering algorithm is used.
PaletteConversion
Applicable when the DIB is a palette image.
Specifies the palette algorithm to use when converting
the IPL absolute color image.
The following options are supported:
IPL_PALCONV_NONE The existing palette in the DIB is used.
IPL_PALCONV_POPULATE The popularity palette conversion
algorithm is used.
IPL_PALCONV_MEDCUT The median cut algorithm palette conversion
algorithm is used.
}
function iplConvertFromDIBSep(Dib : PBitmapInfoHeader;
DibData : PByte;
Image : PIplImage) : IPLStatus; stdcall;
{
Purpose: Same as iplConvertFromDIB, but uses separate
parameters for DIB header and data.
Returns: IPLStatus
Parameters:
Dib - The input DIB image header.
DibData - The input DIB image data.
Image - The IPL image header with specified attributes.
If the data pointer is NULL, image data memory
will be allocated and the pointer set to it.
}
function iplConvertToDIBSep(Image : PIplImage;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -