Skip to content

Comments

Task 1#1

Open
franlsym wants to merge 2 commits intomainfrom
task-1
Open

Task 1#1
franlsym wants to merge 2 commits intomainfrom
task-1

Conversation

@franlsym
Copy link
Collaborator

@franlsym franlsym commented Sep 14, 2024

Script:

import cv2  
import numpy as np
import matplotlib.pyplot as plt

# Size of the chessboard
width = 800
height = 800

# Number of squares
n_squares = 8

# Size of the square
square_size = width // n_squares

# Create a single-plane image (white)
chessboard = np.ones((height, width), dtype=np.uint8) * 255

# Draw black squares in even positions: (0,0) (2,0) (4,0) (6,0) (8,0)
for i in range(0, height, square_size):
    for j in range(0, width, square_size):
        if (i // square_size + j // square_size) % 2 == 0:
            chessboard[i:i+square_size, j:j+square_size] = 0

# Show the image
plt.imshow(chessboard, cmap='gray')
plt.axis('off')  # Hide the axes
plt.show()

Resultado:

image

@franlsym franlsym requested a review from DerKom September 14, 2024 15:54
@franlsym franlsym added the enhancement New feature or request label Sep 14, 2024
@franlsym franlsym changed the title Update VC_P1.ipynb with code to generate a chessboard image Task 2 Sep 14, 2024
@gitfrandu4 gitfrandu4 changed the title Task 2 Task 1 Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants