• Stars
    star
    583
  • Rank 76,663 (Top 2 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created over 3 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A simple image/video to Desmos graph converter run locally

Desmos Bezier Renderer

A simple image/video to Desmos graph converter run locally. Rotoscopes images using Canny and Potrace edge detection as Bezier curves on Desmos Graphing Calculator.

Setup

This guide won't work out of the box on Windows. The easiest way to do this on Windows is to install WSL to run all the commands below. You can find it produces under the \\wsl$\Ubuntu-20.04\home path on your PC.

Install dependencies

sudo apt update
sudo apt install git python3-dev python3-pip build-essential libagg-dev libpotrace-dev pkg-config

Clone repository

git clone https://github.com/kevinjycui/DesmosBezierRenderer.git
cd DesmosBezierRenderer

Install requirements

python -m venv env
. env/bin/activate
pip install wheel
pip install -r requirements.txt

Replace the images in the frames directory with your own and name each image frame%d.png where %d represents the frame-number starting from 1. To render just a single image, add a single image named frame1.png in the directory. The renderer will work best with 360p to 480p resolution images (you may have to lower the resolution further with more complex frames).

rm -r frames
mkdir frames
...

Settings

Constants in the backend.py file can be changed to optimise or customise your render via command-line arguments.

$ python backend.py -h
backend.py -f <source> -e <extension> -c <colour> -b -d -l -g --yes

	-h	Get help

-Options

	-f <source>	The directory from which the frames are stored (e.g. frames)
	-e <extension>	The extension of the frame files (e.g. png)
	-c <colour>	The colour of the lines to be drawn (e.g. #2464b4)
	-b		Reduce number of lines with bilateral filter for simpler renders
	-d		Download rendered frames automatically
	-l		Reduce number of lines with L2 gradient for quicker renders
	-g		Hide the grid in the background of the graph
	
	--yes		Agree to EULA without input prompt

Use python backend.py -h to see the above help message. Run without any command-line arguments to create a rendering with the same settings as seen in this video.

Running the command

Run the backend (This may take a while depending on the size and complexity of the frames). It should eventually show that the server is running on http://127.0.0.1:5000 with the render available at http://127.0.0.1:5000/calculator.

python backend.py

The following is an example of the output:

$ python backend.py 
  _____                                
 |  __ \                               
 | |  | | ___  ___ _ __ ___   ___  ___ 
 | |  | |/ _ \/ __| '_ ` _ \ / _ \/ __|
 | |__| |  __/\__ \ | | | | | (_) \__ \
 |_____/ \___||___/_| |_| |_|\___/|___/

                   BEZIER RENDERER
Junferno 2021
https://github.com/kevinjycui/DesmosBezierRenderer

 = COPYRIGHT =
©Copyright Junferno 2021-2023. This program is licensed under the [GNU General Public License](https://github.com/kevinjycui/DesmosBezierRenderer/blob/master/LICENSE). Please provide proper credit to the author (Junferno) in any public media that uses this software. Desmos Bezier Renderer is in no way, shape, or form endorsed by or associated with Desmos, Inc.

 = EULA =
By using Desmos Bezier Renderer, you agree to comply to the [Desmos Terms of Service](https://www.desmos.com/terms). The Software and related documentation are provided “AS IS” and without any warranty of any kind. Desmos Bezier Renderer is not responsible for any User application or modification that constitutes a breach in terms. User acknowledges and agrees that the use of the Software is at the User's sole risk. The developer kindly asks Users to not use Desmos Bezier Renderer to enter into Desmos Math Art competitions, for the purpose of maintaining fairness and integrity.

                                      Agree (y/n)? y
-----------------------------
Processing 513 frames... Please wait for processing to finish before running on frontend

--> Processing complete in 4.5 seconds

		===========================================================================
		|| GO CHECK OUT YOUR RENDER NOW AT:					 ||
		||			http://127.0.0.1:5000/calculator		 ||
		===========================================================================

=== SERVER LOG (Ignore if not dev) ===
 * Serving Flask app 'backend'
 * Debug mode: off
WARNING: This is a development server. Do not use it in a production deployment. Use a production WSGI server instead.
 * Running on http://127.0.0.1:5000
Press CTRL+C to quit

Load http://127.0.0.1:5000/calculator into a web browser and put f=1 into the first formula in the formula window. The image should start rendering or the video should start playing at a slow rate.

Copyright

©Copyright Junferno 2021-2023. This program is licensed under the GNU General Public License. Please provide proper credit to the author (Junferno) in any public media that uses this software. Desmos Bezier Renderer is in no way, shape, or form endorsed by or associated with Desmos, Inc.

EULA

By using Desmos Bezier Renderer, you agree to comply to the [Desmos Terms of Service](https://www.desmos.com/terms). The Software and related documentation are provided “AS IS” and without any warranty of any kind. Desmos Bezier Renderer is not responsible for any User application or modification that constitutes a breach in terms. User acknowledges and agrees that the use of the Software is at the User's sole risk. The developer kindly asks Users to not use Desmos Bezier Renderer to enter into Desmos Math Art competitions, for the purpose of maintaining fairness and integrity.

More Repositories

1

bad-apple

Code from my Bad Apple!! YouTube videos
ASP.NET
826
star
2

css-video

Converts images and video frames to pure CSS + HTML files using Breadth-first Search and Canny Edge Detection with keyframe animations
CSS
179
star
3

Practice-Bot

The all-purpose competitive programming Discord bot! Discord to online judge integration. AtCoder/CodeChef/Codeforces/CSES/DMOJ/Leetcode/Szkopuł/TopCoder/WCIPEG
Python
50
star
4

picoCTF-2019-writeup

Solutions and writeups for the picoCTF Cybersecurity Competition held by Carnegie Mellon University
Java
35
star
5

EEG-Cursor-Control

An application for converting real-time synaptic commands using the Emotiv INSIGHT headgear to navigate the cursor on a screen.
Python
33
star
6

Discord3D-Renderer

Renderer for running rudimentary 3D games or renders from Discord using GIFs
C++
23
star
7

DKBongoToKey

A keyboard & mouse interface for the Donkey Kong Bongos DOL-021
C++
21
star
8

kevinjycui

18
star
9

kevinjycui.github.io

Personal website highlighting my qualifications and experience
HTML
14
star
10

CortexPlugin

Cortex Plugin Brain-computer Interface integration for Minecraft with Cortex API
Java
12
star
11

Competitive-Programming

All my AC solutions to competitive programming problems (DMOJ, WCIPEG, Codeforces, etc.), 2017-2020
Java
9
star
12

ICS3U1

All unit assignments from Grade 11 University Introduction to Computer Science elective ICS3U1, perfect scores
Python
8
star
13

kinnieplaylist.net

Personal character playlist organiser web app
JavaScript
8
star
14

VRMPlaybackClient

Capture and playback of VRM motion data in VMC protocol
C#
7
star
15

human-anatomy-model

Model made playing around with Unity's ProBuilder asset; human digestive and respiratory systems
C#
7
star
16

hand-spoken-backend

PennApps XX 2019 Submission, handwritten image to custom font conversion, awarded Top 30
Python
6
star
17

enferi

Electroencephalographic Neuromuscular Facial Expression Recognition Interface (ENFERI)
C++
4
star
18

pac-graph

Applying the Breadth First Search (BFS) algorithm to the classic arcade game "Pacman". Adapted for keyboard or EEG controls.
Python
3
star
19

Dijkstra-Transportation-Network

Automated Transportation Network using a Modified Dijkstra's Algorithm
Java
3
star
20

advent-of-code-2019

Solutions for Advent of Code Programming Contest 2019 Advent Calendar
Python
2
star
21

VSpeakMotion

McGill University COMP 400 Research Project
Jupyter Notebook
2
star
22

KingstonBernard

QHacks 2021 Submission
JavaScript
1
star
23

ICS4U1

All unit assignments from Grade 12 University Computer Science elective ICS4U1, perfect scores
Python
1
star
24

CarpAndCabbage

Hack the North 2020 Submission; 1v1 online multiplayer sabotage game
C++
1
star
25

advent-of-code-2020

Solutions for Advent of Code Programming Contest 2020 Advent Calendar
Go
1
star
26

DialekTech

TOHacks 2020 Submission: The all-comprehensive educational video analyzer.
JavaScript
1
star
27

hello-world

Test repository
Java
1
star
28

Kanri

McHacks 2021 Submission. Your personal project manager chatbot!
Python
1
star