Origin offers abundance of tools for image processing. We show in this blog one tool that aligns images and subtract the unwanted background image.
Please note that this blog is based on the upcoming Origin 2017 SR1 which the preview of image processing tools are on the right side of controls. Before it, the preview is at the bottom of all controls and not convenient.
- Start a new Origin project. From Windows Explorer, Ctrl + select the image files bgnd.jpg and cell.jpg in the zip file and drop them into the main workspace of Origin. The imported matrices (cell 、 bgnd) are shown as images (see below). They are of slightly different dimensions therefore each image is imported into a seperate sheet in same Matrix book. You can see the image dimension on the Status bar at the bottom of Origin workspace, e.g. MBook1(790×591). Or you can choose View: Data Mode to see the RGB values and dimension. Note: For images of same dimensions, drag and drop will put them as individual matrix objects in same matrix sheet.
We hope to get rid of the artifacts in cell (two small white spots at left and right edge) by subtracting bgnd from it, but we want to make sure images are aligned before subtraction. T mark in each image is an indicator if the images are aligned or not.
- With matrix sheet cell activated, select Image: Arithmetic Transform: Simple Math… . Click the hunt button to the right of Input Image2 and select the second matrix sheet bgnd. Click Math Function dropdown list and choose img1-img2. You will see the subtraction effect in Preview window. We know these two images are not aligned but it’s hard to see the two T marks with our two images to help us align them. We can try different Math Functions such as Or, XOr, Add, etc. till we can clearly see the two T marks. E.g. E.g. choose Add. Now the two T marks show so we can do the alignment. Please note this is only for alignment so when alignment is done, we need to change Math Function back to img1-img2. Right now we see in the preview that the two “T” marks are not overlapped.
- To align the two images, click the arrow button besides Offset X so a slider shows. Drag the slider to adjust the horizontal offset of Image 2 (in our case bgnd). But a more practical way is to press the Left or Right Arrow keys on the keyboard to the move the image. Repeat this for Offset Y till the two T marks overlap as seen below.
- After we are sure the two images are well aligned, click Math Function drop-down and specify img1 – img2 to subtract the background from the original image. We see that the two artifact white spots are removed in the resulting image.
- Click OK to finished the operation. We see that green lock on the upper right of the result matrix page. Click the green lock and choose Change Parameters… if you want to adjust the offset or some other settings further.
Note: If you only want to align two images without the need to do the subtract, you can choose Image: Geometric Transform: Offset… menu.