Hit-and-Miss Transform

Functional Guide | Reference: SetValue, HitAndMiss

////////////////////////////////////////////////////////////// // This code snippet shows how to highlight the left corner // // of a rhombus by means of a Hit-and-Miss operation. // ////////////////////////////////////////////////////////////// // Images constructor EImageBW8 srcImage; EImageBW8 dstImage; // ... // Create and define a Hit-and-Miss kernel // corresponding to the left corner of a rhombus EHitAndMissKernel leftCorner(-1, -1, 1, 1); // Left column of the kernel leftCorner.SetValue(-1, 0, EHitAndMissValue_Background); // Middle column of the kernel leftCorner.SetValue(0, -1, EHitAndMissValue_Background); leftCorner.SetValue(0, 0, EHitAndMissValue_Foreground); leftCorner.SetValue(0, 1, EHitAndMissValue_Background); // Right column of the kernel leftCorner.SetValue(1, -1, EHitAndMissValue_Foreground); leftCorner.SetValue(1, 0, EHitAndMissValue_Foreground); leftCorner.SetValue(1, 1, EHitAndMissValue_Foreground); // Source and destination images must have the same size dstImage.SetSize(&srcImage); // Apply the Hit-and-Miss kernel EasyImage::HitAndMiss(&srcImage, &dstImage, leftCorner);
////////////////////////////////////////////////////////////// // This code snippet shows how to highlight the left corner // // of a rhombus by means of a Hit-and-Miss operation. // ////////////////////////////////////////////////////////////// // Images constructor EImageBW8 srcImage= new EImageBW8(); EImageBW8 dstImage= new EImageBW8(); // ... // Create and define a Hit-and-Miss kernel // corresponding to the left corner of a rhombus EHitAndMissKernel leftCorner= new EHitAndMissKernel(-1, -1, 1, 1); // Left column of the kernel leftCorner.SetValue(-1, 0, EHitAndMissValue.Background); // Middle column of the kernel leftCorner.SetValue(0, -1, EHitAndMissValue.Background); leftCorner.SetValue(0, 0, EHitAndMissValue.Foreground); leftCorner.SetValue(0, 1, EHitAndMissValue.Background); // Right column of the kernel leftCorner.SetValue(1, -1, EHitAndMissValue.Foreground); leftCorner.SetValue(1, 0, EHitAndMissValue.Foreground); leftCorner.SetValue(1, 1, EHitAndMissValue.Foreground); // Source and destination images must have the same size dstImage.SetSize(srcImage); // Apply the Hit-and-Miss kernel EasyImage.HitAndMiss(srcImage, dstImage, leftCorner);