Skip to content

Commit 39df5c5

Browse files
committed
Mise à jour des README.md et README-ENGLISH.md
1 parent df11f35 commit 39df5c5

3 files changed

Lines changed: 163 additions & 53 deletions

File tree

README-ENGLISH.md

Lines changed: 68 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,97 @@
11
- - - -
2-
2+
33
# MATRIX #
4-
5-
Capture your WebCam in real time to an ASCII Art rendering in a Tkinter window, all in Python.
64

7-
- - - -
5+
Capture your WebCam in real time to an ASCII Art renderer in a Qt6 window and to a virtual webcam, all in Python.
6+
7+
Pour la version en français rendez-vous [ici](./README.md)
8+
9+
- - - -
10+
811
## Installation ##
9-
10-
__**Steps needed**__ to install Matrix on your personal computer.
12+
13+
__**Steps required**__ to install Matrix on your personal computer.
14+
1115
* Get Python:
12-
* **On Windows**: go to the official website [python.org](https://www.python.org/).
13-
* **On MacOS** : you can choose between [homebrew](https://brew.sh/) or the official website [python.org](https://www.python.org/).
14-
* **On Linux** : install **Python** via your **packages manager**.
15-
* Attention at the time of the installation only from the official site do not forget to check the box add **the path or the variable Path** and that the use will be **available for all users** of your computer.
16+
17+
* **On Windows**: visit the official website [python.org](https://www.python.org/).
18+
19+
* **On MacOS**: choose between [homebrew](https://brew.sh/index_fr) or the official [python.org](https://www.python.org/) site.
20+
21+
* **On Linux** : install **Python3**(>=3.6) via your **package manager**.
22+
23+
* When installing from the official website only, don't forget to check the box **add path or Path variable** and that usage will be **available to all users** of your computer.
24+
25+
1626

1727
<img src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" data-canonical-src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" width="512" height="288" />
1828

19-
__**And to Finish:**__
29+
30+
31+
__**And finally:**__
32+
33+
2034

2135
* If you haven't already done so: install Git on your computer, more info [here](https://git-scm.com/book/fr/v2/D%C3%A9marrage-rapide-Installation-de-Git)
22-
* Then open a terminal and enter the following commands:
23-
36+
37+
* Then open a terminal and enter the following commands:
38+
2439
```bash
40+
2541
$ git clone https://github.com/Bit-Scripts/Matrix.git
42+
2643
$ cd Matrix
27-
$ pip install -r requirements.txt
44+
45+
pip install -r requirements.txt
46+
2847
```
2948

49+
50+
3051
- - - -
52+
## Configuration ##
53+
54+
* **On Windows**: please follow the instructions to install 'unitycamera' [available here](https://github.com/schellingb/UnityCapture)
55+
* **On Linux** :
56+
1. Install v4l2loopback via your package manager.
57+
- On Ubuntu/Debian: `sudo apt-get install v4l2loopback`
58+
- On Arch: `sudo pacman -S v4l2loopback`
59+
- On Fedora: `sudo dnf install v4l2loopback`
60+
- On openSUSE: `sudo zypper install v4l2loopback`
61+
2. After installation, ensure that the v4l2loopback module is loaded on your system by running the following command:
62+
```bash
63+
$ lsmod | grep v4l2loopback
64+
```
65+
3. Then activate the v4l2loopback module
66+
```bash
67+
$ sudo modprobe v4l2loopback
68+
```
69+
3170
## Usage ##
32-
71+
3372
```bash
34-
$ python ascii12.py #the program starts
73+
74+
$ python ascii17.py #the program launches
75+
3576
```
77+
I advise you to use a venv or anaconda to manage the installation of the necessary packages via pip.
78+
79+
Otherwise, binaries are available for direct download from the project releases.
80+
3681

37-
⚠️⚠️
38-
If the window remains black, look at the file ascii12.py by opening it, with a text editor for example the notepad of Windows and change the line 17 `camera = 1` (the possible values of the variable camera are 0, 1 or 2) (more info line 67 we see there the command with cv2 of OpenCV to capture the WebCam) Indeed, with Python I use the OpenCV library to capture your WebCam, only the Webcam can have the number 0, 1 or 2 (for example 1 for me). If the number of your webcam is not the right one, the script will not work, so you will have to change the value to find the one that matches your hardware.
39-
⚠️⚠️
82+
Here's an example of rendering:
4083
41-
Here is an example of rendering:
42-
4384
<img src="./Matrix.GIF" data-canonical-src="https://cdn.discordapp.com/attachments/1077054466181832724/1077627784656080936/image.png" width="512" height="288" />
4485
86+
87+
4588
- - - -
89+
4690
## To Contribute ##
4791
48-
We welcome contributions from the community! To contribute, please follow these steps:
92+
93+
94+
We welcome contributions from the community! To contribute, please follow the steps below:
4995
5096
* Fork the project
5197
* Create a new branch (git checkout -b feature/feature-name)

README.md

Lines changed: 81 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,63 +1,115 @@
1+
12
- - - -
2-
3+
34
# MATRIX #
4-
5-
Capture de votre WebCam en temps réel vers un rendu ASCII Art dans une fenêtre Tkinter, le tout en Python.
6-
5+
6+
Capture de votre WebCam en temps réel vers un rendu ASCII Art dans une fenêtre Qt6 et vers une webcam virtuelle, le tout en Python.
7+
78
For English version go to [here](./README-ENGLISH.md)
8-
9-
- - - -
9+
10+
- - - -
11+
1012
## Installation ##
11-
12-
__**Étapes nécessaires**__ pour installer Matrix sur votre ordinateur personnel.
13+
14+
__**Étapes nécessaires**__ pour installer Matrix sur votre ordinateur personnel.
15+
1316
* Procurez-vous Python :
14-
* **Sur Windows** : rendez-vous sur le site officiel [python.org](https://www.python.org/).
15-
* **Sur MacOS** : vous avez le choix entre [homebrew](https://brew.sh/index_fr) ou le site officiel [python.org](https://www.python.org/).
16-
* **Sur Linux** : installez **Python** via votre **gestionnaire de paquets**.
17-
* Attention au moment de l'installation uniquement depuis le site officiel n'oubliez pas de bien cocher la case ajouter **le chemin d'accès ou la variable Path** et que l'utilisation sera **disponible pour tous les utilisateurs** de votre ordinateur.
1817

19-
<img src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" data-canonical-src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" width="512" height="288" />
18+
* **Sur Windows** : rendez-vous sur le site officiel [python.org](https://www.python.org/).
19+
20+
* **Sur MacOS** : vous avez le choix entre [homebrew](https://brew.sh/index_fr) ou le site officiel [python.org](https://www.python.org/).
21+
22+
* **Sur Linux** : installez **Python3**(>=3.6) via votre **gestionnaire de paquets**.
23+
24+
* Attention au moment de l'installation uniquement depuis le site officiel n'oubliez pas de bien cocher la case ajouter **le chemin d'accès ou la variable Path** et que l'utilisation sera **disponible pour tous les utilisateurs** de votre ordinateur.
25+
26+
27+
28+
<img src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" data-canonical-src="https://linuxhint.com/wp-content/uploads/2022/09/How-to-Add-Python-to-Windows-Path-3.png" width="512" height="288" />
29+
30+
2031

2132
__**Et pour Finir :**__
2233

34+
35+
2336
* Si cela n'est pas encore fait : installez Git sur votre ordinateur, plus d'info [ici](https://git-scm.com/book/fr/v2/D%C3%A9marrage-rapide-Installation-de-Git)
24-
* Ensuite ouvrez un terminal et entrez les commandes suivantes :
25-
37+
38+
* Ensuite ouvrez un terminal et entrez les commandes suivantes :
39+
2640
```bash
27-
$ git clone https://github.com/Bit-Scripts/Matrix.git
28-
$ cd Matrix
29-
$ pip install -r requirements.txt
41+
42+
$ git clone https://github.com/Bit-Scripts/Matrix.git
43+
44+
$ cd Matrix
45+
46+
$ pip install -r requirements.txt
47+
3048
```
3149

50+
51+
3252
- - - -
53+
## Configuration ##
54+
55+
* **Sur Windows** : je vous invite à suivre les instrutions pour installer 'unitycamera' [disponible ici.](https://github.com/schellingb/UnityCapture)
56+
* **Sur Linux** :
57+
1. Installez v4l2loopback via votre gestionnaire de paquets.
58+
- Sur Ubuntu/Debian : `sudo apt-get install v4l2loopback`
59+
- Sur Arch : `sudo pacman -S v4l2loopback`
60+
- Sur Fedora : `sudo dnf install v4l2loopback`
61+
- Sur openSUSE : `sudo zypper install v4l2loopback`
62+
2. Après l'installation, assurez-vous que le module v4l2loopback est chargé sur votre système en exécutant la commande suivante :
63+
```bash
64+
$ lsmod | grep v4l2loopback
65+
```
66+
3. Ensuite activé le module v4l2loopback
67+
```bash
68+
$ sudo modprobe v4l2loopback
69+
```
70+
3371
## Utilisation ##
34-
72+
3573
```bash
36-
$ python ascii12.py #le programme se lance
74+
75+
$ python ascii17.py #le programme se lance
76+
3777
```
78+
Je vous conseil de passé par un venv ou anaconda pour gérer l'installation des paquets nécessaires via pip.
3879
39-
⚠️⚠️
40-
Si la fenêtre reste noire, regardez le fichier ascii12.py en l'ouvrant, avec un éditeur de texte par exemple le bloc-notes de Windows et changer la ligne 17 `camera = 1` (les valeurs possibles de la variable camera sont 0, 1 ou 2) (plus d'info ligne 67 on y voit la commande avec cv2 d'OpenCV pour capturer la WebCam). En effet, avec Python j'utilise la bibliothèque OpenCV pour capturer votre WebCam, seulement les Webcam peuvent avoir le numéro 0, 1 ou 2 (par exemple 1 pour moi). Si le numéro de votre webcam n'est pas le bon cela va engendrer une imposibilité au script de fonctionner, du coup il vous faudra changer la valeur pour trouver celle qui corespond à votre matériel.
41-
⚠️⚠️
80+
Sinon des binaires sont disponibles directement à télécharger sur les releases du projet.
81+
4282
4383
Voici un exemple de rendu :
44-
45-
<img src="./Matrix.GIF" data-canonical-src="https://cdn.discordapp.com/attachments/1077054466181832724/1077627784656080936/image.png" width="512" height="288" />
84+
85+
<img src="./Matrix.GIF" data-canonical-src="https://cdn.discordapp.com/attachments/1077054466181832724/1077627784656080936/image.png" width="512" height="288" />
86+
87+
4688
4789
- - - -
90+
4891
## Pour Contribuer ##
4992
93+
94+
5095
Nous sommes ravis de recevoir des contributions de la communauté ! Pour contribuer, veuillez suivre les étapes suivantes :
5196
97+
98+
5299
* Forker le projet
100+
53101
* Créer une nouvelle branche (git checkout -b feature/nom-de-la-fonctionnalité)
102+
54103
* Commiter vos modifications (git commit -am 'Ajout d'une nouvelle fonctionnalité')
104+
55105
* Pousser la branche (git push origin feature/nom-de-la-fonctionnalité)
106+
56107
* Créer une pull request
57108

58-
- - - -
59-
## Licence ##
60109

61-
Ce projet est sous licence GPL V3 - voir le fichier [LICENSE](./LICENSE.md) pour plus de détails.
62110

63-
- - - -
111+
- - - -
112+
113+
## Licence ##
114+
115+
Ce projet est sous licence GPL V3 - voir le fichier [LICENSE](./LICENSE.md) pour plus de détails.

ascii17.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,14 +197,15 @@ def __init__(self):
197197
def run(self):
198198
global running, init_global
199199
running = True
200+
self.video_device = self.find_virtual_cameras_on_linux()
200201
if init_global:
201202
print("entre dans create_virtual_camera()\n")
202203
if sys.platform.startswith("linux"):
203204
while running:
204205
try:
205206
virtual_frame = self.virtual_frame
206207
virtual_frame_resized = self.resize_image(virtual_frame, 1280, 720)
207-
with pyvirtualcam.Camera(width=1280, height=720, fps=30, device='/dev/video4') as cam:
208+
with pyvirtualcam.Camera(width=1280, height=720, fps=30, device=f"{self.video_device}") as cam:
208209
if not running:
209210
break
210211
cam.send(virtual_frame_resized)
@@ -230,7 +231,18 @@ def run(self):
230231
def resize_image(self, image, width, height):
231232
resized_image = cv2.resize(image, (width, height))
232233
return resized_image
233-
234+
235+
def find_virtual_cameras_on_linux(self):
236+
import pyudev
237+
context = pyudev.Context()
238+
devices = context.list_devices(subsystem='video4linux')
239+
video_device = ""
240+
for device in devices:
241+
product_id = device.get('ID_V4L_PRODUCT')
242+
if product_id == 'Dummy video device (0x0000)':
243+
video_device = device.device_node
244+
return video_device
245+
234246
def update_frame(self, virtual_frame):
235247
self.virtual_frame = virtual_frame
236248
self.old_frame = self.virtual_frame

0 commit comments

Comments
 (0)