Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuelimza committed Aug 6, 2018
1 parent 2585a77 commit a9fd247
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions backend/file1.py
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import numpy as np
import cv2
f=open('path.txt','r')
f=open('backend/path.txt','r')
path=f.read()
img=cv2.imread(path+'\compressed.png',0)
centroids_index=np.array(img)
a,b=np.shape(centroids_index)
centroids_index=np.reshape(centroids_index,[a*b,1],2)
centroids=np.load('codebook.npy')
centroids=np.load(path+'\codebook.npy')
m=a*b
X_pix=np.zeros((m,3))
for i in range(0,m):
X_pix[i,:]=centroids[centroids_index[i,0],:]
X_pix=np.reshape(X_pix,[a,b,3],3)
cv2.imwrite(path+'\compressed1.png',X_pix)
cv2.imwrite(path+'\compressed1.png',X_pix)

0 comments on commit a9fd247

Please sign in to comment.