ImageBox

From Emgu CV: OpenCV in .NET (C#, VB, C++ and more)
Jump to navigation Jump to search

Image Box

Introduction

ImageBox is a user control that is similar to PictureBox. Instead of displaying Bitmap, it display any Image<,> object. It also provides extra functionality for simple image manipulation.

Functional Mode

The ImageBox has a FunctionalMode property, which allow you to configure how image should be displayed in ImageBox.

Minimum

Under this configuration, ImageBox is similar as PictureBox. All advanced features will be disabled.

PanAndZoom

This configuration enable the following mouse binding

  • Zoom-in and zoom-out by scrolling the middle mouse button.
  • Hold down the middle mouse button to pan image
  • Zoom-in to a specific region by highlighting a selected region using the left mouse button.

RightClickMenu

This configuration enable the right click menu. Where you can test out simple image filters on the image, as well as displaying image color histogram. I will give an example using the Line and Circle detection Example, where the result is displayed using an ImageBox. Move your mouse over to the image and right click, a context menu with available operations will be displayed.

ImageBox LineAndCircle1.PNG

Everything

This is the default configuration. It is basically PanAndZoom plus RightClickMenu

Recommended Configuration

If you are developing commercial applications, you might want to have right click menu during development but not in the release mode for end users. This can be easily done by using the following code,

#if DEBUG
imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.Everything;
#else
imageBox1.FunctionalMode = ImageBox.FunctionalModeOption.PanAndZoom;
#endif

Adding Image Box to your Application

For instruction on how to add an Image Box to your application, please visit here.