20.1 Introduction

Image window

From version 2021b, Origin introduces a new Image window to load and save images. It employs OpenCV for processing and analysis routines. The new image window is a single-layer window, like the one below. It has an information bar on the top (otherwise you can select View: Show Information to turn it on) and if a video or multi-frame image, a navigation bar at the bottom (or View: Show Navigation to turn it on). It is responsible for almost all image processing performance.

Single-Frame Image Multi-Frame Image or Video
Importing Images introduction 02.png Importing Images introduction 01.png

Image window vs. Matrix window

  • Before Origin 2021b, images were stored in the Matrix window and the processing tools were supported by LeadTools. On the other hand, the new Image window is supported by OpenCV for processing and analysis routines.
  • The matrix window is a multi-layer window that can contain many sheets. However, an image window has one sheet only.
  • The matrix window is responsible for almost all built-in image processing tools. Also, if a process or analysis outputs some data results, such as 2D FFT, the matrix window is used. On the other hand, image window is used in most of image/video processing Apps.
  • You can always convert an image window to matrix and reverse back. See below.

Import Images and Videos

Refer to this document page for details.

Menus for Basic Operation on Window

Edit: Cut: clear the active image window.
Edit: Clear: if a ROI is selected, this menu will delete the ROI; if the image window is selected, this menu will clear the window.
Edit: Copy: if a ROI is selected, this menu will copy all the information of the ROI. If the image window is selected, this menu will copy the image. You can then paste it to a graph window as an object or to an image window.
Edit: Paste: paste the copied ROI or image.
View: Information: show/hide the information bar
View: Navigation: show/hide the Navigation bar

Export Images and Videos

Basic Operations on Image Window

Besides tools under Image main menu, toolbar buttons and context menus are provided for quickly access to basic manipulations.

Mini-Toolbar

Clicking anywhere inside the image layer will pop up a mini toolbar.
Single frame Image:
Minitoolbar image window.png
Video:
Minitoolbar image window2.png
Multi-frame stacked Image:
Minitoolbar image window3.png

Applying Palettes to Grayscale Images

Color palettes can be applied to grayscale images in the Image window.

  1. Click the Mini Toolbar Gray button Popup Gray.png, if necessary, to convert an image to grayscale.
  2. Apply a palette to the grayscale image by clicking the Palette button Button Palette.png on the Style toolbar.
  3. Click the Mini Toolbar Reverse Palette button Popup Revise Palette.png to reverse application of the chosen palette.

From the Palette list on the Style toolbar, click More Palettes to open the Color Manager dialog box and add more palettes.

Context Menu

Save reload image.png

Add ROI See what you can do with a ROI below.
Display Actual Size/
Fit to Window
  • Display the image in 1:1 pixel mode, OR
  • always fit the image to window size.
Link(ed) File Check this to link the image to the source file. See the difference of link and unlink file here.
Source File Path Open a dialog to change the source of the image file. See details of saving and changing the image path here.

Region of Interest

  • Click the Add ROI button Add ROI Button.png on minitoolbar
Or,
  • Click the Rectangle Tool button Rectangle Tool Button.png on ‘’’Tools’’’ toolbar. Drag a rectangle box on the image.


Double-click on the ROI to:
  • Change the ROI name
  • Re-position the ROI by specifying XY coordinates of the top-left and bottom-right anchor points.
Image window ROI Position.png


Right-click on the ROI to:
Image window ROI context menu.png
  • Clip: Available when the image is opened from a graph (e.g. by double-clicking the graph image). This clips the graph image to the Image window ROI. The original graph image size is reduced to the size of the clipped region. To restore the full image in the graph window, right-click outside of the ROI and choose Remove Clipping.
  • Crop: Crop Image window image and graph image (if exists) to the ROI. Graph image size and position are kept.
  • Copy: Copy the ROI as an image. You can then paste it to other windows inside Origin, e.g. a graph or worksheet window, or to other applications. For multi-frame image, only the active frame is copied.
  • Copy Positions: Copy the ROI box coordinates of 4 vertices. You can choose to paste it as plain numbers, or, Paste Position to another ROI box. For the latter option, you can choose to paste only ROI Width/Height, or Horizontal/Vertical location.
  • Export ROI: Saves details (e.g. ROI name, position of vertices, etc.) to a .ROI file and later.
  • Import ROI: Applies details of a previously-saved ROI, to the selected ROI.
  • Create New: Outputs the ROI to a new Image window.

The degree of image darkening outside of the Image Window ROI is controlled by system variable @IMGDI. Setting @IMGDI = 1000 will cause the outside area to display as black; @IMGDI = 0 turns off darkening. For information on changing the value of a system variable, see this FAQ.

Adjustments and Conversion

Besides buttons and menus mentioned above, Origin provides a sets of tools useful in image processing and analysis. They are sub-categorized as follow:

Converting to Matrix and Reversion

As different ways of dataset display and storage, sometimes you need to convert betwenn Image window and Matrix window. Data type can be specified during the conversion, which should take in account when the post-processing has a requirement on the data type.

Convert an image (single chanel) into matrix,

  • Select menu Image: Convert to Matrix to open the Cv2Mat dialog.

Following data types are supported:

!Auto This is the default option. It will take image types and generate one matrix object per image frame always: 8bit gray-scale image will be converted to Byte matrix, and RGB color image to UInt matrix.

Note that it will not handle Alpha Channel and you can pre-preprocess it if needed.

Byte Byte matrix: Values frome 0 to 255
UShort Unsigned short matrix: values from 0 to 65535
'UInt Unsigned Int matrix: values from 0 to 4294967295
Float 32bit Float matrix: values from -3.4X1038 ~ 3.4X1038
Double 64bit Float matrix: values from -1.7X10308 to 1.7X10308


Convert a matrix to image window,

  • You can do it in Python. Below is a sample.
import originpro as op
import numpy as np
ml = op.find_sheet('m')
a = ml.to_np3d()
iw=op.new_image()
iw.setup(1,True)
iw.from_np(a)
iw.set_int('NAV',1)