2023-11-21

ChatGPTに犬の絵を描いてもらった

彼の中で犬と言う存在がどのように抽象化されているのか伺えて

なかなかおもちろいわね

import matplotlib.pyplot as plt
import numpy as np
# Correcting the inversion of the y-axis to ensure the dog is drawn in the correct orientation.

def draw_dog_correct_orientation():
    # Points for the dog's head
    head_top = np.array([[0.3, 0.55], [0.35, 0.45], [0.45, 0.42], [0.55, 0.42], [0.65, 0.45], [0.7, 0.55]])
    head_bottom = np.array([[0.7, 0.6], [0.68, 0.65], [0.5, 0.7], [0.32, 0.65], [0.3, 0.6], [0.3, 0.55]])

    # Points for the dog's body
    body_top = np.array([[0.5, 0.7], [0.5, 0.75], [0.7, 0.8], [0.72, 0.85], [0.74, 0.9]])
    body_bottom = np.array([[0.74, 0.9], [0.7, 0.95], [0.4, 0.95], [0.36, 0.9], [0.34, 0.85], [0.36, 0.8], [0.5, 0.75]])

    # Points for the dog's tail
    tail = np.array([[0.34, 0.85], [0.2, 0.9]])

    # Points for the dog's ears
    right_ear = np.array([[0.65, 0.45], [0.78, 0.42], [0.78, 0.38], [0.65, 0.35]])
    left_ear = np.array([[0.35, 0.45], [0.22, 0.42], [0.22, 0.38], [0.35, 0.35]])

    # Create a new figure
    plt.figure(figsize=(6.4, 4.8))  # 640x480 pixels

    # Draw the dog's head
    plt.plot(np.append(head_top[:, 0], head_bottom[:, 0]), np.append(head_top[:, 1], head_bottom[:, 1]), 'k-', linewidth=1)  # Head

    # Draw the dog's body
    plt.plot(body_top[:, 0], body_top[:, 1], 'k-', linewidth=1)  # Body top
    plt.plot(body_bottom[:, 0], body_bottom[:, 1], 'k-', linewidth=1)  # Body bottom

    # Draw the dog's tail
    plt.plot(tail[:, 0], tail[:, 1], 'k-', linewidth=1)  # Tail

    # Draw the dog's ears
    plt.plot(right_ear[:, 0], right_ear[:, 1], 'k-', linewidth=1)  # Right ear
    plt.plot(left_ear[:, 0], left_ear[:, 1], 'k-', linewidth=1)  # Left ear

    # Draw the eyes
    plt.plot([0.45, 0.45], [0.53, 0.53], 'ko')  # Left eye
    plt.plot([0.55, 0.55], [0.53, 0.53], 'ko')  # Right eye

    # Draw the nose
    plt.plot([0.5, 0.5], [0.6, 0.6], 'ko')  # Nose

    # Configure the plot
    plt.axis('off')  # No axis
    plt.xlim(0, 1)
    plt.ylim(1, 0)  # Correct the orientation by flipping the y-axis

    # Show the plot
    plt.show()

draw_dog_correct_orientation()

記事への反応(ブックマークコメント)

ログイン ユーザー登録
ようこそ ゲスト さん