ImageEn, unit imageenproc

TImageEnProc.Pixelize

TImageEnProc.Pixelize


Declaration

procedure Pixelize(Amount: Double = 0.02; AmountIsPercentage: Boolean = True);


Description

Pixelize filter renders the selected area using large color blocks. It is very similar to the effect seen on television when obscuring faces.
If AmountIsPercentage is true (Default), then Amount is a floating point value from 0 to 1 which specifies the size of the rectangular block as percentage (compared to the image size). Normally values would be less than 0.20 (20% of image size)
If AmountIsPercentage is false, then Amount is an integer value of which specifies the size of the rectangular block in pixels.

Original image:


Applying Pixelize(0.02) to the selected areas:



Note:
A UI for this is available to your users in the Image Processing dialog
Also available as a RetouchTool by setting MouseInteractGeneral to [miRetouchTool] and RetouchMode to iermPixelize
If the image PixelFormat is not ie24RGB, it will be converted


Demos

Demo  Demos\IEVision\NumberPlateBlurring\GetPlate.dpr
Demo  Demos\ImageEditing\EveryMethod\EveryMethod.dpr


Examples

// Load test image
ImageEnView1.IO.LoadFromFile( 'D:\TestImage.jpg' );

  

// Apply pixelation to the selection (with blocks of 2% of image width+height)
ImageEnView1.Proc.Pixelize( 0.02 );

  


// Pixelize the image and trim any partial blocks (blockCount must be >= 2)
blockCount := 10;
blockSize := Round( min( ImageEnView1.IEBitmap.Width, ImageEnView1.IEBitmap.Height) / blockCount );
ImageEnView1.Proc.Pixelize( blockSize, False );
ImageEnView1.Proc.ImageResize( ImageEnView1.IEBitmap.Width div blockSize * blockSize, ImageEnView1.IEBitmap.Height div blockSize * blockSize );

  


// Apply pixelation to the selection with blocks of 15x15 pixels (which is the same as above for a 800x600 pixel image)
ImageEnView1.Proc.Pixelize( 15, False );