Skip to content

Commit

Permalink
added image generation factories for transparency experiments
Browse files Browse the repository at this point in the history
  • Loading branch information
Max committed Mar 20, 2020
1 parent 10181b9 commit 203bec4
Show file tree
Hide file tree
Showing 10 changed files with 666 additions and 0 deletions.
38 changes: 38 additions & 0 deletions transparency/README.md
@@ -0,0 +1,38 @@
# Checkerboard Factory
Create images of 3-dimensional checkerboards and optionally a transparent rectangle covering a part of the board.

![3D checkerboard](./example_images/checkerboard_stacked.png)

### Example Usage
```
f = CheckerboardFactory()
f.find_checkerboard(n_checks=8)
f.build_image(tau=2, alpha=.5, camera_offset=(1, 0, 0))
checkerboard = f.get_checkerboard()
cutout = f.get_cutout()
stacked = f.get_stacked()
```

### Requires
- PovRay
- PIL
- Numpy

# Texture Factory
Create 2-dimensional textures with an optional transparent circle covering layered over the center.

Supports random textures and alternating checkerboard patterns.

![Texture Random](./example_images/texture_random.png)
![Texture Checkerboard](./example_images/texture_checkerboard.png)

### Example Usage
```
f_c = TextureFactory('checkerboard', 10, image_width=200)
img_c = f_c.get_image(.5, .75, circle_radius=50, bg_luminosity=.5)
f_r = TextureFactory('random', 2, image_width=200)
img_r = f_r.get_image(1, .5, circle_radius=50)
```

### Requires
- Numpy
6 changes: 6 additions & 0 deletions transparency/__init__.py
@@ -0,0 +1,6 @@
"""
Generation of stimuli for transparency/contrast experiments
"""

from transparency import *
Binary file added transparency/checkerboard.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
117 changes: 117 additions & 0 deletions transparency/checkerboard.pov
@@ -0,0 +1,117 @@
#version 3.7;

background { color rgb <0.50, 0.50,0.50>}

#declare lens=camera{perspective location <01,16,-50> look_at <00,00,00> angle 12};
camera{lens}

light_source{<20, 10, 7> color rgb <1.00, 1.00, 1.00> area_light 6*x, 6*y, 12, 12}

union{
box{<-2.900000, -1.000000, -2.900000>, <-2.320000, -0.710000, -2.320000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// a01
box{<-2.900000, -1.000000, -2.320000>, <-2.320000, -0.710000, -1.740000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// a02
box{<-2.900000, -1.000000, -1.740000>, <-2.320000, -0.710000, -1.160000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// a03
box{<-2.900000, -1.000000, -1.160000>, <-2.320000, -0.710000, -0.580000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// a04
box{<-2.900000, -1.000000, -0.580000>, <-2.320000, -0.710000, 0.000000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// a05
box{<-2.900000, -1.000000, 0.000000>, <-2.320000, -0.710000, 0.580000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// a06
box{<-2.900000, -1.000000, 0.580000>, <-2.320000, -0.710000, 1.160000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// a07
box{<-2.900000, -1.000000, 1.160000>, <-2.320000, -0.710000, 1.740000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// a08
box{<-2.900000, -1.000000, 1.740000>, <-2.320000, -0.710000, 2.320000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// a09
box{<-2.900000, -1.000000, 2.320000>, <-2.320000, -0.710000, 2.900000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// a10
box{<-2.320000, -1.000000, -2.900000>, <-1.740000, -0.710000, -2.320000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// b01
box{<-2.320000, -1.000000, -2.320000>, <-1.740000, -0.710000, -1.740000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// b02
box{<-2.320000, -1.000000, -1.740000>, <-1.740000, -0.710000, -1.160000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// b03
box{<-2.320000, -1.000000, -1.160000>, <-1.740000, -0.710000, -0.580000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// b04
box{<-2.320000, -1.000000, -0.580000>, <-1.740000, -0.710000, 0.000000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// b05
box{<-2.320000, -1.000000, 0.000000>, <-1.740000, -0.710000, 0.580000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// b06
box{<-2.320000, -1.000000, 0.580000>, <-1.740000, -0.710000, 1.160000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// b07
box{<-2.320000, -1.000000, 1.160000>, <-1.740000, -0.710000, 1.740000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// b08
box{<-2.320000, -1.000000, 1.740000>, <-1.740000, -0.710000, 2.320000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// b09
box{<-2.320000, -1.000000, 2.320000>, <-1.740000, -0.710000, 2.900000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// b10
box{<-1.740000, -1.000000, -2.900000>, <-1.160000, -0.710000, -2.320000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// c01
box{<-1.740000, -1.000000, -2.320000>, <-1.160000, -0.710000, -1.740000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// c02
box{<-1.740000, -1.000000, -1.740000>, <-1.160000, -0.710000, -1.160000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// c03
box{<-1.740000, -1.000000, -1.160000>, <-1.160000, -0.710000, -0.580000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// c04
box{<-1.740000, -1.000000, -0.580000>, <-1.160000, -0.710000, 0.000000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// c05
box{<-1.740000, -1.000000, 0.000000>, <-1.160000, -0.710000, 0.580000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// c06
box{<-1.740000, -1.000000, 0.580000>, <-1.160000, -0.710000, 1.160000> pigment{ color rgb <0.310000, 0.310000, 0.310000> }}// c07
box{<-1.740000, -1.000000, 1.160000>, <-1.160000, -0.710000, 1.740000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// c08
box{<-1.740000, -1.000000, 1.740000>, <-1.160000, -0.710000, 2.320000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// c09
box{<-1.740000, -1.000000, 2.320000>, <-1.160000, -0.710000, 2.900000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// c10
box{<-1.160000, -1.000000, -2.900000>, <-0.580000, -0.710000, -2.320000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// d01
box{<-1.160000, -1.000000, -2.320000>, <-0.580000, -0.710000, -1.740000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// d02
box{<-1.160000, -1.000000, -1.740000>, <-0.580000, -0.710000, -1.160000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// d03
box{<-1.160000, -1.000000, -1.160000>, <-0.580000, -0.710000, -0.580000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// d04
box{<-1.160000, -1.000000, -0.580000>, <-0.580000, -0.710000, 0.000000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// d05
box{<-1.160000, -1.000000, 0.000000>, <-0.580000, -0.710000, 0.580000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// d06
box{<-1.160000, -1.000000, 0.580000>, <-0.580000, -0.710000, 1.160000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// d07
box{<-1.160000, -1.000000, 1.160000>, <-0.580000, -0.710000, 1.740000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// d08
box{<-1.160000, -1.000000, 1.740000>, <-0.580000, -0.710000, 2.320000> pigment{ color rgb <0.310000, 0.310000, 0.310000> }}// d09
box{<-1.160000, -1.000000, 2.320000>, <-0.580000, -0.710000, 2.900000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// d10
box{<-0.580000, -1.000000, -2.900000>, <0.000000, -0.710000, -2.320000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// e01
box{<-0.580000, -1.000000, -2.320000>, <0.000000, -0.710000, -1.740000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// e02
box{<-0.580000, -1.000000, -1.740000>, <0.000000, -0.710000, -1.160000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// e03
box{<-0.580000, -1.000000, -1.160000>, <0.000000, -0.710000, -0.580000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// e04
box{<-0.580000, -1.000000, -0.580000>, <0.000000, -0.710000, 0.000000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// e05
box{<-0.580000, -1.000000, 0.000000>, <0.000000, -0.710000, 0.580000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// e06
box{<-0.580000, -1.000000, 0.580000>, <0.000000, -0.710000, 1.160000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// e07
box{<-0.580000, -1.000000, 1.160000>, <0.000000, -0.710000, 1.740000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// e08
box{<-0.580000, -1.000000, 1.740000>, <0.000000, -0.710000, 2.320000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// e09
box{<-0.580000, -1.000000, 2.320000>, <0.000000, -0.710000, 2.900000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// e10
box{<0.000000, -1.000000, -2.900000>, <0.580000, -0.710000, -2.320000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// f01
box{<0.000000, -1.000000, -2.320000>, <0.580000, -0.710000, -1.740000> pigment{ color rgb <0.310000, 0.310000, 0.310000> }}// f02
box{<0.000000, -1.000000, -1.740000>, <0.580000, -0.710000, -1.160000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// f03
box{<0.000000, -1.000000, -1.160000>, <0.580000, -0.710000, -0.580000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// f04
box{<0.000000, -1.000000, -0.580000>, <0.580000, -0.710000, 0.000000> pigment{ color rgb <1.290000, 1.290000, 1.290000> }}// f05
box{<0.000000, -1.000000, 0.000000>, <0.580000, -0.710000, 0.580000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// f06
box{<0.000000, -1.000000, 0.580000>, <0.580000, -0.710000, 1.160000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// f07
box{<0.000000, -1.000000, 1.160000>, <0.580000, -0.710000, 1.740000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// f08
box{<0.000000, -1.000000, 1.740000>, <0.580000, -0.710000, 2.320000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// f09
box{<0.000000, -1.000000, 2.320000>, <0.580000, -0.710000, 2.900000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// f10
box{<0.580000, -1.000000, -2.900000>, <1.160000, -0.710000, -2.320000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// g01
box{<0.580000, -1.000000, -2.320000>, <1.160000, -0.710000, -1.740000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// g02
box{<0.580000, -1.000000, -1.740000>, <1.160000, -0.710000, -1.160000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// g03
box{<0.580000, -1.000000, -1.160000>, <1.160000, -0.710000, -0.580000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// g04
box{<0.580000, -1.000000, -0.580000>, <1.160000, -0.710000, 0.000000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// g05
box{<0.580000, -1.000000, 0.000000>, <1.160000, -0.710000, 0.580000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// g06
box{<0.580000, -1.000000, 0.580000>, <1.160000, -0.710000, 1.160000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// g07
box{<0.580000, -1.000000, 1.160000>, <1.160000, -0.710000, 1.740000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// g08
box{<0.580000, -1.000000, 1.740000>, <1.160000, -0.710000, 2.320000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// g09
box{<0.580000, -1.000000, 2.320000>, <1.160000, -0.710000, 2.900000> pigment{ color rgb <1.950000, 1.950000, 1.950000> }}// g10
box{<1.160000, -1.000000, -2.900000>, <1.740000, -0.710000, -2.320000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// h01
box{<1.160000, -1.000000, -2.320000>, <1.740000, -0.710000, -1.740000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// h02
box{<1.160000, -1.000000, -1.740000>, <1.740000, -0.710000, -1.160000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// h03
box{<1.160000, -1.000000, -1.160000>, <1.740000, -0.710000, -0.580000> pigment{ color rgb <0.310000, 0.310000, 0.310000> }}// h04
box{<1.160000, -1.000000, -0.580000>, <1.740000, -0.710000, 0.000000> pigment{ color rgb <0.190000, 0.190000, 0.190000> }}// h05
box{<1.160000, -1.000000, 0.000000>, <1.740000, -0.710000, 0.580000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// h06
box{<1.160000, -1.000000, 0.580000>, <1.740000, -0.710000, 1.160000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// h07
box{<1.160000, -1.000000, 1.160000>, <1.740000, -0.710000, 1.740000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// h08
box{<1.160000, -1.000000, 1.740000>, <1.740000, -0.710000, 2.320000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// h09
box{<1.160000, -1.000000, 2.320000>, <1.740000, -0.710000, 2.900000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// h10
box{<1.740000, -1.000000, -2.900000>, <2.320000, -0.710000, -2.320000> pigment{ color rgb <0.310000, 0.310000, 0.310000> }}// i01
box{<1.740000, -1.000000, -2.320000>, <2.320000, -0.710000, -1.740000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// i02
box{<1.740000, -1.000000, -1.740000>, <2.320000, -0.710000, -1.160000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// i03
box{<1.740000, -1.000000, -1.160000>, <2.320000, -0.710000, -0.580000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// i04
box{<1.740000, -1.000000, -0.580000>, <2.320000, -0.710000, 0.000000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// i05
box{<1.740000, -1.000000, 0.000000>, <2.320000, -0.710000, 0.580000> pigment{ color rgb <1.670000, 1.670000, 1.670000> }}// i06
box{<1.740000, -1.000000, 0.580000>, <2.320000, -0.710000, 1.160000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// i07
box{<1.740000, -1.000000, 1.160000>, <2.320000, -0.710000, 1.740000> pigment{ color rgb <1.500000, 1.500000, 1.500000> }}// i08
box{<1.740000, -1.000000, 1.740000>, <2.320000, -0.710000, 2.320000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// i09
box{<1.740000, -1.000000, 2.320000>, <2.320000, -0.710000, 2.900000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// i10
box{<2.320000, -1.000000, -2.900000>, <2.900000, -0.710000, -2.320000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// j01
box{<2.320000, -1.000000, -2.320000>, <2.900000, -0.710000, -1.740000> pigment{ color rgb <0.630000, 0.630000, 0.630000> }}// j02
box{<2.320000, -1.000000, -1.740000>, <2.900000, -0.710000, -1.160000> pigment{ color rgb <1.050000, 1.050000, 1.050000> }}// j03
box{<2.320000, -1.000000, -1.160000>, <2.900000, -0.710000, -0.580000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// j04
box{<2.320000, -1.000000, -0.580000>, <2.900000, -0.710000, 0.000000> pigment{ color rgb <0.460000, 0.460000, 0.460000> }}// j05
box{<2.320000, -1.000000, 0.000000>, <2.900000, -0.710000, 0.580000> pigment{ color rgb <0.110000, 0.110000, 0.110000> }}// j06
box{<2.320000, -1.000000, 0.580000>, <2.900000, -0.710000, 1.160000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// j07
box{<2.320000, -1.000000, 1.160000>, <2.900000, -0.710000, 1.740000> pigment{ color rgb <0.820000, 0.820000, 0.820000> }}// j08
box{<2.320000, -1.000000, 1.740000>, <2.900000, -0.710000, 2.320000> pigment{ color rgb <2.220000, 2.220000, 2.220000> }}// j09
box{<2.320000, -1.000000, 2.320000>, <2.900000, -0.710000, 2.900000> pigment{ color rgb <0.060000, 0.060000, 0.060000> }}// j10
rotate y * 45}

polygon{4, <-2.000000, 1.850000, -8.000000> <-2.000000, -0.200000, -8.000000> <2.000000, -0.200000, -8.000000> <2.000000, 1.850000, -8.000000>
rotate x *15
translate<0, -2.3, 0>
texture{pigment {color rgb <2.000000, 2.000000, 2.000000> transmit 0.500000}}}

0 comments on commit 203bec4

Please sign in to comment.