예제 #1
0
 def test_load_png_file(self):
     'it should return an Image Type if file exists and is an Image file'
     # case 1 (it should return PngImageFile):
     img = load_img(os.path.join(FOLDER, RIGHT_FILENAME))
     self.assertEqual(type(img).__name__, 'PngImageFile')
     # case 2 (it should return NoneType):
     img = load_img(os.path.join(FOLDER, WRONG_FILENAME))
     self.assertEqual(type(img).__name__, 'NoneType')
예제 #2
0
 def test_img_from_dwt_coeff(self):
     'TODO'
     img = load_img(os.path.join(FOLDER, FILENAME))
     coeff = extract_rgb_coeff(img)
     img_new = img_from_dwt_coeff(coeff)
     img_new.save('/home/jiewend/download/a_4component.png')
     return
예제 #3
0
 def test_extract_rgb_coeff(self):
     'it should return a Tuple of coefficient per each channel (RGB)'
     img = load_img(os.path.join(FOLDER, FILENAME))
     (c_r, c_g, c_b) = extract_rgb_coeff(img)
     self.assertTrue(c_r[0] is not None)
     self.assertTrue(c_r[1] is not None)
     self.assertTrue(c_g[0] is not None)
     self.assertTrue(c_g[1] is not None)
     self.assertTrue(c_b[0] is not None)
     self.assertTrue(c_b[1] is not None)
예제 #4
0
    def test_creat_lost_dwt_coef(self):
        img = load_img(os.path.join(FOLDER, FILENAME))
        coeff = extract_rgb_coeff(img)

        coff_lost = creat_lost_LH_HL_HH_dwt_coef(coeff, 1)
        img_new = recontract_img_from_dwt_coef(coff_lost)
        img_new.save('/home/jiewend/download/a_re_lost_LH_HL_HH.png')

        coff_lost = creat_lost_HL_HH_dwt_coef(coeff, 1)
        img_new = recontract_img_from_dwt_coef(coff_lost)
        img_new.save('/home/jiewend/download/a_re_lost_HL_HH.png')

        coff_lost = creat_lost_HH_dwt_coef(coeff, 1)
        img_new = recontract_img_from_dwt_coef(coff_lost)
        img_new.save('/home/jiewend/download/a_re_lost_HH.png')
예제 #5
0
 def _get_image(self, img_path):
     raw_img = load_img(img_path,
                        to_rgb=True,
                        color_img=self.data_conf['color_image'])
     height, width = raw_img.shape[:2]
     if height % 2**self.num_scales != 0 or width % 2**self.num_scales != 0 or self.data_conf[
             'use_crop']:
         crop_size = int(self.data_conf['crop_size']
                         ) if self.data_conf['use_crop'] else min(
                             height, width)
         crop_size = crop_size // 2**self.num_scales * 2**self.num_scales
         raw_img = central_crop(raw_img, crop_size)
     img_name = os.path.basename(img_path)
     save_img(raw_img, os.path.join(self.originals_dir, img_name))
     return raw_img
예제 #6
0
    def test_recontract_img_from_dwt_coef(self):
        img = load_img(os.path.join(FOLDER, FILENAME))
        coeff = extract_rgb_coeff(img)
        coeff_copy = coeff

        img_new = recontract_img_from_dwt_coef(coeff)
예제 #7
0
 def test_yuv_to_rgb(self):
     'it should return an Image Type after conversion'
     img = load_img(os.path.join(FOLDER, FILENAME))
     img_yuv = yuv_to_rgb(img)
     self.assertEqual(type(img_yuv).__name__, 'Image')
예제 #8
0
 def test_img_from_dwt_coeff(self):
     'TODO'
     img = load_img(os.path.join(FOLDER, FILENAME))
     coeff = extract_rgb_coeff(img)
     return
예제 #9
0
def test_img_loader():
    img_list = os.listdir(config.dataset_dir)
    img = utils.load_img(img_list[0], config.resolution)
예제 #10
0
파일: app.py 프로젝트: mdcnn/jp2-python
def run():
    img = util.load_img(os.path.join(FOLDER, RIGHT_FILENAME))