Basic

Support

Required licenses

Any

Recommended images

Any

Location

Image Processing/Basic

Purpose

This sample program demonstrates how to:

  • Display an image.

  • Display and graphically interact with an ROI.

Code highlights

  1. Load an image file from the disk into an EImage object.

    image.Load(...);
    
  2. Attach (associate) an ROI to the image. The ROI gives access to the selected part of the image content.

    roi.Attach(image);
    
  3. Position and size the attached ROI on the image.

    roi.SetPlacement(orgX, orgY, width, height);
    
  4. Draw the image in a graphical device context.

    image.Draw(drawAdapter);
    
  5. Draw the frame (the external rectangle) of the ROI in a graphical device context. The second parameter enables the handles to manually manipulate the ROI position and size.

    roi.DrawFrame(&drawAdapter, true);
    
  6. Retrieve the cursor coordinates after clicking.

    handle = roi.HitTest(x, y);
    
  7. Move the handle to its new retrieved position and modify the ROI accordingly.

    roi.Drag(handle, x, y);