import cv2
import os
import numpy as np
import matplotlib.pyplot as plt
import pandas as pd
import image
#centre_image = cv2.imread(‘ImageCollage dataset/center.jpg’)
centre_img = cv2.imread(‘ImageCollage dataset/center.jpg’)
color = [0, 0, 0] # 'cause purple!
border widths; I set them all to 10
top, bottom, left, right = [10]*4
img_with_border = cv2.copyMakeBorder(centre_img, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color)
img_name = os.listdir(“ImageCollage dataset”)
poke = []
for f in img_name:
if (f.endswith(".jpg")):
print(f)
file_path = "ImageCollage dataset/" + f
img = cv2.imread(file_path)
img = cv2.cvtColor(img,cv2.COLOR_BGR2RGB)
img = cv2.resize(img,(200,200))
poke.append(img)
#make collage
#border_h = np.zeros((10,400,3),dtype=‘uint8’)
#border_v = np.zeros((210,10,3),dtype=‘uint8’)
poke_01 = np.hstack((poke[0],poke[1]))
poke_34 = np.hstack((poke[3],poke[4]))
collage = np.vstack((poke_34,poke_01))
#color = [101, 52, 152] # 'cause purple!
color = [0, 0, 0]
border widths; I set them all to 10
top, bottom, left, right = [10]*4
collagewithborder = cv2.copyMakeBorder(collage, top, bottom, left, right, cv2.BORDER_CONSTANT, value=color)
#collage[150:250,150:250,:] = centre_image[:,:,:]
#plt.imshow(collagewithborder)
#plt.show()
#plt.imshow(poke_01)
#plt.imshow(collage)
#total_pixel = img_with_border.shape[0]*img_with_border.shape[1]
#print(total_pixel)
#print(img_with_border.shape)
img_with_border = cv2.resize(img_with_border,(100,100))
#plt.imshow(centre_img)
#plt.axis(‘off’)
#plt.show()
collagewithborder[160:260,160:260,:]=img_with_border[:,:,:]
plt.imshow(collagewithborder)
plt.show()
collagewithborder = collagewithborder.reshape((-1,3))
pd.DataFrame(collagewithborder).to_csv(“submission.csv”, index = False)
the above code is showing error after submission