fork download
  1. import numpy as np
  2. import pandas as pd
  3. import matplotlib.pyplot as plt
  4.  
  5. top_left = cv2.imread('top_left.jpg')
  6. top_left = cv2.cvtColor(top_left,cv2.COLOR_BGR2RGB)
  7. top_left = cv2.resize(top_left,(200,200))
  8.  
  9. top_right = cv2.imread('top_right.jpg')
  10. top_right = cv2.cvtColor(top_right,cv2.COLOR_BGR2RGB)
  11. top_right = cv2.resize(top_right,(200,200))
  12.  
  13. bottom_left = cv2.imread('bottom_left.jpg')
  14. bottom_left = cv2.cvtColor(bottom_left,cv2.COLOR_BGR2RGB)
  15. bottom_left = cv2.resize(bottom_left,(200,200))
  16.  
  17. bottom_right = cv2.imread('bottom_right.jpg')
  18. bottom_right = cv2.cvtColor(bottom_right,cv2.COLOR_BGR2RGB)
  19. bottom_right = cv2.resize(bottom_right,(200,200))
  20.  
  21. center = cv2.imread('center.jpeg')
  22. center = cv2.cvtColor(center,cv2.COLOR_BGR2RGB)
  23. center = cv2.resize(center,(100,100))
  24. center = cv2.copyMakeBorder(center,10,10,10,10,cv2.BORDER_CONSTANT)
  25.  
  26. image = np.zeros((430,430,3),dtype="int")
  27. image[10:210,10:210] = top_left
  28. image[10:210,220:420] = top_right
  29. image[220:420,10:210] = bottom_left
  30. image[220:420,220:420] = bottom_right
  31. image[155:275,155:275] = center
  32.  
  33. x = np.array(image)
  34. df = pd.DataFrame(x.reshape(-1,3))
  35. y = df.rename(columns={0:'r',1:'g',2:'b'})
  36. y.to_csv('b.csv',index=False)
Runtime error #stdin #stdout #stderr 1.03s 96600KB
stdin
Standard input is empty
stdout
Standard output is empty
stderr
Unable to init server: Could not connect: Connection refused
Unable to init server: Could not connect: Connection refused

(prog:20977): Gdk-CRITICAL **: 12:25:32.157: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed

(prog:20977): Gdk-CRITICAL **: 12:25:32.168: gdk_cursor_new_for_display: assertion 'GDK_IS_DISPLAY (display)' failed
Traceback (most recent call last):
  File "./prog.py", line 5, in <module>
NameError: name 'cv2' is not defined