• =?UTF-8?Q?Opencv_quelqu=E2=80=99un_pour_me_donner_l=E2=80=99info_=3F?=

    From ptilou@21:1/5 to All on Mon Jan 30 14:00:01 2023
    Slt,

    https://www.dropbox.com/scl/fo/peusccr349foy6qqgvxvq/h?dl=0&rlkey=neeo1v54e420pkkyvuhc3jcpy

    Est ce que quelqu’un peut me dire ce que donne ca (sur les fichier dans la dropbox ? :

    from skimage.metrics import structural_similarity
    import cv2
    import numpy as np

    first = cv2.imread('clownfish_1.jpeg')
    second = cv2.imread('clownfish_2.jpeg')

    # Convert images to grayscale
    first_gray = cv2.cvtColor(first, cv2.COLOR_BGR2GRAY)
    second_gray = cv2.cvtColor(second, cv2.COLOR_BGR2GRAY)

    # Compute SSIM between two images
    score, diff = structural_similarity(first_gray, second_gray, full=True) print("Similarity Score: {:.3f}%".format(score * 100))

    # The diff image contains the actual image differences between the two images
    # and is represented as a floating point data type so we must convert the array
    # to 8-bit unsigned integers in the range [0,255] before we can use it with OpenCV
    diff = (diff * 255).astype("uint8")

    # Threshold the difference image, followed by finding contours to
    # obtain the regions that differ between the two images
    thresh = cv2.threshold(diff, 0, 255, cv2.THRESH_BINARY_INV | cv2.THRESH_OTSU)[1]
    contours = cv2.findContours(thresh, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE) contours = contours[0] if len(contours) == 2 else contours[1]

    # Highlight differences
    mask = np.zeros(first.shape, dtype='uint8')
    filled = second.copy()

    for c in contours:
    area = cv2.contourArea(c)
    if area > 100:
    x,y,w,h = cv2.boundingRect(c)
    cv2.rectangle(first, (x, y), (x + w, y + h), (36,255,12), 2)
    cv2.rectangle(second, (x, y), (x + w, y + h), (36,255,12), 2)
    cv2.drawContours(mask, [c], 0, (0,255,0), -1)
    cv2.drawContours(filled, [c], 0, (0,255,0), -1)

    cv2.imshow('first', first)
    cv2.imshow('second', second)
    cv2.imshow('diff', diff)
    cv2.imshow('mask', mask)
    cv2.imshow('filled', filled)
    cv2.waitKey()


    ( je veux faire un script pour me gerer du hdr dans une data base, mais je cherche comment detecter les images similaire, j’ai lance un fil sur gid hup mais je dois pas etre claire il propose une cles de hash par fichier !)

    D’apres MikeRobinson :

    convert -append `counter=0; for x in in-*; do if [[ $(($counter % 2)) == 0 ]]; then echo $x; fi; counter=$((counter + 1)); done` out.jpg

    Pour le script avec imagemagick, y a des script pour assemblee les images d’etoiles ! Mais peut etre quelqu’un connait mieux ?

    Merci


    Ptilou

    --- SoupGate-Win32 v1.05
    * Origin: fsxNet Usenet Gateway (21:1/5)