ImageEn

Testing of Detection Methods


The "Every Method" editing demo allows you to preview over 250 editing, analysis and effects methods.

All Test Results
  Analysis Methods
  Color Adjustment Methods
  Color Depth Methods
  Detection Methods
  Effects Methods
  Filter Methods
  Geometric Methods
  Painting and Alpha Methods
  Smoothing Methods
  Other Methods

 Test Images

ImageEnView1.IO.LoadFromFile( 'D:\ImageTest1.jpg' );

  


 canny (IEVision)

// Find line segments in a binary image using a probabilistic Hough transform
ImageEnView1.IEBitmap.PixelFormat := ie8g;
ImageEnView1.IEBitmap.GetIEVisionImage().canny( 50, 200, 3 );
ImageEnView1.IEBitmap.Negative();  // Which will call ImageEnView1.Update();

  


 createBlobDetector (IEVision)

// Detect blobs/shapes in image
detector := IEVisionLib().createBlobDetector();
detector.setFilterByInertia( False, 0.1, 3.4e+38 );
detector.setFilterByConvexity( False, 0.95, 3.4e+38 );
keyPoints := detector.detect( ImageEnView1.IEBitmap.GetIEVisionImage() );
ImageEnView1.IEBitmap.IECanvas.DrawRects( keyPoints, clRed, 2, True );
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Found: %d', [ KeyPoints.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();

 


 detectLines (IEVision)

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

   

// Detect lines using a Binary Descriptor
lines := ImageEnView1.IEBitmap.GetIEVisionImage().detectLines( ievBinaryDescriptor );
ImageEnView1.IEBitmap.IECanvas.DrawLines( lines, clRed, 2 );
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Lines: %d', [ lines.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();

   

// Detect lines using a LSD Detector
lines := ImageEnView1.IEBitmap.GetIEVisionImage().detectLines( ievLSDDetector );
ImageEnView1.IEBitmap.IECanvas.DrawLines( lines, clRed, 2 );
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Lines: %d', [ lines.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();

   


 houghLinesP (IEVision)

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

   

// Find line segments in a binary image using the probabilistic Hough transform
ImageEnView1.Proc.SaveUndo();
ImageEnView1.IEBitmap.PixelFormat := ie8g;
ImageEnView1.IEBitmap.GetIEVisionImage().blur( IEVisionSize(3, 3), IEVisionPoint(-1, -1) );
ImageEnView1.IEBitmap.GetIEVisionImage().canny( 50, 200, 3 );
lines := ImageEnView1.IEBitmap.GetIEVisionImage().houghLinesP( 1, PI / 180, 200, 100, 10 );
ImageEnView1.Proc.Undo();    // Restore full color image
ImageEnView1.IEBitmap.IECanvas.DrawLines( lines, clRed, 2 );
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Lines: %d', [ lines.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();

   


 EdgeDetect_ShenCastan

// Convert the current color image to black & white (1 bit) using a Shen-Castan (ISEF) edge detection algorithm
ImageEnView1.Proc.EdgeDetect_ShenCastan();

  


 EdgeDetect_Sobel

// Detect the edges of objects within an image using a Sobel filter
ImageEnView1.Proc.EdgeDetect_Sobel();
ImageEnView1.Proc.Negative();

  


 findIn (IEVision)

// Find Faces in image
objectsFinder := IEVisionLib.createObjectsFinder();
objectsFinder.addClassifier('face detector 1', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_DEFAULT));
objectsFinder.addClassifier('face detector 2', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_TREE));
objectsFinder.addClassifier('face detector 3', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT));
objectsFinder.addClassifier('face detector 4', IEVisionLib.createCascadeClassifier(IEVC_FRONTAL_FACE_ALT_2));
objectsFinder.addClassifier('face detector 5', IEVisionLib.createCascadeClassifier(IEVC_PROFILE_FACE));
objectsFinder.findIn(ImageEnView1.IEBitmap.GetIEVisionImage());
rects := objectsFinder.mergeAllRects();  // merge intersecting rectangles
ImageEnView1.IEBitmap.IECanvas.DrawRects( rects, clRed, 2 );
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Found: %d', [ rects.size ]), 'Arial', 12, Text_Color, [fsBold] );
ImageEnView1.Update();

  



 LayersCreateFromEdge

// Automatically select a color region and convert it to a polygon
ImageEnView1.SelectionBase := iesbBitmap;
if ImageEnView1.LayersCreateFromEdge( ClickPt.X, ClickPt.Y, 54, False ) > 0 then
begin
  ImageEnView1.CurrentLayer.BorderWidth := 2;
  ImageEnView1.CurrentLayer.BorderColor := Color;
  ImageEnView1.CurrentLayer.FillColor   := clWhite;
  ImageEnView1.LayersMergeAll();
end;

  


 matchTemplate (IEVision)

// Find a matching image within our image
template := SearchImage.GetIEVisionImage();
image := ImageEnView1.IEBitmap.GetIEVisionImage();
r := image.matchTemplate( template, ievSQDIFF, @rank );
// draw a red box around the found rectangle
with ImageEnView1.IEBitmap.Canvas do
begin
  Pen.Color := clRed;
  Pen.Width := 5;
  Brush.Style := bsClear;
  Rectangle( IEVisionRectToTRect( r ));
  Font.Height := 36;
  Font.Color := clRed;
  Font.Style := [fsBold];
  TextOut( r.x + 10, r.y + 4, Format( 'Match: %d%%', [Round( rank )]));
end;
ImageEnView1.Update();

  


 SeparateObjects

// Show detected objects in the image
ImageEnView1.Proc.SaveUndo();
ImageEnView1.Proc.ConvertToBWThreshold( 80 );    // Better detection
rects := ImageEnView1.Proc.SeparateObjects( 4, True, 10 );
ImageEnView1.Proc.Undo();                        // Get full color image back
ImageEnView1.IEBitmap.IECanvas.DrawRects( rects, clRed, 2 );
// Output object count
ImageEnView1.Proc.TextOut( Align_Text_Near_Left, Align_Text_Near_Top, Format( 'Objects: %d', [ rects.Count ]), 'Arial', 10, clRed, [fsBold] );
ImageEnView1.Update();
rects.free;

 



 CalcOrientation

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


// Automatically rotate a document
n := ImageEnView1.Proc.CalcOrientation();
ImageEnView1.Proc.Rotate( n );



 SkewDetection

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

 

// Check for skew within the range -15 to 15 with 0.1 degrees of precision and automatically orient (for printed text)
d := ImageEnView1.Proc.SkewDetection( ImageEnView1.IEBitmap.Width div 4, 30, 0.1, false );
ImageEnView1.Proc.RotateAndCrop( d, ierBicubic );

 


 SkewDetectionFine

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

 

// Check for skew within the range -5 to 5 with 0.1 degrees of precision and automatically orient (for printed text)
d := ImageEnView1.Proc.SkewDetectionFine( 0, 0.1, 10, True );
ImageEnView1.Proc.RotateAndCrop( d, ierBicubic );

 


See Also

 Analysis Methods
 Color Adjustment Methods
 Color Depth Methods
 Detection Methods
 Effects Methods
 Filter Methods
 Geometric Methods
 Painting and Alpha Methods
 Smoothing Methods
 Other Methods