Filters
is a library implementing image filters
and image processing functions
return to main page
Example
see WikiFilters for more code sample
// C PBitmap32 imageLoaded = helper_loadImage( "blob2.tif" ); if( imageLoaded != NULL ){ __int32 filterSobel = filters_createFilter( "filterSobel" ); PBitmap32 imageSobel = image_createImageLike( imageLoaded ); filters_setParameterImage( filterSobel, "inImage", imageLoaded ); filters_setParameterImage( filterSobel, "outImage", imageSobel ); filters_setParameterInteger( filterSobel, "blurIteration", 1 ); filters_setParameterInteger( filterSobel, "gain", 5 ); filters_setParameterInteger( filterSobel, "thresholdLower", 1 ); filters_setParameterInteger( filterSobel, "thresholdUpper", 255 ); filters_run( filterSobel ); // save image char strImageToSave[255]; strcpy( strImageToSave, "testFiltersDllC_output_sobel.jpg" ); printf( "save image to [%s]\n", strImageToSave ); helper_saveImage( imageSobel, strImageToSave ); // dispose image_freeImage( imageSobel ); filters_deleteFilter( filterSobel ); image_freeImage( imageLoaded ); }
// Delphi procedure testFilterSobel( imageToLoad : PChar ); var filterImageLoader, filterSobel : Integer; images : ArrayOfPBitmap32; imageSobel : PBitmap32; begin // create filters filterImageLoader := createFilter( 'filterImageLoader' ); filterSobel := createFilter( 'filterSobel' ); // load image setParameterString( filterImageLoader, 'filesName', imageToLoad ); run( filterImageLoader ); images := getOutputImages( filterImageLoader, 'outImages' ); if Length(images)>0 then begin // process Sobel imageSobel := image.createImage( images[0].Width, images[0].Height ); setParameterImage( filterSobel, 'inImage', images[0] ); setParameterImage( filterSobel, 'outImage', imageSobel ); setParameterInteger( filterSobel, 'blurIteration', 2 ); setParameterInteger( filterSobel, 'thresholdLower', 1 ); setParameterInteger( filterSobel, 'thresholdUpper', 255 ); run( filterSobel ); // use sobel image // ... image.freeImage( imageSobel ); end; // delete filters deleteFilter( filterSobel ); deleteFilter( filterImageLoader ); end;