コード例 #1
0
    def __getitem__(self, index):

        img1 = Image.open(self.__left[index])
        params = get_params(self.opt, img1.size)

        img1 = Image.open(self.__left[index]).convert('RGB')
        img2 = Image.open(self.__right[index]).convert('RGB')

        arg = random.random() > 0.5
        if arg:
            img1, img2 = self.augument_image_pair(img1, img2)

        # img1.show()
        # img2.show()
        transform = get_transform(self.opt, params)
        # imgp = transform(img1)
        # imgq = transform(img2)
        # imgp.show()
        # imgq.show()

        img1 = transform(img1)
        img2 = transform(img2)

        input_dict = {'left_img': img1.cuda(), 'right_img': img2.cuda()}

        return input_dict
コード例 #2
0
    def __getitem__(self, index):
        stereo_img = Image.open(self.__stereo[index]).convert('RGB')
        s = stereo_img.size
        img1 = stereo_img.crop((0, 0, s[0] / 2, s[1]))
        params = get_params(self.opt, img1.size)

        # img2 = Image.open(self.__right[index]).convert('RGB')

        transform = get_transform(self.opt, params)
        img1 = transform(img1)
        # img2 = transform(img2)

        # print('size(img1),size(img1)')
        # print(np.array(img1).shape,np.array(img1).shape)

        # img1 = torch.from_numpy(np.asarray(img1))
        # img2 = torch.from_numpy(np.asarray(img2))

        # print('type(img1),type(img1)')
        # print(type(img1),type(img1))

        # img1 = self.transforms(img1)
        # img2 = self.transforms(img2)

        input_dict = {'test_img': img1.cuda()}

        return input_dict
コード例 #3
0
    def __getitem__(self, index):
        stereo_img = Image.open(self.__stereo[index]).convert('RGB')
        s = stereo_img.size
        img1 = stereo_img.crop((0, 0, s[0] / 2, s[1]))
        img2 = stereo_img.crop((0, 0, s[0] / 2, s[1]))

        params = get_params(self.opt, img1.size)

        arg = random.random() > 0.5
        if arg:
            img1, img2 = self.augument_image_pair(img1, img2)

        transform = get_transform(self.opt, params)
        img1 = transform(img1)
        img2 = transform(img2)

        input_dict = {'left_img': img1.cuda(), 'right_img': img2.cuda()}

        return input_dict