MCPcopy Create free account
hub / github.com/geekcomputers/Python / generateColors

Function generateColors

Colors/pixel_sort.py:45–57  ·  view source on GitHub ↗
(c_sorted, frame, row)

Source from the content-addressed store, hash-verified

43
44# Generating colors for each row of the frame
45def generateColors(c_sorted, frame, row):
46 global df, img_list
47 height = 15
48 img = np.zeros((height, len(c_sorted), 3), np.uint8)
49 for x in range(0, len(c_sorted)):
50 r, g, b = c_sorted[x][0] * 255, c_sorted[x][1] * 255, c_sorted[x][2] * 255
51 c = [r, g, b]
52 df.append(c)
53 img[:, x] = c # the color value for the xth column , this gives the color band
54 frame[row, x] = c # changes added for every row in the frame
55
56 createDataSet(data=df)
57 return img, frame
58
59
60# Measures the total number of pixels that were involved in pixel sort

Callers 1

mainFunction · 0.85

Calls 2

createDataSetFunction · 0.85
appendMethod · 0.45

Tested by

no test coverage detected