Recherche avancée

Médias (0)

Mot : - Tags -/xmlrpc

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (80)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (9809)

  • FFMPEG Video Merging Not Works for Quality Videos taken from mobile phones

    8 février 2023, par Govardhan Bollu

    I have used below commond for merging video

    


    ffmpeg -f concat -safe 0 -i input.txt -copy out.mp4

    


    but not working for some videos specially camera video's

    


    ffmpeg -f concat -safe 0 -i input.txt -copy out.mp4
#input.txt - contains input1.mp4,input2.mp4

    


    Can above commond will works for all video's

    


  • lzo : Handle integer overflow

    19 juin 2014, par Luca Barbato
    lzo : Handle integer overflow
    

    get_len can overflow for specially crafted payload.

    Reported-By : Don A. Baley <donb@securitymouse.com>
    CC : libav-stable@libav.org

    • [DH] libavutil/lzo.c
  • Recoloring an image

    4 août 2023, par caffeinemachine

    I want to recolor a png image (which has handwritten text using a tablet) in a desired way (based on some dictionary [See color_dict in the code below] which dictates which color should be replaced by which ones).

    &#xA;

    It was easy to write a code which would ask the color of each pixel and recolor the pixel according to the dictionary.

    &#xA;

    But the output image ended up being pixelated (that, is, the text has jagged boundaries).

    &#xA;

    Upon some googling I found that if one changes the colors using a linear function based on the RGB values then jaggedness can be avoided.

    &#xA;

    A linear function ended up being inadequate for my purpose.

    &#xA;

    So I resorted to using a quadratic function based on RGB values (one degree 2 polynomial in three variables for each color channel) as given in the following code.

    &#xA;

    &#xA;

    The problem is that it takes about 7 seconds to process one image, which is too high for my purpose.

    &#xA;

    &#xA;

    Even with multiprocessing the run time is high for my needs (which is to recolor a video, I tried the geq filter in ffmpeg but that also led to jaggedness in the output, even when inverting colors).

    &#xA;

    Is there some other way to recolor the image (with the recipe of recoloring the same) ?

    &#xA;

    Is there an advantage in using non-command line tools for this purpose ?

    &#xA;

    from PIL import Image&#xA;import numpy as np&#xA;&#xA;&#xA;def return_row(r, g, b):&#xA;    r_inv = 255 - r&#xA;    g_inv = 255 - g&#xA;    b_inv = 255 - b&#xA;    return [r_inv**2, g_inv**2, b_inv**2, r_inv * g_inv, g_inv * b_inv, b_inv * r_inv, r_inv, g_inv, b_inv]&#xA;&#xA;&#xA;def solve_mat(dictionary):&#xA;    A = []&#xA;    B = []&#xA;    for key, color_code in dictionary.items():&#xA;        r = color_code[0]&#xA;        g = color_code[1]&#xA;        b = color_code[2]&#xA;        value = color_code[3]&#xA;        row = return_row(r, g, b)&#xA;        A.append(row)&#xA;        B.append(value)&#xA;&#xA;    X = np.linalg.lstsq(A, B, rcond=None)[0]&#xA;    return X&#xA;&#xA;&#xA;def get_individual_channgel_dict(color_change_dict):&#xA;    r_dict = {}&#xA;    g_dict = {}&#xA;    b_dict = {}&#xA;    for color, array in color_change_dict.items():&#xA;        r_dict[color] = array[:3]&#xA;        r_dict[color].append(array[3])&#xA;&#xA;        g_dict[color] = array[:3]&#xA;        g_dict[color].append(array[4])&#xA;&#xA;        b_dict[color] = array[:3]&#xA;        b_dict[color].append(array[5])&#xA;&#xA;    return r_dict, g_dict, b_dict&#xA;&#xA;&#xA;def get_coeff_mat(r_dict, g_dict, b_dict):&#xA;    r_mat = solve_mat(r_dict)&#xA;    g_mat = solve_mat(g_dict)&#xA;    b_mat = solve_mat(b_dict)&#xA;&#xA;    return r_mat, g_mat, b_mat&#xA;&#xA;&#xA;def rgb_out(R, G, B, param_mat):&#xA;    a = param_mat[0]&#xA;    b = param_mat[1]&#xA;    c = param_mat[2]&#xA;    d = param_mat[3]&#xA;    e = param_mat[4]&#xA;    f = param_mat[5]&#xA;    g = param_mat[6]&#xA;    h = param_mat[7]&#xA;    i = param_mat[8]&#xA;&#xA;    return int((a * (R**2)) &#x2B; (b * (G**2)) &#x2B; (c * (B**2)) &#x2B; (d * R * G) &#x2B; (e * G * B) &#x2B; (f * B * R) &#x2B; (g * R) &#x2B; (h * G) &#x2B; (i * B))&#xA;&#xA;&#xA;def change_colors_in_one_image(image_path):&#xA;    with Image.open(image_path) as img:&#xA;        pixels = img.load()&#xA;&#xA;        # Iterate over each pixel&#xA;        width, height = img.size&#xA;&#xA;        for x in range(width):&#xA;&#xA;            for y in range(height):&#xA;                r, g, b = pixels[x, y]&#xA;&#xA;                new_r = rgb_out(r, g, b, r_mat)&#xA;&#xA;                new_g = rgb_out(r, g, b, g_mat)&#xA;&#xA;                new_b = rgb_out(r, g, b, b_mat)&#xA;&#xA;                pixels[x, y] = (new_r, new_g, new_b)&#xA;&#xA;        # Save the modified image&#xA;        img.save(image_path)&#xA;&#xA;color_change_dict = {&#xA;    "white": [5, 98, 255, 240, 240, 240],&#xA;    "black": [255, 255, 255, 81, 92, 93],&#xA;    "red": [207, 54, 108, 52, 152, 219],&#xA;    "mud": [203, 103, 14, 203, 103, 14],&#xA;}&#xA;&#xA;r_dict, g_dict, b_dict = get_individual_channgel_dict(color_change_dict)&#xA;r_mat, g_mat, b_mat = get_coeff_mat(r_dict, g_dict, b_dict)&#xA;change_colors_in_one_image(imge_path)&#xA;

    &#xA;

    As an example, following is an input image.&#xA;enter image description here&#xA;Following is the output after recoloring.&#xA;enter image description here

    &#xA;