A simple MATLAB interface to FireWire cameras. How to define the colour ranges used for the detection of coloured objects

Similar documents
How to define the colour ranges for an automatic detection of coloured objects

FireWire Vision Tools

TIS Vision Tools A simple MATLAB interface to the The Imaging Source (TIS) FireWire cameras (DFK 31F03)

Adobe Photoshop. Levels

Wound Analyzer TiVi103 User Manual. User Manual 1.1 Version 1.1 October 2012 PIONEERS IN TISSUE VIABILITY IMAGING

3DExplorer Quickstart. Introduction Requirements Getting Started... 4

Color and More. Color basics

6. Multivariate EDA. ACE 492 SA - Spatial Analysis Fall 2003

ISET Selecting a Color Conversion Matrix

2. Advanced Image Editing

ScanArray Overview. Principle of Operation. Instrument Components

MEASUREMENT CAMERA USER GUIDE

Exercise 4-1 Image Exploration

3. When you import the scanner for the first time make sure you change it from Full Auto Mode to that of Professional Mode.

MATLAB: Basics to Advanced

4. Measuring Area in Digital Images

Photoshop CS6 Basics. Using Layers to Create a Magazine Cover

Digital Imaging - Photoshop

Visual Media Processing Using MATLAB Beginner's Guide

GlobiScope Analysis Software for the Globisens QX7 Digital Microscope. Quick Start Guide

HISTOGRAMS. These notes are a basic introduction to using histograms to guide image capture and image processing.

ImagesPlus Basic Interface Operation

CS/NEUR125 Brains, Minds, and Machines. Due: Wednesday, February 8

ISCapture User Guide. advanced CCD imaging. Opticstar

Batch Counting of Foci

RICOH Stereo Camera Software R-Stereo-GigE-Calibration

MRI Grid. The MRI Grid is a tool in MRI Cell Image Analyzer, that can be used to associate measurements with labeled positions on a board.

Locating Molecules Using GSD Technology Project Folders: Organization of Experiment Files...1

PixInsight Workflow. Revision 1.2 March 2017

2. Advanced Image editing

1. Start a bit about Linux

Quintic Software Tutorial 3

iphoto Objective Course Outline

Adobe Studio on Adobe Photoshop CS2 Enhance scientific and medical images. 2 Hide the original layer.

Remote Sensing 4113 Lab 08: Filtering and Principal Components Mar. 28, 2018

Extreme Makeovers: Photoshop Retouching Techniques

iq-luminance User Manual

Operating Rausch ScanCam within POSM.

Using Curves and Histograms

R I T. Title: Wyko RST Plus. Semiconductor & Microsystems Fabrication Laboratory Revision: A Rev Date: 05/23/06 1 SCOPE 2 REFERENCE DOCUMENTS

User Guide for TWAIN / DirectX interface for GRYPHAX USB 3.0 cameras

Basic Tutorials Series: Import A Photograph. RenoWorks Support Team Document #HWPRO0003

SCD-0017 Firegrab Documentation

Princeton ELE 201, Spring 2014 Laboratory No. 2 Shazam

Chapter 4 MASK Encryption: Results with Image Analysis

Spherical K-Means Color Image Compression Tim Pavlik

Inserting Images Into Documents

Veco User Guides. Property Photos & Images

1. What is SENSE Batch

Spatial intensity distribution analysis Matlab user guide

Scanning: pictures and text

Machinery HDR Effects 3

MDSP RESOLUTION ENHANCEMENT SOFTWARE USER S MANUAL 1

SCANNING METHODS. Edited 7/2014 JKH REPRESENTING ORIGINAL IMAGE CONDITION - 2 SCANS. 1) Open Adobe Photoshop.

Introduction to Simulink Assignment Companion Document

ThermaViz. Operating Manual. The Innovative Two-Wavelength Imaging Pyrometer

Let s start by making a pencil, that can be used to draw on the stage.

CS 200 Assignment 3 Pixel Graphics Due Monday May 21st 2018, 11:59 pm. Readings and Resources

Launch Photoshop and use File>Open from the Photoshop menu to open an image file.

ScanGear CS-U 5.3 for CanoScan FB630U/FB636U Color Image Scanner User s Guide

Image resizing with Microsoft Office Picture Manager

2. Advanced Image Editing

11 Advanced Layer Techniques

Technical Note How to Compensate Lateral Chromatic Aberration

Table of Contents 1. Image processing Measurements System Tools...10

Data Analysis in MATLAB Lab 1: The speed limit of the nervous system (comparative conduction velocity)

Movie 3. Basic Camera Raw workflow

GESTURE RECOGNITION SOLUTION FOR PRESENTATION CONTROL

Integrated Image Processing Functions using MATLAB GUI

GUI - DLD Software. Manual

Manual. Cell Border Tracker. Jochen Seebach Institut für Anatomie und Vaskuläre Biologie, WWU Münster

INSTRUCTION MANUAL. All Sky Imager Find Clouds Software ASI-16

X-RAY COMPUTED TOMOGRAPHY

Tutorial: Correcting images

Surface Analyzer TiVi95 User Manual. User Manual 3.1 Version 3.1 January 2012 PIONEERS IN TISSUE VIABILITY IMAGING

Applications of satellite and airborne image data to coastal management. Part 2

Version 2 Image Clarification Tool for Avid Editing Systems. Part of the dtective suite of forensic video analysis tools from Ocean Systems

ToupSky Cameras Quick-guide

CONTENTS. Chapter I Introduction Package Includes Appearance System Requirements... 1

Living Image 3.2 Software Release Notes New Features and Improvements

User Manual for HoloStudio M4 2.5 with HoloMonitor M4. Phase Holographic Imaging

Biometrics Final Project Report

Stitching MetroPro Application

ISIS A beginner s guide

Unsupervised Classification

Computer Graphics: Graphics Output Primitives Primitives Attributes

Agility Course Designer Users Guide. Agility Course designer program for Windows PC

We recommend downloading the latest core installer for our software from our website. This can be found at:

Procedures for the Use of the PointGrey Flea3 FireWire Camera and ImageJ *

AECOsim Building Designer. Quick Start Guide. Chapter 2 Making the Mass Model Intelligent Bentley Systems, Incorporated.

GlassSpection User Guide

μscope Microscopy Software

Essential Post Processing

IMAGES AND COLOR. N. C. State University. CSC557 Multimedia Computing and Networking. Fall Lecture # 10

Leica DFC Cameras. Image Acquisition

Correction Techniques

AECOsim Building Designer. Quick Start Guide. Chapter A06 Creating a Master Model Bentley Systems, Incorporated.

Use Linear Regression to Find the Best Line on a Graphing Calculator

Photoshop CS2. Step by Step Instructions Using Layers. Adobe. About Layers:

Exercise questions for Machine vision

Transcription:

How to define the colour ranges used for the detection of coloured objects The colour detection algorithms scan every frame for pixels of a particular quality. A coloured object is defined by a set of pixels whose colour components Y, U and V fall within predefined ranges. These ranges can be programmed in the Thresholds section of the colour definition file. The latter is a text file with at least two sections, Colors and Thresholds. The Colors section has an entry for each object to be detected. It defines an RGB colour triplet, a merge parameter (0 1), a colour identifier (0 31) and a label (text). Every entry in Colors must have a corresponding entry in Thresholds. For each coloured object the Thresholds section lists a set of ranges for Y (brightness), U (first colour attribute) and V (second colour attribute). A typical colour definition file has the following structure: [Colors] (255, 255, 0) 0.95 0 yellow (255, 0, 0) 0.95 1 red (0, 0, 255) 0.95 2 blue [Thresholds] (228:234, 12:28, 130:134) % too narrow yellow (88:98, 110:118, 185:197) % working red (115:136, 191:203, 59:70) % narrow blue The algorithms associate each line in the Colors section with a corresponding line in the Thresholds section. Comments such as the ones found in the Thresholds section are ignored during the parsing of a colour definition file. Suitable choices for the colour Thresholds can easily be found with the training utility traincamera (working of live images from the camera or a pre-recorded AVI movie). This GUI controlled tool is fairly self-explaining images are acquired from a connected camera. Upon freezing the live image stream, an object can be selected with the mouse. The colour ranges of the selected pixels are then determined and displayed. Finally, the image stream can be switched back to running and the newly found colour ranges can be tested. traincamera The utility traincamera checks if a camera is connected. Should this check be unsuccessful, a pre-recorded AVI movie clip is loaded and used instead. The default filename is testmovies/test_short.avi (see script traincamera.m ); this name can be modified to any suitable AVI movie file, e. g. the robot test movie test_robot_lq.avi (low quality) or test_robot_hq.avi (high quality). Both can be found in the folder testmovies. The control elements of traincamera are shown in Figure 1. The Video mode can be chosen as well as the Width, Height and Origin of the frame to be returned by the acquisition command of the FireWire_Vision toolbox. Figures 2, 3 and 4 illustrate a few examples in which a different video mode is chosen (YUV 4:4:4, frame size: 160 x 120), a reduced size of the return image is requested and the origin has been shifted. 1

Figure 1: traincamera in action Figure 2: Changing the video mode Figure 3: Reduced image size and shifted origin 2

A frame can be frozen through clicking on the toggle button Freeze. This reveals a further push button Select. Click on Select to you might have guessed it select a particular object of interest. Simply click the left button of the mouse and, keeping the button pressed, drag mouse pointer until a suitable region has been marked. Release the mouse button to complete selection of the object. Figure 4 shows the rectangular rubber band box which is displayed during object selection. Figure 4: Selection of an object Upon selection of the object, all pixels within the frozen frame which fall inside the determined Y, U, V colour ranges are marked by a pattern of black-and-white boxes (Figure 5). 3

Figure 5: Visualizing the chosen object In addition to colouring in the selected object, the three plots on the right-hand side of the GUI window show histograms of the Y, U and V components of the pixels which have been marked during object selection. Furthermore, the Thresholds edit box in the centre of the GUI window displays the corresponding colour ranges. Note the extremely ranges (e.g. U-range: 126:126). Sometimes colour detection can be made more robust by manually widening the detected colour ranges. This is shown in Figure 6, where all three ranges have been widened to make the filter less restrictive. The histograms now correspond to the distribution of all pixels within the frozen frame. Figure 6: Manually adjusting the ranges of a detected object Once a satisfactory choice has been made for the colour ranges of the object to be detected and tracked, the contents of the Thresholds edit box can be copied into the specified colour definition file. Click the Copy to colour definition file button to copy 4

the current [Thresholds] to the specified colour definition file. Alternatively, click on the Edit button to manually edit this file in the MATLAB editor. The Thresholds can now be tested with live images. Click the Frozen toggle button to return to the stream of live images from the camera. Now click the Test button and you should see the colour detection system in action (Figure 7). Note that the system will detect at most as many different coloured objects as there are entries within the Color section of the named colour detection file (here: 2). Detected objects are displayed using the colour which is complementary to the one specified by the RGBtriplet of the Color section. Figure 7: Colour detection system in action If no camera is found on the 1394 bus (FireWire), traincamera works off prerecorded avi movie clips (Figure 8). In this case, the settings of Video mode, Width, Height and Origin are ignored. Figure 8: Running off a pre-recorded avi movie clip 5

trainstill (obsolete use traincamera instead) This utility function allows a user to determine the YUV ranges of an object which is chosen from a pre-recorded (still) image. The image is expected to be stored in a regular MAT-file, containing a variable yuyv (YUYV format) or rgb (RGB format). The default filename is testimages/testimageyuyvrgb.mat ; it can be modified in the source code of trainstill (see line 10 of the script file trainstill.m ). Once started, trainstill displays the loaded image file as well as three smaller graphs for the YUV statistics of the current object. As nothing has been selected yet, these graphs appear empty. An object can be defined for colour detection using the mouse. Left-hand click on the image, keeping the mouse button pressed. The appearing rubber band box can be moved around until the mouse button is released. Choose an area of the object which includes its representative colour and as few other colour pixels as possible. The larger the variety of colours found inside the chosen area, the less accurate the colour detection algorithms will work. It should be pointed out, however, that too narrow training could result in the failure of detecting an object at all, especially under varying lighting conditions. Following the selection of an object, trainstill displays histograms for the Y, U and V components of all associated pixels. Thin red lines are displayed to indicate the chosen ranges. The choice is made automatically, based on the essential weight of the histogram of each component (YUV). At present, trainstill uses up to two standard deviations, centred at the mean value of the histogram. To make this selection more acute, change the variable numberstd to value smaller than 2. Figure 9 shows the tool trainstill with the included test image. The yellow object has been selected; this relatively bright colour is characterised by a high Y value (brightness), a diffuse distribution of U values and a reasonably narrow spread of V values. Qualifying pixels have been shaded black and white. Figure 9: trainstill in action The YUV thresholds are displayed in the MATLAB command window. In this case, trainstill suggests the following ranges: 6

(Ymin:Ymax, Umin:Umax, Vmin:Vmax) (228:234, 12:28, 127:135) To validate the chosen range, the m-file script test can be run. This m-file calls upon the colour detection algorithms, which have been made accessible to the MATLAB environment in form of a dynamically loaded library (DLL): imgproc.mex32. The DLL expects the colours ranges to be found in the colour definition file testcolors.txt. Copy and past the above line to the first entry of the Thresholds section in testcolors.txt and run test.m. Your colour definition file should resemble the following lines: [Colors] (255, 255, 0) 0.95 0 yellow [Thresholds] (228:234, 12:28, 127:135) Run test by entering at the command line: test('testimages/testimageyuyvrgb.mat',[1 2 3]) This tells test to load the image file testimages/testimageyuyvrgb.mat and to scan for the first colour of the colour definition file. Figure 10 illustrates the output of test using the above colour scheme. The yellow object has not been detected. A possible reason could be that the object selection was based on too few pixels. Figure 9: Validation of the chosen range: failure 7

Repeat the training, this time selecting a larger variety of shades of yellow (e. g. the bright central area as well as the less luminous fringes on the left and/or the right of the object). This could produce modified thresholds such as the following: (217:234, 7:35, 127:135) % modified selection Notice that both U and V range have been expanded while the brightness (Y) remains unaltered. With the modified colour definition file (testcolors.txt), the yellow object is successfully detected (Figure 11). Figure 11: Validation of chosen range: success Try and find appropriate colour ranges for all three objects (yellow, red, blue). To validate colour schemes with more than one colour definition enter the following command: test('testimages/testimageyuyvrgb.mat', [1 2 3]) This instructs the processing DLL (imgproc.mex32) to scan for the colour definitions with colour IDs 0, 1 and 2 (the DLL uses indices starting from 0 rather than 1 ). Figure 12 shows the result. 8

Figure 12: Successful detection of all three objects traincamerastereo The utility traincamerastereo facilitates the finding of appropriate colour ranges in conjunction with a set of two cameras (stereoscopic vision). The program first checks if at least two cameras are connected. Should this check return negative, a prerecorded AVI movie clip is used instead. The default filename is testmovies/test_short.avi; this name can be modified to any suitable AVI movie file, e. g. the robot test movie test_robot_lq.avi (low quality) or test_robot_hq.avi (high quality). Both can be found in the folder testmovies. Figure 13 shows the main screen of traincamerastereo, demonstrating how one and the same object has been detected. Notice that the luminance component (y) of camera 2 (brightness: 87) is much lower than that of camera 1 (brightness: 187). There also is a slight variation in one of the chrominance components (u). 9

Figure 13: Stereoscopic vision: Identifying objects The tool prints the detected YUV colour ranges to the command window. The range definitions for Camera 1 are printed first, followed by those of camera 2. Copying these definitions to the colour specification files (e.g. colour1.txt and colour2.txt ) should allow the target to be tracked with sufficient accuracy. Scanning 'cameraconfig.txt' for camera settings for camera 1 Programming camera '1' with: 6 90 96 69 187 511 304 Scanning 'cameraconfig.txt' for camera settings for camera 2 Programming camera '2' with: 6 90 96 69 87 511 304 (Ymin:Ymax, Umin:Umax, Vmin:Vmax) (146:162, 72:84, 173:181) (Ymin:Ymax, Umin:Umax, Vmin:Vmax) (44:82, 91:103, 162:176) Frank Wörnle, January 2008. 10