| 1 | #include <cvd/colourmap.h> |
| 2 | #include <cvd/image_io.h> |
| 3 | using namespace CVD; |
| 4 | using namespace std; |
| 5 | |
| 6 | int main() |
| 7 | { |
| 8 | typedef float C; |
| 9 | Image<Rgb<C>> i(ImageRef(256, 256)); |
| 10 | |
| 11 | //Show three colourmaps side by side from low (top of image) |
| 12 | //to high (bottom of image) |
| 13 | for(int r = 0; r < i.size().y; r++) |
| 14 | for(int c = 0; c < i.size().x; c++) |
| 15 | { |
| 16 | if(c < i.size().x / 3.) |
| 17 | i[r][c] = Colourmap<Rgb<C>>::hot(r * 1.0 / i.size().y); |
| 18 | else if(c < i.size().x * 2. / 3.) |
| 19 | i[r][c] = Colourmap<Rgb<C>>::jet(r * 1.0 / i.size().y); |
| 20 | else |
| 21 | i[r][c] = Colourmap<Rgb<C>>::gkr(r * 1.0 / i.size().y); |
| 22 | } |
| 23 | |
| 24 | img_save(i, "colourmaps.png"); |
| 25 | } |