Image Import Example
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This code example shows how to use, and the differences between, the import-pcolors
, import-drawing
, and import-pcolors-rgb
primitives.
Agents cannot sense the drawing, so they cannot interact with or process images imported by import-drawing
. If you need an image agents can sense, you must use import-pcolors
or import-pcolors-rgb
.
HOW TO USE IT
Select the sample image you want to import with the FILENAME chooser, and then press either button below the chooser.
If you want to use your own image file, use the buttons that use user-choose-file
to let you pick a file.
THINGS TO NOTICE
The drawing appears in front of the patch colors.
Images imported by import-pcolors
and import-pcolors-rgb
are scaled to fit the world. The colors when using import-pcolors
may be distorted since NetLogo supports only a limited color set for pcolor
values. When using import-pcolors-rgb
the colors will be set to three-item RGB lists. See the Color section of the Programming Guide in the NetLogo User Manual for information on colors in NetLogo.
THINGS TO TRY
Try loading the different images into the patches to get an idea of the type of color distortion to expect.
Try importing an image with import-pcolors
and then import the same image with import-drawing
and import-pcolors-rgb
. How does handling of the image differ?
Comments and Questions
;; There are no procedures in this model. ;; All of the code is in the buttons in ;; the interface tab. ; Public Domain: ; To the extent possible under law, Uri Wilensky has waived all ; copyright and related or neighboring rights to this model.
There are 10 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Image Import Example.png | preview | Preview for 'Image Import Example' | over 12 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.