from matplotlib import pyplot as plt
import cv2 as cv2
import numpy as np
img = cv2.imread("1.png")
img = cv2.resize(img,(64,64))
print(img)
r = img[:,:,2]
g = img[:,:,1]
b = img[:,:,0]
rgb = np.dstack((r, g, b))
rgb_flat = rgb.reshape((rgb.shape[0]*rgb.shape[1], 3))
def rgb_to_hex(rgb):
return '#{:02x}{:02x}{:02x}'.format(*rgb)
cCodes = np.apply_along_axis(rgb_to_hex, 1, rgb_flat)
# print(cCodes)
fig = plt.figure()
ax = fig.add_subplot(1, 1, 1, projection='3d')
ax.scatter(b, g, r, c=cCodes,alpha=1)
plt.show()
let sheets = document.styleSheets
let sheet = sheets[sheets.length - 1];
let codeElements = document.querySelectorAll("code");
for (let i = 0; i < codeElements.length; i++) {
let codeElement = codeElements[i]
codeElement.parentElement.classList.add("pre" + i)
// <div class="language-shell highlighter-rouge">
// <div class="highlight">
// <pre class="highlight">
// <code>
// から「python」を抽出
clsName = codeElement
.parentElement
.parentElement
.parentElement
.className
langName = codeElement
.parentElement
.parentElement
.parentElement
.className
.match(/language-(\S+)\s/)[1]
sheet.insertRule(
`.pre${i}:before { content: "${langName}";}`,
sheet.cssRules.length);
}
require 'redcarpet'
markdown = Redcarpet.new("Hello World!")
puts markdown.to_html