Skip to content

Commit

Permalink
Merge pull request #1 from jtth/master
Browse files Browse the repository at this point in the history
Master
  • Loading branch information
saralilyb authored Feb 23, 2017
2 parents 8b7f68c + 7ac4bfb commit 053d005
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# gaborgen

If you're doing a behavioral experiment online with Gabor patches, participants have to see a lot of them. That means they have to download a lot of images. Instead of that, why not generate the images on the client side? That's what this function does.
If you're doing a behavioral experiment online with Gabor patches, participants have to see a lot of them. That means they have to download a lot of images. Instead of that, why not generate the images on the client side? That's what this function does. [See it live here.](http://jtth.github.io/gaborgen-js/)

CoffeeScript/JavaScript Gabor patch generator. The fucntion takes values for rotation and frequency between 1 and 100 and outputs a Gabor patch with rotation values between 0 and 90 degrees and frequency between .01 and .1. Makes *heavy* use of [numeric.js](http://numeric.js). There is also a version written in MathJS, but that version takes about six seconds whereas the numeric.js version takes 500ms. Then it rescales the matrix values to be between 0 and 255, and outputs those to an image on the demo web page.

Expand Down
2 changes: 1 addition & 1 deletion gab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions gab.litcoffee
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Gabor patch generator

CoffeeScript/JavaScript Gabor patch generator. The function takes values for rotation and frequency between 1 and 100 and outputs an image URL for a Gabor patch with rotation values between 0 and 90 degrees and frequency between .01 and .1. Makes *heavy* use of [numeric.js](http://numeric.js). You can remove the final call to `numeric.imageURL` (and/or the final call to `rescale`) to get the matrix itself. This code is *very* fast given, well, JavaScript. On my machine the math takes about 250ms, while MATLAB's routines take about 115ms.
CoffeeScript/JavaScript Gabor patch generator. The function takes values for rotation and frequency between 1 and 100 and outputs an image URL for a Gabor patch with rotation values between 0 and 90 degrees and frequency between .01 and .1. Makes *heavy* use of [numeric.js](http://numeric.js). You can remove the final call to `numeric.imageURL` (and/or the final call to `rescale`) to get the matrix itself. This code is *very* fast given, well, JavaScript. On my machine the math takes about 250ms, while MATLAB's routines take about 115ms.

## The main generating function

Expand Down Expand Up @@ -66,7 +66,7 @@ There. Now, let's continue.
Now we have a matrix of values. Matlab has the wonderful and magical `imshow` command that just takes the matrix and makes a picture. We have to do that magic ourselves. So to use the matrix `m` in the pnglib code below, we have to rescale all the values to be between 0 and 255, the intensity values for each pixel. Finally, we rescale the image matrix to be between 0 and 255.

scaledM = rescale(m, 0, 255)
scaledM = rescale(m, 0, 254)
# Display the picture.

Expand Down

0 comments on commit 053d005

Please sign in to comment.