Thursday, April 7, 2011

Assignment 4.2 (continued)

Part 2

There were a couple tutorials that I really liked. I'll choose this one as the best because it shows you a basic program, which is a little guessing game.



This video goes over if statements and how to use the less-than, equal, greater-than, etc. Here's the code for the guessing game:


clear
ANSWER = $RANDOM

while [1]; do
{
echo "Enter your guess (number): "
read USER_GUESS
if [ $USER_GUESS -eq $ANSWER ]; then
{
echo "Correct guess."
exit 0
}
elif [ $USER_GUESS -gt $ANSWER ]; then
{
echo "Too high. Try again."
}
else
{
echo "Too low. Try again."
}
fi
}
done


I wanted to mention this video as well:

http://www.youtube.com/watch?v=QGvvJO5UIs4

This one was nice because it showed you how to easily create and modify text files. This was something that other tutorials didn't cover, or they had you open up a text editor, which you don't really need to do. You just type:

nano file_name.sh

and then it takes you into the file to edit it. To quit and save the file you press control X and it takes you back to the normal terminal. To run the script, you type:

./file_name.sh

Pretty simple. It also teaches you how to write a simple script that asks for user input then stores what you typed into a separate text file. Here's the code:


#!/bin/bash

clear
echo "Welcome"
sleep 2
echo "how is your day going?"
read ans

clear
echo "you typed $ans"
echo "$ans" >> ans.txt

cat ans.txt

Wednesday, April 6, 2011

Assignment 4.2

Part 1.

The best Bash shell tutorial I found was this one here:

http://www.youtube.com/watch?v=N4wKqsMJqnw

It actually doesn't go over that many commands that you can use in the Terminal, but we learned a lot of that in class. This video shows you how to be more productive when working in Bash. You can move the cursor left and right a whole word using alt F and B, respectively. You have to make sure "use option as meta key" is turned on under the preferences though. You can also search your history for any commands you had typed before using command R.

Sunday, April 3, 2011

Journal Post 10

I thought the idea of a home-made infrared camera was really cool, so I looked up some videos. This video uses a method that Joe described in class using negative strips.



This video here shows a way of seeing in the dark using red and blue sulafane cutouts placed in front of a flashlight's lens and then shining the flashlight while looking through the lens of a camera. I guess the sulafane layers are too thick for normal light to pass through, but not infrared. The video says you need an older camera to make this work though (from the 90s).

Assignment 4.1 (continued)

Part 1.

I honestly haven't been able to find any very helpful video tutorials online for Photoshop javascript, but there have been some web pages that have helped a ton. The most useful one for me was this site here:

http://www.kirupa.com/motiongraphics/ps_scripting.htm

This tutorial is actually several pages long. It goes through basic operations such as creating new layers/documents, making loops, merging layers, and making selections. After reading this and the Scripting Guide I was able to get a pretty good start on the color blind image. Neither of them were able to help me with some of the more specific problems I had though, such as coping a channel into a layer or using the channel mixer command.

Thursday, March 31, 2011

Assignment 4.1 - Image Manipulation, Intermediate Scripting

Part 2.

I haven't figured out how to script the color blind image yet. I will describe what I have so far though. I read through the scripting guide while working on this assignment, which helped a ton. There were a lot of web pages that were helpful too, but I still couldn't figure out everything.

My first approach was to pretty much do what we did in class by copying one of the RGB channels of the image and pasting it in a new layer. My problem was actually copying what was in the channel. I was trying a select-all, copy, then paste, but that only worked for copying other layers.

My second approach was to create the channels myself by changing the original background layer. Luckily, I found a command called Channel Mixer that does exactly that. I just had to copy the background layer into a new layer then apply the Channel Mixer. Unluckily though, I couldn't figure out how to use that command while scripting. The closest thing I could find was a command called mixChannels. I couldn't get the same results using that command though, and it used CMY instead of RGB for some reason. If I can get that to work correctly, then I would just need to desaturate the image to match one of the channels.

I had problems with desaturating as well. I used the command: layer.HSBColor.saturation(-100), but the script kept complaining about it. Once I get through these issues it should be pretty straight forward, I hope. Here's the code I'm currently using. I'm going for a "Tritanomaly" color blindness, which makes it hard to distinguish between blue and yellow hues. It might be a little trickier than red/green discrimination because there's no yellow channel by default, but I should be able to make one without too much problem.


var curDoc = activeDocument

//blue channel layer
var layerBlue = curDoc.artLayers.add()
layerBlue.name = "Blue Channel"

curDoc.artLayers["Background"].copy()
curDoc.paste()

//yellow channel layer
var layerYellow = curDoc.artLayers.add()
layerYellow.name = "Yellow Channel"

curDoc.artLayers["Background"].copy()
curDoc.paste()

//code I used at some point and put aside for now:
//layerYellow.mixChannels ([[100,100,100,00],[100,100,100,00],[0,0,0,00]], false)
//layerRed.HSBColor.saturation(-100)
//redChannel = new Array (curDoc.channels[1])
//activeChannels = blueChannel
//curDoc.selection.selectAll()

Journal Post 9

A week or so ago in class we mentioned using the 3D feature of Photoshop and how you can import 3D models and paint on them. I've been playing around with that a bit by importing a chair model from Maya. Photoshop's 3D controls and capabilities are a bit convoluted, and painting directly on the chair didn't work very well. I watched and read a few tutorials, but none of them were too helpful when it came to modifying textures, which is what I was mostly interested in. You can add and manipulate the texture, like for my chair I added a wood texture, but I couldn't tell how it was mapped on to the geometry. I added a simple design to the seat of the chair, but I had to guess by using trial and error where on the texture file it would correspond to the seat. I would imagine there are better ways of painting your 3D model in Photoshop. Maybe if you create the UVs in Maya first? Might be something to check out further later on.

Here's the chair model in Photoshop:

Thursday, March 24, 2011

Journal Post 8

Today I wrote a photoshop script that creates a simple effect. Well, I didn't exactly "write" it, I copied code from the ScriptingListener log and used that to make my own script. I decided to post about it because this script would have been useful for part 5 of the last assignment. For that part of the assignment I applied this same design. If I had the script I could have replaced three of my steps with one.

The code is pretty long (77 lines), so I probably wont post it here. I wish blogger would let me upload a text file or something.