diff options
author | KT <tran0563@umn.edu> | 2021-09-06 19:07:33 -0500 |
---|---|---|
committer | KT <tran0563@umn.edu> | 2021-09-06 19:07:33 -0500 |
commit | cccd3186305915d92b1751dc616979d64116a4aa (patch) | |
tree | 5dd4834daef547cd45fc0b643f44a10b581de0ad /worksheets/a1_textrain.md | |
parent | Added missing images for the A6 worksheet (diff) | |
download | csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.gz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.bz2 csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.lz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.xz csci4611-cccd3186305915d92b1751dc616979d64116a4aa.tar.zst csci4611-cccd3186305915d92b1751dc616979d64116a4aa.zip |
Upload a1
Diffstat (limited to 'worksheets/a1_textrain.md')
-rw-r--r-- | worksheets/a1_textrain.md | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/worksheets/a1_textrain.md b/worksheets/a1_textrain.md index b588d1c..6ce1142 100644 --- a/worksheets/a1_textrain.md +++ b/worksheets/a1_textrain.md @@ -24,6 +24,10 @@ documentation](https://processing.org/reference/color_.html) and/or the [tutorial explaining color in Processing](https://processing.org/tutorials/color/). +Here are a couple of questions to get you thinking about how to work with +pixel arrays and colors in this format. Note: These are very brief questions +in this first worksheet, so this may not take you long at all. That's ok! + ## Q1: Indexing @@ -41,6 +45,12 @@ information from `inputImg` to help you. ``` PImage inputImg = loadImage("test.jpg"); +// your code should work for any valid values for row and column, we've +// randomly picked the values (2, 2) here as an exmaple. +int row = 2; +int column = 2; + +// write your answer in terms of the row and column defined above int index1D = /* --- Fill this in --- */; ``` @@ -50,8 +60,10 @@ int index1D = /* --- Fill this in --- */; The image processing technique known as *thresholding* will be useful while creating your Text Rain. During the thresholding operation, if a pixel's grayscale value is less than `threshold`, then it becomes black. If the -value is greater than `threshold`, it becomes white. You can use the green -channel of the color as the grayscale value. +value is greater than or equal to `threshold`, it becomes white. In the example below, +assume the image has already been converted to grayscale. This means the +red, green, and blue channels are all equal. So, you can get the grayscale +value by accessing any one of the color channels red, green, or blue. In the code block below, write a Java code snippet for thresholding one pixel (`inputPixel`) to black or white. |