Skip Navigation Links

Recommended Blogs:
 Machine Vision 4 Users
 Machine Vision and Image
 Microscan Tips and Tricks
 My View by Andy Wilson
Vision Insider
 Vision Systems Spain
 2d Code

Machine Vision with Your Smart Phone!
by Jonathan Ludlow on October 15, 2013
posted in Solutions & Applications
[Whispering voice]

Pssst – do you want to do machine vision without having to buy Microscan’s fine and very reasonably-priced products? You can, you know. It takes a few steps but it can be done. Just listen along…

[Back to normal indoor voice]

The first step in most successful machine vision applications is an evaluation, which usually requires sample parts to be sent to an Applications Engineer at a Microscan Partner’s office or in Microscan’s Solutions Lab. The alternative is for Microscan or our partner to come out for a site visit with cameras and lights to perform an on-site evaluation. These steps are expensive in terms of both time and money, so the question arises: “Is it possible to get useful pictures of the parts or labels in question without shipping or travel?”

You may have noticed that most of us are carrying around a gadget with a built-in camera these days, which now has more pixels than a high-end machine vision camera and which can deliver images to e-mail inboxes anywhere in the known universe (except certain parts of the U.S. state of Maine, but that is another story).

You may have figured out by now that the topic I am addressing is how to:
  1. Take useful pictures of parts with your own handy smart phone camera;
  2. Transmit them to your e-mail inbox;
  3. Transform them into something that Microscan’s ESP®, AutoVISION™, or Visionscape® FrontRunner software can use for your evaluation.

Taking Pictures

Let us begin with the topic of taking pictures of parts with a smart phone (or other handy digital camera). The first thing to consider is how to frame your part. And, as with any important imaging task, the second, third, and fourth things to consider are how to light it.

Framing means taking the picture from the same angle and orientation that a vision system would use and getting at least as many pixels in the image of your part as the vision system. This step is sort of easy. Just think ahead and consider where the camera will need to go – distance does not matter but angle is important.

Remember also to use the same orientation as the vision system camera – typically this means holding your phone sideways so that it captures the image in landscape (i.e., more wide than high) mode.

Lighting is trickier. Unless you are looking at a matte-finish part that looks the same no matter which direction it is lit from, it is unlikely that the part will be lit by an intense white point source light positioned about 5mm from the lens (where it is on my iPhone®). It is more likely that the light will be bigger, more diffuse, and will possibly come from somewhere away from the camera. This is where desk lights and other people’s phones can be useful. Borrow an iPhone with one of the “turn my phone into a flashlight” applications (like the appropriately-named Flashlight app) and you have a second light source.

So now you are lit and loaded and it is time to take some pictures. Snap away and make sure you image a variety of parts – both good parts and a sampling with representative defects.

Transmitting Pictures

Here, the trick is to make sure that nothing gets lost in the mail. Phones store and transmit images as JPEGs (JPEG stands for Joint Photographic Experts Group, of which all machine vision people are surely automatic members). JPEGs use “lossy” compression and at this stage you need to try to persuade your phone that you do not want it to save you money by transmitting a compressed picture. With an iPhone, this means that when you are ready to transmit the picture and are presented with the low/medium/high compression dialog that comes after you hit the send button – choose “Actual Size.” This will burn up the airwaves and your monthly data allowance, but will get the picture to its destination relatively unharmed.

Smart (that is, “clever” as it means in the U.S., not “well-dressed” as it means in other English-speaking jurisdictions) readers will realize that, as an alternative, they can connect the phone to their PC, navigate to its photo file, grab the pictures, zip ’em, and mail ’em. Note that zipping the images does not cause any loss of data.

Transforming Pictures

So here you are with some fine, high-res, color JPEGs – how do you get them into a form that will be appreciated by (for instance) Microscan’s AutoVISION Machine Vision Software?

There are many answers, but mine is IrfanView ( IrfanView is the Babel Fish ( of image transformation systems. It is a piece of shareware that is so useful that I have actually paid for a license ($12 USD) – as you should if you are going to use it for commercial purposes.

What follows is a step-by-step description of how to use IrfanView to transform your big, glossy, color image into (for instance) an 8 bit, monochrome, 1280 x 960 pixel TIFF image that can be loaded into AutoVISION, which is emulating a CCD Vision HAWK Smart Camera.
  1. Download and install IrfanView

  2. Load your image into IrfanView. Since IrfanView grabs most image file associations, this usually means clicking on the image to launch IrfanView and load the image there. You will notice that there is useful information about the image at the bottom of the screen. In this case we see that the image is 2592 x 1936 pixels at 24 bits per pixel – high-res and glorious color.

  3. The next step is to turn your picture into a monochrome, grayscale, 8-bit image. Do this with the Image > Convert to Greyscale (Control + G) image modification menu. Select this and the colors will disappear.

  4. The next stage is to use Image > Resize/Resample… (Control + R) to resample the image so that it is the same number of pixels and the same dimensions as it would be with a smart camera. In our example we will select 1280 x 960 pixels to match the SXGA Vision HAWK’s sensor resolution.

  5. Once this is done, save the image as a TIFF file using the IrfanView Save As operation that is hiding a convenient two-thirds of the way down on the File menu list - make sure that you select “None” as the compression option.
Once you have performed this set of operations a few dozen times, you will probably be ready to visit the Batch Conversion/Rename option in the File menu which allows grayscale conversions, resizing, and file format conversion to be carried out as one operation on a whole directory of images.

Evaluating Images

Now you have some images that can be used in AutoVISION.
  1. Launch AutoVISION;
  2. Select the Emulator;
  3. Create a New Job;
  4. Click the Edit tab;
  5. Select the camera.

  6. Specify a Camera Definition that matches the image files you have created – in this case 1280 x 960 pixels.
All that remains now is to use the file folder icon next to “Camera” to specify the folder holding your transformed images.

You are now in business with your smart phone-derived images – ready to do a preliminary application evaluation or to demonstrate to a customer just how easy it is to solve his or her problems with AutoVISION or Visionscape FrontRunner software.

Machine vision by smart phone – but not exactly in real-time. For production speeds, I’m afraid you will actually have to buy the product.

Disclaimer – (there’s always a disclaimer):

Back at the start of this post I stated that getting the lighting right is the tricky bit. The bad news is that for the long-distance evaluation to be valid you will need to make sure that the lighting is a.) the right solution (size, color, geometry) for the application and b.) something that replicates a smart camera’s built-in lighting or externally-mounted NERLITE® illuminators. Apply cunning, but remember that sometimes there is no substitute for having real parts available for a formal evaluation in the applications lab.
Posted by Jonathan Ludlow,  Machine Vision Promoter
Jonathan Ludlow is Machine Vision Promoter at Microscan’s Technology Center in Nashua, NH. He has been active in machine vision product development for many years, has authored papers on the application of machine vision in semiconductor packaging and electronic assembly, holds several patents relating to inspection systems and is a regular speaker at machine vision symposia.


Microscan Systems
February 3, 2014 12:46pm
Jhon Mario - - ¡Exactamente! Gracias por su comentario.
Jhon Mario Bolanos
February 2, 2014 14:19pm
Excelente idea para evaluar proyectos cuando el cliente esta lejos o desea preliminarmente obtener resultados, rapidos.
gracias por tan brillante idea.
logicamente para una prueba OFF-LINE, pero para la prueba definitiva se requiere en tiempo real con una camara HAWK o MINI

Post a Comment

First Name
Last Name
Email Address