Lecture Notes I

Download Report

Transcript Lecture Notes I

CS320n –Visual Programming
Clusters and Images
What We Will Do Today
• Look at clusters in LabVIEW and start
working with images
Visual Programming
Clusters and Images
2
Clusters
• Arrays are used to hold many elements
that are of the same data type
• A cluster is used to hold together data of
different types
– normally fewer elements than an array
– but some of the elements may be arrays
themselves
Visual Programming
Clusters and Images
3
Cluster Example
• Take a name and an age and
put them together
• Name = string
• Age = int
• The “Bundle” function is used
to group together different
elements into a cluster
– number of input can vary
– drag down on button of function
to add more inputs
Visual Programming
Clusters and Images
4
Creating a Cluster
Bundle Function
Clusters can be used to reduce the number of wires in a diagram.
Like a high level view of data.
Analogous to high level methods / functions in Alice.
Visual Programming
Clusters and Images
5
Opening Images in LabVIEW
• LabView provides a way
to open image files
• jpg, png, and bmp are
image types
– different ways of saving
an image on a computer
• Specify location of
image with a path
control
Visual Programming
Clusters and Images
6
Picture functions
• To open a picture in LabVIEW use a path control
and wire to a Read JPEG File function
• Note the output on the Read JPEG File function
Visual Programming
Clusters and Images
7
Image is a Cluster
• Lots of Data!
indicates arrays
Visual Programming
Clusters and Images
8
Looking at the Raw Image Data
• Use an Unbundle function and an array
indicator in the image cluster
– right click on image output
and select create -> indicator
Unbundle
Visual Programming
Clusters and Images
Right click on
this output terminal
9
Class work
• Link on the class web page to an image of
the UT tower
• how many pixels in the picture? (Find
answer using LabVIEW, not some other
graphics program)
Visual Programming
Clusters and Images
10