Skip to content

Commit

Permalink
New python script to generate video frames
Browse files Browse the repository at this point in the history
I have added a new python video that generates the video frames for the
zoom in and out video. I am now using a proportional zoom instead of
different polynomials and this works perfect.

Signed-off-by: Christian Rapp <[email protected]>
  • Loading branch information
crapp committed Jun 5, 2016
1 parent e2c4901 commit fc5e1c3
Show file tree
Hide file tree
Showing 11 changed files with 402 additions and 151 deletions.
9 changes: 7 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Geomandel

[![Build Status](https://travis-ci.org/crapp/geomandel.svg?branch=master)](https://travis-ci.org/crapp/geomandel)

[![geomandel License](https://img.shields.io/badge/license-GPL3-blue.svg)](#license)
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->

Expand Down Expand Up @@ -645,7 +645,7 @@ Please note this extra memory is only acquired when you use SFML (PNG/JPG).

Brief overview over the development process.

## Repositories
### Repositories
The [github repository](https://github.com/crapp/geomandel) of geomandel has
several different branches.

Expand Down Expand Up @@ -703,6 +703,11 @@ branches on the [travis project page](https://travis-ci.org/crapp/geomandel).
Besides testing compilation on different systems and compilers I also run the
unit tests after the application was compiled successfully.

## Bugs, feature requests, ideas

Please use the [github bugtracker](https://github.com/crapp/geomandel/issues)
to submit bugs or feature requests

## ToDo

Have a look in the todo folder. I am using the [todo.txt](http://todotxt.com/)
Expand Down
58 changes: 39 additions & 19 deletions resources/FractalZoomCalculator.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
{
"cell_type": "code",
"execution_count": 44,
"execution_count": 1,
"metadata": {
"collapsed": true
},
Expand All @@ -23,28 +23,37 @@
},
{
"cell_type": "code",
"execution_count": 45,
"execution_count": 2,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"zoom 8.55233095042e+12\n"
]
}
],
"source": [
"# start values\n",
"real_min = np.double(-2.0)\n",
"real_max = np.double(1.0)\n",
"ima_min = np.double(-1.5)\n",
"ima_max = np.double(1.5)\n",
"\n",
"zoom = np.int(1000)\n",
"image_width = np.int(640)\n",
"image_height = np.int(480)\n",
"xcoord = np.int(89)\n",
"ycoord = np.int(321)\n"
"zoom = np.double(8552330950415.195)\n",
"print(\"zoom \" + str(zoom))\n",
"image_width = np.int(1000)\n",
"image_height = np.int(1000)\n",
"xcoord = np.double(501.705349998)\n",
"ycoord = np.double(450.64976)\n"
]
},
{
"cell_type": "code",
"execution_count": 46,
"execution_count": 3,
"metadata": {
"collapsed": true
},
Expand All @@ -57,7 +66,7 @@
},
{
"cell_type": "code",
"execution_count": 47,
"execution_count": 4,
"metadata": {
"collapsed": false
},
Expand All @@ -73,20 +82,31 @@
},
{
"cell_type": "code",
"execution_count": 48,
"execution_count": 5,
"metadata": {
"collapsed": false
},
"outputs": [],
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"real_delta_zoom 3.507815608859661e-16\n",
"ima_delta_zoom 3.507815608859661e-16\n"
]
}
],
"source": [
"# Applying zoom to current delta\n",
"real_delta_zoom = real_delta / zoom\n",
"ima_delta_zoom = ima_delta / zoom"
"ima_delta_zoom = ima_delta / zoom\n",
"print(\"real_delta_zoom \" + repr(real_delta_zoom))\n",
"print(\"ima_delta_zoom \" + repr(ima_delta_zoom))"
]
},
{
"cell_type": "code",
"execution_count": 49,
"execution_count": 6,
"metadata": {
"collapsed": false
},
Expand All @@ -102,7 +122,7 @@
},
{
"cell_type": "code",
"execution_count": 50,
"execution_count": 7,
"metadata": {
"collapsed": false
},
Expand All @@ -112,15 +132,15 @@
"output_type": "stream",
"text": [
"Complex Plane:\n",
"\tReal -1.5843125 -1.5813125\n",
"\tImaginary 0.50475 0.50775\n"
"\tReal -0.49488395000617547 -0.49488395000582464\n",
"\tImaginary -0.14805072000017525 -0.14805071999982447\n"
]
}
],
"source": [
"print(\"Complex Plane:\")\n",
"print(\"\\tReal \" + str(real_min_zoom) + \" \" + str(real_max_zoom))\n",
"print(\"\\tImaginary \" + str(ima_min_zoom) + \" \" + str(ima_max_zoom))"
"print(\"\\tReal \" + repr(real_min_zoom) + \" \" + repr(real_max_zoom))\n",
"print(\"\\tImaginary \" + repr(ima_min_zoom) + \" \" + repr(ima_max_zoom))"
]
},
{
Expand Down
84 changes: 0 additions & 84 deletions resources/QuadraticZoomPlayground.ipynb

This file was deleted.

110 changes: 110 additions & 0 deletions resources/VideoZoomPolynomial.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
"# Zoom values for Video frames\n",
"\n",
"This was a test to find a polynomial which generates good zoom values for video frames."
]
},
{
"cell_type": "code",
"execution_count": 32,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"import numpy as np\n",
"import matplotlib.pyplot as plt\n",
"import numpy.polynomial.polynomial as poly"
]
},
{
"cell_type": "code",
"execution_count": 33,
"metadata": {
"collapsed": false
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"250000.0\n"
]
}
],
"source": [
"zoom_range = np.arange(1, 1250)\n",
"x = np.array([1, 10, 100, 250, 500, 750, 1000])\n",
"y = np.array([1, 2, 10, 100, 500, 30000, 250000])\n",
"\n",
"coefs = poly.polyfit(x, y, 6)\n",
"#print(coefs)\n",
"print(poly.polyval(1000, coefs))\n",
"ffit = poly.polyval(zoom_range, coefs)\n",
"\n",
"#plt.plot(zoom_range, ffit)\n",
"#plt.plot(x, y, 'bo')\n",
"#plt.show()"
]
},
{
"cell_type": "code",
"execution_count": 34,
"metadata": {
"collapsed": false
},
"outputs": [],
"source": [
"fig = plt.figure(1)\n",
"ax_1 = fig.add_subplot(211)\n",
"ax_1.plot(zoom_range, np.log(zoom_range)**2, 'r', label=\"x^2\")\n",
"ax_1.set_yscale('log')\n",
"ax_1.legend()\n",
"ax_2 = fig.add_subplot(212)\n",
"ax_2.plot(zoom_range, zoom_range**2 / 20, 'b', label=\"x^3\")\n",
"ax_2.set_yscale('log')\n",
"ax_2.legend()\n",
"plt.show()"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.5.1"
}
},
"nbformat": 4,
"nbformat_minor": 0
}
Loading

0 comments on commit fc5e1c3

Please sign in to comment.