Commonly Needed PiXCL Applications:

Last Update: 04-Jan-2019

Have you ever needed to handle a series of images in some special way, but the imaging application you use does not make it easy, or it's very manually intensive ...

i.e. T-E-D-I-O-U-S to complete?

Have you wished for a simple way that your EXACT problem can be solved? An application written in PiXCL can do just about anything you need, and when that need changes slightly, you can quickly adjust your current program, or write a new variation

Scanned Image Straightening and Cropping

Looking in the scanner forums I often see requests for an application that can

It's quite possible to do this with applications like PaintShopPro or PhotoShop, but it's quite tedious and time consuming because there's generally more manual operations needed than is desirable, not to mention the process gets costly if you have to purchase expensive software.

Here's screen shots of a sample application that comes with PiXCL

Not shown is the Open File common dialog where 1 or more images can be selected, up to a maximum of about 3000 depending on the length of the file names. Here, a scanned image has been slightly skewed. There's a white border and the scanner cover is slightly off-white.

The image is the Roman-period ruins of the city of Jerash in Jordan. Since I took this picture in 1980, the Jordanian government has completed major reconstruction and restoration works. If you get the chance, it well worth visiting.

To straighten the image, all thats needed is two points at the top and bottom of the image. The vertical and horizontal delta values are used in a simple trig function built into PiXCL that calculates the tangent, hence the angle of rotation required to straighten the image.

The straightened image is displayed, here with a orange background. The images are displayed the same size but the actual size is bigger.

Selecting the desired Top Left and Bottom Right crop points is all that's now required, and the image is cropped using one line of PiXCL code, then redisplayed (on the right) with one more line of code.

 

The cropped image is now displayed, ready for saving to disk. In this app, the same filename is used, but it can be any desired name, and this name can be synthesized in PiXCL code using the string functions.

 

This application is only 100 lines of code, and about 80 lines were written by the code Wizard.

 

Identifying Regions of Interest and Annotating an Image

You need to start a simplified image display and draw program with just the functionality you need, by clicking on the image file in Explorer.

Screen shot of the annotation utility

Here, the application has acquired the image from a TWAIN webcam source but this could just a easily be an image downloaded from a digital camera device directory. The image is displayed in a bitmap window that can be zoomed and scrolled. Regions of interest are identified by either

  • drawing a circle

  • drawing a 6 vertex polygon. Up to 32 vertices are possible.
  •  drawing titles and text
  • the last operation can be undone. More undo levels are possible.

This sample application provides pen size and colour select dialogs, and dialogs where the annotation text is entered before being written to the image. Pen and text colours are saved in the application Registry settings and recalled on restart.

Once the image annotation is complete, the image is saved to any desired image format, or / and printed. Closing the image display window automatically saves the image to disk to reduce mouse clicks and non-essential dialogs.


Copyright 2011-2019 PiXCL Automation Technologies Inc, CANADA. All Rights Reserved.