Avatar
🏃
achat android animaux anticor apple arnaque association biot bluesky bricolage canoe canyoning ccesoir chateau choisir-velo cinema citation citroen-c8 commission configuration consomacteur course courses courses-dobstacles cuisine cv-pro dawarich debian dell depannage dev docker don dsi désinformation economie facebook fedora firewall football garmin gohugo gravel hebergement home-assistant hugo humhub inondation internets iphone-ipad jeux justice kali linux livre loisirs mac marathon mastodon mecanique misere momes-dazur musee-loisirs nice-matin non-classe oracle padel petition peugeot-206 peugeot-307 peugeot-406 photos php politique postgresql pro proxmox randonnee randonnée raspberry redhat redis republique-numerique reseaux-sociaux sante-internets sante-loisirs securite-internets self-hosted ski ski de randonnée sortir soutien spam sport-biot-2 sports stockage theatre trail twitter/x twitter/x ubuntu velo velo-biot velo-sur-biot via-ferrata ville villes visites voyage vtt windows wordpress wordpress-fr xbox élections municipales 0189xxxxxx 10-km 10-miles 10km 12-km 140 2014 2kv 307 406 406-hdi 920 920xt 930 935 abus acpi actif azur adb adhesion adsl agay age air aix-en-provence alcatel allianz allianz-riviera alpe-dhuez alpes-maritimes alpilles alternateur amap amazon amp anaconda analyse analytics android animaux anote anthea anthea-fr antibes anticor antutu apache2 apn apple applepi-baker april arcep arfi arnaque aroooo aseb-am asics association assurantprotection.fr asterisk asus asus-zenfone atos atsemtex audit auron authentique-fr autoroute avis awesome-note awk awox baignade balade balade-fr barcelonnette barnier base-de-donnee bash basket-ball belt benchmark bento bentomedia betrail biellette bigreen bilan bilan professionnel bilan sportif bilan-fr bio biot biot-fr biot-vernir bitdefender bkl-l09 blacklist blender blockchain-fr blog blogger-com bluesky bonifacio bormes-les-mimosas bot brague braun breil-sur-roya brew bricolage brm brm200 bruxelles bueil bug c cadolive cagnes-sur-mer caille caisse-depargne calanques calencon calendrier camargue cannes cannes-fr canoe cantabrie canyon canyoning cap-dantibes cardio carlit carnaval-de-nice carnaval-de-nice-fr carros carroz casa castellane castellar cat catamaran caussols ccbot ccc cdisplay ceinture cevennes chamonix chateau chaussures cheiron choisir velo cinema circuit cisco citation citrix classement claudebot clignotant cloud cloud-act cloud-personnel cnews codegouv col connecté col de greoliere col-connecte col-de-la-madone col-de-turini colmars competition compression configuration connect consomacteur conspiracy watch convergence-azureenne coreos coronarivus coronavirus corse courmes course course-a-pied course-dobstacle course-dobstacles course-dorientation course-fr coursegoules courses-2 covid covid-19 cozy-cloud cozytouch cpu critique cross cuda cuenod curl cursor dansup dark-web data dataforseo dawarich dawarich.app day-journal debian decathlon decodex deletefacebook dell dello-sciliar-catinaccio delphi demi-yasso derby-de-la-meije developpement developper-tools-access diag diario diaro diaspora digikam digiposte distribution docker docteur-gsm-com dolceacqua dolomites domolites domotique don dourgne dsi duranus débats désinformation ecologie economie education el-capitan elasticsearch elk elm327 email endurain enphase ensol entreprises entretien epidemie escape-game escarene escroquerie espagne estrosi europe eurovelo evasion-fiscale evolution-a-faire exiftool export eze f-f-a facebook facture facture-deau-fr fakenews falicon fan fayence fedora fenix 7 ffa ffmpeg filebeat fillion fillon film-bon film-moyen filtre-a-gazole filtre-pollen fire firewall fittrackee folder foodwatch footing for forerunner forerunner-935 forerunner-945 forerunner-955 forgejo framasoft framasphere france culture france-3 france-soir fraude fraude-fiscale free free-mobile freebox frejus funchal gafams gaillac garageband garmin garmin-connect gavarnie gcc gelas geodes gilette git github glance gmail goaccess gohugo google google-analytic google-analytics google-search-console gopro gorbio gotify goudurix gouffre gourdon gourdon-fr gptbot gpx grafana grasse gravel graxx greoliere greolieres greolieres-les-neiges grub gréolières gtest guillon hadopi haproxy hautpoul hebergement high-trail-vanoise hintertux hipay hipay-com historique-des-dons holdup home-assistant homeassistant hommage honeywell honor hop howto htv huawei hugo huile-direction-assiste humhub ia ibm iconservicesagent ie ign ilonse imagento imageoptim imagneto immich imovie import impots indent injecteur inondation insee insta360 installation internet intimidation ipad ipad-argus iphone iphoto iptables isola-2000 issue italie itra itunes j2s jaime-courir java javascript jeedom jenkins jetpack jeux jeux-de-sophia jeux-de-sophia-antipolis joplin joseph journey jpegoptim juns jupyter justice kali karer-pass kayak kernel kibana kies-app kilometre-vertical kisskissbankbank kiwix klaxon kodi kokopelli korben la-brague la-capelette la-grave-de-peille la-poste la-quadrature-du-net la-vie lac-de-vens langage lantosque lapeyre laquadrature latemar lateral lautrec lcd le-monde leon les-cammazes les-visiteurs-du-soir let's encrypt lets-encrypt levens libreoffice libvirt lightmd linux liste livebox livre logement logiciel logstash loi-numerique lombricomposteur luberon lulu mac mac-os macjournal macos macos-high-sierra madere malade malware mamp mandelieu maps marathon marche mariadb markdown marseille mastodon matomo matomo-analytics matosdon matrix mazamet mcafee mecanique mediapart meduses meije meltdown memo menuiserie mercantour merci-michel mermaid meta metricbeat microsoft-teams migration misere mkdocs module mogrify mojave monsanto montagne-noire montagne-noire-fr montauroux motionpro mougins moulinet mouton msf mud-day mud-day-fr munin mysql mytf1 mytf1-fr mywellness myzone naiad naiad2020 natation natation-libre nature nautipolis neige netamo netatmo nextcloud nginx nice nice-fr nice-matin notes nsinvalidargumentexception ntfs nuxit nvidia objective-see obsolescence-programmee obstacle occ occasion odbii ok-google ollama olvid onedrive oopad open open-data open-sky open-source open-source-experience opencv opendata opensky opensky-a-valbonne opio oracle-linux orange origine-cycles orsiere osm france osmc oss-paris osx osxp osxp2024 osxp2025 outlook owncloud pac paca padel panorama panoramique paradisdiscount-com parc-du-paradou parc-naturel-dello-sciliar-catinaccio paris pascal paul paypal pdf peillon peinture petition peugeot peugeot-307 phare photo photon photos photovoltaique php phpnet phpnet-org pichauris pigeon pinterest pip piscine planning play-store plongee plu plugin pluviometrie pneu politique pollution polylang postfix postgresql ppri prejuges preparation print prix programmation prom-classic prometheus provence proxmox pssh publicite purge pyrenees python python3 qnap quartier qwant raid rameur-dinterieur rancheros randonnee randonnee-2 randonnees randonnée raspberry recette recette-fr redbysfr redhat redis redmi reparartion reparation reseau-sociaux resideo rest-api resultat reunion revue-de-presse rgpd rimplas rock64 root roquebilliere roubion rouret row rsyslog rt-france rubitrack rue89 saint-amancet-fr saint-avit saint-fereol saint-jeannet saint-vallier-de-thiey saintetic salade-nicoise-fr salle-serveur salon samsung san-remo sante sauter scop sd-card securite security.txt sed selection self-hosted semaine-de-la-critique semi semi-marathon semi-marathon-fr sentier seranon server-git serveur service-public siagne sidobre sierra signal sip ski ski de randonnée ski-de-randonnee skred skype slack smart-home smartphone smsc snap sommets sondage sondage-en-ligne sophia-antipolis soreze soreze-fr sortie-en-famille sospel soual spam spartan spartan-race spartan-race-fr spartian spectre sport sql sqlite ssd stable-diffusion stade station-meteo statistique statistiques stockage strava suisse suivi summary surf svn swap swarm syslog systemd tanneron tapform tarif tarn tarn-fr taxes telerama television temp temperature template templier tende tennis tennis-de-table tensorflow test testeur tests textwrangler theatre theoule-sur-mer thorenc thunderbird thunderbirds tignes tor tour-des-sangliers tour-du-sanglier tourisme tourrettes-sur-loup trail trail-de-la-vesubie transposh transvesubienne trashbusters travail travaux trial trifecta turbie tux tuxedo tuxedo-computer tuya twitter tyrol ubaye ubuntu ufc-que-choisir ultra uniq unknown unroot update urbain urban-trail urbanbiker utcam utelle utmb vae valbonne valeo vallee-des-merveilles valloire vallon-des-horts valmasque var vaucluse vaultwarden vauplane vegay velo velotaf vence ventoux veolia verdon vesubie vidange video villeneuve-loubet vim virtual-box virtualbox virus vma vmware vol voyage vpn vps vtc vtt wanderer wannacry webalizer wget whatsapp wifi wikimedia-foundation wikipedia wiko windows wine woocommerce wordfence wordpress x xbmc xbox yahoo-mail yolo zenfone zenpad zigbee
  • Le plus longs c’est de fixer les problèmes Python …

    findfont: Font family 'Helvetica' not found.

    Ensuite quelques lignes de code :

    import pandas as pd
    import calplot
    import pylab
    from matplotlib import rcParams
    
    df_tem = pd.read_csv('./VeloResume2020-2024-v4.csv', delimiter=";")
    df_tem2 = df_tem.groupby([df_tem['date'].dt.date,'activity'])['km'].sum().reset_index().rename(columns={'sum':'km'})
    df_tem2 = df_tem2.query('activity=="E-Biking"'
    fig = calplot.calplot(df_tem2['km'],
                    cmap="BuGn",
                    fillcolor="w",
                    linecolor="w",
                    suptitle_kws=csfont,
                    yearlabel_kws={'fontname':'sans-serif'},
                    fig_kws=dict(facecolor="w"),
                    subplot_kws=dict(facecolor="w"),
                    edgecolor="grey")
    pylab.savefig('E-Biking.png')
    python Created Mon, 09 Dec 2024 00:00:00 +0000
  • Sur Kali OS j’ai eu cette erreur :

    
    Bad key text.parse_math in file /usr/share/matplotlib/mpl-data/matplotlibrc, line 303 ('text.parse_math: False # Use mathtext if there is an even number of unescaped')
    You probably need to get an updated matplotlibrc file from
    https://github.com/matplotlib/matplotlib/blob/v3.5.2/matplotlibrc.template
    or from the matplotlib source distribution
    Traceback (most recent call last):
    File "....Test.py", line 31, in <module>
    import gradio as gr
    File "/usr/local/lib/python3.11/dist-packages/gradio/__init__.py", line 3, in <module>
    import gradio._simple_templates
    File "/usr/local/lib/python3.11/dist-packages/gradio/_simple_templates/__init__.py", line 1, in <module>
    from .simpledropdown import SimpleDropdown
    File "/usr/local/lib/python3.11/dist-packages/gradio/_simple_templates/simpledropdown.py", line 6, in <module>
    from gradio.components.base import FormComponent
    File "/usr/local/lib/python3.11/dist-packages/gradio/components/__init__.py", line 1, in <module>
    from gradio.components.annotated_image import AnnotatedImage
    File "/usr/local/lib/python3.11/dist-packages/gradio/components/annotated_image.py", line 11, in <module>
    from gradio import processing_utils, utils
    File "/usr/local/lib/python3.11/dist-packages/gradio/processing_utils.py", line 23, in <module>
    from gradio.utils import abspath
    File "/usr/local/lib/python3.11/dist-packages/gradio/utils.py", line 38, in <module>
    import matplotlib
    File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 880, in <module>
    rcParamsDefault = _rc_params_in_file(
    ^^^^^^^^^^^^^^^^^^^
    File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 814, in _rc_params_in_file
    config[key] = val # try to convert to proper type or raise
    ~~~~~~^^^^^
    File "/usr/lib/python3/dist-packages/matplotlib/__init__.py", line 650, in __setitem__
    raise ValueError(f"Key {key}: {ve}") from None
    ValueError: Key grid.color: '"' does not look like a color arg

    J’ai donc edité le fichier /usr/share/matplotlib/mpl-data/matplotlibrc pour mettre en commentaire la ligne ( sachant que False ou True on a la même erreur) :

    python Created Sat, 09 Dec 2023 00:00:00 +0000
  • Etape 1 : Installation : https://pypi.org/project/gopro-overlay/

    $ python3 -m venv venv
    $ venv/bin/pip install gopro-overlay
    $ mkdir ~/.gopro-graphics/
    $ cat ~/.gopro-graphics/ffmpeg-profiles.json
    {
      "overlay": {
        "input": [],
        "output": ["-vcodec", "png"]
      }
    }

    Etape 2 : Premier test et premier drame

    $ venv/bin/gopro-dashboard.py --use-gpx-only --gpx Nextcloud/Pipe/Video/BoucleResideo.gpx 1920x1080 Nextcloud/Pipe/Video/BoucleResideo.mov 
    Starting gopro-dashboard version 0.100.0
    ffmpeg version is 4.4.2-0ubuntu0.22.04.1
    Using Python version 3.10.6 (main, May 29 2023, 11:10:38) [GCC 11.3.0]
    Traceback (most recent call last):
      File "/home/arias/venv/bin/gopro-dashboard.py", line 107, in 
        font = load_font(args.font)
      File "/home/arias/venv/lib/python3.10/site-packages/gopro_overlay/font.py", line 5, in load_font
        return ImageFont.truetype(font=font, size=size)
      File "/home/arias/venv/lib/python3.10/site-packages/PIL/ImageFont.py", line 1008, in truetype
        return freetype(font)
      File "/home/arias/venv/lib/python3.10/site-packages/PIL/ImageFont.py", line 1005, in freetype
        return FreeTypeFont(font, size, index, encoding, layout_engine)
      File "/home/arias/venv/lib/python3.10/site-packages/PIL/ImageFont.py", line 255, in __init__
        self.font = core.getfont(
    OSError: cannot open resource

    Etape 2b : Avec copie de la “font”

    python Created Thu, 06 Jul 2023 00:00:00 +0000
  • J’ai fait un petit programme pour faire des PNG à l’aide d’un fichier CSV. Le but est de mettre des balises sur Google Picture.

    Voici un exemple de fichier CSV :

    $ cat list.csv 
    Nom,Année,Mois,Jours,Lieux,Pays
    Deplacement sur Paris,2018,11,01,Paris,France
    Deplacement sur Londres,2011,11,01,London,UK

    Voici le programme :

    from PIL import Image, ImageDraw, ImageFont
    import piexif
    from datetime import datetime
    import csv
    from geopy.geocoders import Nominatim
    from GPSPhoto import gpsphoto
    
    geolocator = Nominatim(user_agent="Your_Name")
    
    with open('list.csv') as csv_file:
        csv_reader = csv.reader(csv_file, delimiter=',')
        line_count = 0
        for row in csv_reader:
            if line_count == 0:
                line_count += 1
            else:
                name = '%s \n Le %d/%d/%d \n a %s,%s . :' % (str(row[0]),int(row[1]),int(row[2]),int(row[3]),str(row[4]),str(row[5]))
                print('\t %s ' % name)
                line_count += 1
                filename = 'image-%d.jpg' % (line_count)
    
                img = Image.new('RGB', (1024, 800), color = (73, 109, 137))
    
                d = ImageDraw.Draw(img)
                fontsize = 80 
                font = ImageFont.truetype('/usr/share/fonts/truetype/msttcorefonts/Arial.ttf', fontsize)
                d.text((10,10), name, font=font)
                img.save(filename)
    
                exif_dict = piexif.load(filename)
                new_date = datetime(int(row[1]), int(row[2]), int(row[3]), 0, 0, 0).strftime("%Y:%m:%d %H:%M:%S")
                exif_dict['0th'][piexif.ImageIFD.DateTime] = new_date
                exif_dict['Exif'][piexif.ExifIFD.DateTimeOriginal] = new_date
                exif_dict['Exif'][piexif.ExifIFD.DateTimeDigitized] = new_date
                exif_bytes = piexif.dump(exif_dict)
                piexif.insert(exif_bytes, filename)
                address= '%s,%s' % (row[4], row[5])
                location = geolocator.geocode(address)
                print('\t\t %f %f %d' % (location.latitude, location.longitude, location.altitude))
                photo = gpsphoto.GPSPhoto(filename)
                info = gpsphoto.GPSInfo((location.latitude, location.longitude), alt=int(location.altitude), timeStamp=new_date)
                photo.modGPSData(info, filename)
    
        print('Processed %d lines.' % line_count)

    Pour qu’il fonctionne il faut avoir installé :

    python Created Mon, 22 Feb 2021 00:00:00 +0000
  • Je me suis fait des doublons de fichiers dans mes photos, heureusement Python c’est simple et convivial :

    import os
    import sys
    import re
    import PIL
    from PIL import Image
    
    walk_dir = "./Nextcloud/Photos/"
    
    print('walk_dir = ' + walk_dir)
    print('walk_dir (absolute) = ' + os.path.abspath(walk_dir))
    
    for root, subdirs, files in os.walk(walk_dir):
        list_file_path = os.path.join(root, 'my-directory-check.txt')
        print('list_file_path = ' + list_file_path)
        with open(list_file_path, 'wb') as list_file:
            #for subdir in subdirs:
            #   print('\t- subdirectory ' + subdir)
            for filename in files:
                file_path = os.path.join(root, filename)
                # print('\t- file %s (full path: %s)' % (filename, file_path))
                base = os.path.splitext(filename)[0]
                if (base.endswith('_1')):
                        #print('\t- Doublon probable %s %s (full path: %s)' % (filename, base, file_path))
                        double = re.sub('_1$', '', base)
                        double = double + '.jpg'
                        double2 = re.sub('_1$', '', base)
                        double2 = double2 + '.JPG'
                        file_path_double = os.path.join(root, double)
                        file_path_double2 = os.path.join(root, double2)
                        if os.path.isfile(file_path_double):
                            #print('\t- Doublon OK %s & %s' % (file_path, file_path_double))
                            img1 = PIL.Image.open(file_path)
                            img2 = PIL.Image.open(file_path_double)
                            wid1, hgt1 = img1.size 
                            wid2, hgt2 = img2.size 
                            if (wid1 == wid2) and (hgt1 == hgt2):
                                #print('Meme resolution')
                                size1 = os.path.getsize(file_path)
                                size2 = os.path.getsize(file_path_double)
                                if (size1 > size2):
                                        print("%s > %s" % (file_path, file_path_double));
                                        os.remove(file_path_double);
                                else:
                                        print("%s < %s" % (file_path, file_path_double));
                                        os.remove(file_path);
                        elif os.path.isfile(file_path_double2):
                            img1 = PIL.Image.open(file_path)
                            img2 = PIL.Image.open(file_path_double2)
                            wid1, hgt1 = img1.size
                            wid2, hgt2 = img2.size
                            if (wid1 == wid2) and (hgt1 == hgt2):
                                #print('Meme resolution')
                                size1 = os.path.getsize(file_path)
                                size2 = os.path.getsize(file_path_double2)
                                if (size1 > size2):
                                        print("%s > %s" % (file_path, file_path_double2));
                                        os.remove(file_path_double2);
                                else:
                                        print("%s < %s" % (file_path, file_path_double2));
                                        os.remove(file_path);

    Ensuite pour faire un clean des fichiers txt :

    for print Created Mon, 08 Feb 2021 00:00:00 +0000
  • J’ai enfin mon process complet, pour compter les cyclistes et flouter les visages dans la vidéo :

    Etape 1 : Faire la vidéo avec la GoPRO.

    • Le résultat est un MP4.
    • La taille : 91 Mo
    Metadata:
    major_brand : mp42
    minor_version : 0
    compatible_brands: mp42isomavc1
    creation_time : 2020-10-04T13:52:54.000000Z
    encoder : HandBrake 0.9.8 2012071800
    Duration: 00:01:51.44, start: 0.000000, bitrate: 6813 kb/s
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 6810 kb/s, 23.98 fps, 23.98 tbr, 90k tbn, 180k tbc (default)
    Metadata:
    creation_time : 2020-10-04T13:52:54.000000Z
    encoder : JVT/AVC Coding

    Etape 2 : Passer Jupyter Notebook, Python3, Tensorflow, OpenCV.

    Created Mon, 12 Oct 2020 00:00:00 +0000
  • J’ai téléchargé https://github.com/hay/facetool afin de faire la modification des visages via une commande du type :

    ./facetool.py swap -i smiley.jpg -t output-bicyle.mp4 -o swap-bicyle.mp4

    D’abord j’ai eu un premier problème que j’ai fixé ainsi : cd /usr/lib/python3/dist-packages sudo cp apt_pkg.cpython-36m-x86_64-linux-gnu.so apt_pkg.so

    Et maintenant j’ai un bug dans le programme :

    No faces found, could not swap (Faceswapping smiley.jpg on head-tmp-jdrmcn3j/2357.jpg, saving to out-tmp-jdrmcn3j/2357.jpg)
    100%|███████████████████████████████████████████████████████████████████▉| 2671/2672 [25:15<00:00, 2.30it/s]
    No faces found, could not swap (Faceswapping smiley.jpg on head-tmp-jdrmcn3j/1180.jpg, saving to out-tmp-jdrmcn3j/1180.jpg)
    Traceback (most recent call last):
    File "./facetool.py", line 591, in <module>
    main(args)
    File "./facetool.py", line 565, in main
    swapper.swap_image_to_video(args.target, args.input, args.output)
    File "./github/facetool/facetool/swapper.py", line 206, in swap_image_to_video
    combineframes(self.tempdirs.out, out)
    File "./github/facetool/facetool/media.py", line 49, in combineframes
    first_file = list(glob(f"{inp}/*"))[0]
    IndexError: list index out of range

    Bref j’ai l’impression que cela ne détecte aucun visage :

    Created Mon, 12 Oct 2020 00:00:00 +0000