Skip to content

Commit

Permalink
improve to remain aspect ratio from src img
Browse files Browse the repository at this point in the history
  • Loading branch information
taizan committed Feb 5, 2017
1 parent 1a1d5bd commit e240af8
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cgi-bin/paint_x2_unet/img2imgDataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,19 @@ def get_example(self, i, minimize=False, blur=0, s_size=128):
s0 = s_size
s1 = int(image1.shape[1] * (s_size / image1.shape[0]))
s1 = s1 - s1 % 16
_s0 = 4 * s0
_s1 = int(image1.shape[1] * (s0 / image1.shape[0]))
_s1 = (_s1+8) - (s1+8) % 16
else:
s1 = s_size
s0 = int(image1.shape[0] * (s_size / image1.shape[1]))
s0 = s0 - s0 % 16
_s1 = 4 * s1
_s0 = int(image1.shape[0] * ( s1 / image1.shape[1]))
_s0 = (_s0+8) - (s0+8) % 16

_image1 = image1.copy()
_image1 = cv2.resize(_image1, (4 * s1, 4 * s0),
_image1 = cv2.resize(_image1, (_s1, _s0),
interpolation=cv2.INTER_AREA)
#noise = np.random.normal(0,5*np.random.rand(),_image1.shape).astype(self._dtype)

Expand Down

0 comments on commit e240af8

Please sign in to comment.