
CHAPTER 3. DESIGN PATTERN FOR MACHINE VISION APPLICATIONS
13
3.3
“Machine Vision App” Template
Download the .zip file from the
NI myRIO Vision Essentials Guide
main page,
extract the “Machine Vision App” folder, open the “machine vision app” Lab-
VIEW project (double-click the .lvproj file), and then double-click
Main.vi
to
open its block diagram. Take a few moments to study the structure of the block
diagram, and especially scroll through the case-structure subdiagrams to see
the various states and their associated activities.
This template provides a single starting point for each of the projects in this
lab manual. As you complete each project and develop your own library of
machine vision applications you may find it easier to work from a copy of an
existing project that is similar to the requirements of the new project. In either
case, implementing a new machine vision application will become a relatively
straightforward task once you understand the basic principles of the queued
state machine design pattern.
IMPORTANT
:
Do not be discouraged by the seeming complexity of the
queued state machine template. You will soon discover that the template is
easy to edit and achieves expected and reliable behavior without expending
unnecessary development effort.
QSM Structure
Figure 3.2 on page 20 shows the task diagram for the “Machine Vision App”
(MVA) template project.
The task diagram shows only two tasks but the
template includes many empty states that you can adapt to the needs of your
project. The default task applies an edge detector to the webcam image and
displays either this processed image or the original webcam image along with a
nondestructive graphics overlay that shows the system date and time. Figure 3.3
on page 21 shows the state sequence for the default task.
Pressing the front-panel
save image
action button
selects the
Save Image
task (Figure 3.4 on page 22); this task saves the displayed image to an image
file on the attached USB flash drive. The action button remains pressed until
released, therefore the task releases the button as its final action. Because all tasks
that respond to action buttons must conclude in a like manner, the button release
behavior is implemented in a single state that can be included in any task.
Figure 3.5 on page 23 shows the state sequence for the start-up task. These
states initialize data values, allocate memory for image buffers, reset front-panel
buttons, and configure on-board and external devices. Figure 3.6 on page 24
Summary of Contents for NI myRIO
Page 1: ...Ed Doering NI myRIO Vision Essentials Guide...
Page 2: ......
Page 11: ...Part I Machine Vision Fundamentals...
Page 12: ......
Page 31: ...Part II Introductory Machine Vision Projects...
Page 32: ......
Page 38: ...32 CHAPTER 4 CAMERA SETUP...
Page 44: ...38 CHAPTER 5 STEREO VISION...
Page 61: ...Part III Machine Vision Application Projects...
Page 62: ......
Page 72: ...66 CHAPTER 8 COIN COUNTER...
Page 86: ...80 CHAPTER 10 KEYED OPTICAL LOCK...
Page 92: ...86 CHAPTER 11 DMM TEST STAND...
Page 134: ...128 CHAPTER 17 MARBLE SORTER...
Page 135: ...Part IV Appendices...
Page 136: ......
Page 143: ...B MXPandMSPConnectorDiagrams Figure B 1 MXP myRIO eXpansion Port connector diagram...
Page 144: ...138 APPENDIX B MXP AND MSP CONNECTOR DIAGRAMS Figure B 2 MSP miniSystem Port connector diagram...
Page 148: ...142 APPENDIX D BUILD A STAND ALONE APPLICATION...
Page 149: ...E MarbleSorterConstructionDetails To be continued...
Page 150: ...144 APPENDIX E MARBLE SORTER CONSTRUCTION DETAILS...