Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Multimedia Programming with Pure Data

You're reading from  Multimedia Programming with Pure Data

Product type Book
Published in Jul 2013
Publisher Packt
ISBN-13 9781782164647
Pages 350 pages
Edition 1st Edition
Languages
Author (1):
Bryan, Wai-ching CHUNG Bryan, Wai-ching CHUNG
Profile icon Bryan, Wai-ching CHUNG

Table of Contents (17) Chapters

Multimedia Programming with Pure Data
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
1. Getting Started with Pure Data 2. Computer Graphics with the GEM Library 3. Image Processing 4. Interactivity 5. Motion Detection 6. Animation with Particle System 7. Audio Programming 8. Interface with the Outside World 9. Extending Pure Data Communities and References Index

Performing color detection


Based on the material in the last section, we continue to explore color detection. In the previous patch, we do not know exactly which pixel in the window we are checking. To provide a visual feedback, we can use a small square to indicate the position. We also remove most of the number boxes to enhance performance. One of the easy ways to improve performance of a Pure Data patch is to remove the unnecessary graphical interface units, such as bang, number box, and toggle. It takes CPU time for Pure Data to update those items in the patch window. The Color004.pd patch is a working version for performing color detection. The result will be the final number box from the colorDistance abstraction:

The patch uses the same mapping logic to map the range between 0 and 1 to the width of 10.66 units and the height of 8 units. The center of the white square is the pixel we use for checking:

Note that when you click on the toggle to store color, the resulting number box reduces...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}