Skip to content
Snippets Groups Projects
Commit 3f043504 authored by s183897's avatar s183897 :ice_skate:
Browse files

Added a few comments

parent 2134b5c5
No related branches found
No related tags found
No related merge requests found
# -*- coding: utf-8 -*-
# K-means Text Color Chooser: Main
import pygame
import os
import numpy as np
......@@ -46,7 +48,9 @@ points = np.reshape(np.array([randint(0,255), randint(0,255), randint(0,255)]),
white = np.reshape(np.array([randint(0,255), randint(0,255), randint(0,255)]), (-1, 3))
black = np.reshape(np.array([randint(0,255), randint(0,255), randint(0,255)]), (-1, 3))
# ////////////////////////////////////////////////////////////
# write on screen
# ////////////////////////////////////////////////////////////
def text(msg,color,font,x,y):
screen_text = font.render(msg, True, color)
display.blit(screen_text, [x, y])
......@@ -157,8 +161,10 @@ while True:
for n in range(1,len(black)):
ax.scatter(black[n,0],black[n,1],black[n,2], color = "black")
ax.scatter(color[0], color[1], color[2], color = "blue")
# display clusters
ax.scatter(whitecluster[:, 0], whitecluster[:, 1], whitecluster[:, 2], marker='*', c='white', s=500)
ax.scatter(blackcluster[:, 0], blackcluster[:, 1], blackcluster[:, 2], marker='*', c='black', s=500)
# axis labels
ax.set_xlabel('R', fontsize=15)
ax.set_ylabel('G', fontsize=15)
ax.set_zlabel('B', fontsize=15)
......
# -*- coding: utf-8 -*-
# Nearest Neighbor Text Color Chooser: Main
import pygame
import os
import time
......@@ -46,7 +48,9 @@ points = np.array([[1000000,1000000,1000000]])
white = np.array([[1000000,1000000,1000000]])
black = np.array([[1000000,1000000,1000000]])
# ////////////////////////////////////////////////////////////
# write on screen
# ////////////////////////////////////////////////////////////
def text(msg,color,font,x,y):
screen_text = font.render(msg, True, color)
display.blit(screen_text, [x, y])
......@@ -155,6 +159,7 @@ while True:
for n in range(1,len(black)):
ax.scatter(black[n,0],black[n,1],black[n,2], color = "black")
ax.scatter(color[0], color[1], color[2], color = "blue")
# axis labels
ax.set_xlabel('R', fontsize=15)
ax.set_ylabel('G', fontsize=15)
ax.set_zlabel('B', fontsize=15)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment