Example #1
0
def main(path):
    image = GrayImage.get_gray_image(path)
    GrayImage.show_image_by_numpy(image)
    image = GrayCode.encode_numpy28(image)
    print(image.shape)
    for i in range(len(image)):
        GrayImage.show_image_by_numpy(image[i])
        cv2.imwrite('./imgs/{}.jpeg'.format(i), image[i])
    image = GrayCode.decode_numpy8(image)
    print(image.shape)
    GrayImage.show_image_by_numpy(image)
Example #2
0
from grayImage import GrayImage

image = GrayImage.get_y_channel_image('./1.jpg')
GrayImage.show_image_by_numpy(image)
Example #3
0
pattern = re.compile(r'(.*)\..*')
datasets_list = os.listdir('{}/dataset'.format(current_path))
keys_list = list()

for datasets_item in datasets_list:
    if datasets_item != 'DIV2K':
        print('start run {}'.format(datasets_item))
        image_list = os.listdir('{}/dataset/{}'.format(current_path,
                                                       datasets_item))
        for image in image_list:
            image_path = '{}/dataset/{}/{}'.format(current_path, datasets_item,
                                                   image)
            info = pattern.findall(image)[0]
            key = '{}_{}'.format(datasets_item, info)
            # image = GrayImage.get_gray_image(image_path)
            image = GrayImage.get_y_channel_image(image_path)
            # GrayImage.show_image_by_numpy(image)
            images = GrayCode.encode_numpy28(image)
            # print(datasets_item, image_list)

            image_path_list = list()

            for idx in range(len(images)):
                # GrayImage.show_image_by_numpy(images[idx])
                filePath = '{}/lmdb_images/{}/{}'.format(
                    current_path, datasets_item, info)
                if not os.path.exists(filePath):
                    os.makedirs(filePath)
                fileName = '{}/{}.png'.format(filePath, idx)
                print(fileName)
                # print(images[idx])
Example #4
0
from grayImage import GrayImage
from grayCode import GrayCode
import time

# 1.2s左右
# image = GrayImage.get_y_channel_image('../dataset/Set5/baby_GT.bmp')
# 这个更慢 12s左右
image = GrayImage.get_y_channel_image(
    '../dataset/DIV2K/DIV2K_train_HR/0001.png')
GrayImage.show_image_by_numpy(image)

# 转成8张格雷码二值图
start_time = time.time()
images = GrayCode.encode_numpy28(image)
end_time = time.time()
print(end_time - start_time)

#
for i in range(8):
    GrayImage.show_image_by_numpy_float(images[i])
Example #5
0
from grayImage import GrayImage
from grayCode import GrayCode
import numpy as np

ge = GrayImage.get_gray_image('./imgs/1.jpeg')
GrayImage.show_image_by_numpy_float(image)
Example #6
0
from grayImage import GrayImage
from grayCode import GrayCode

image = GrayImage.get_gray_image('./imgs/image.jpeg')
# 只转格雷码
GrayImage.show_image_by_numpy(image)
image = GrayCode.encode_numpy(image)
GrayImage.show_image_by_numpy(image)
image = GrayCode.decode_numpy(image)
GrayImage.show_image_by_numpy(image)
# 转成8张格雷码
image = GrayCode.encode_numpy28(image)
print(image)
image = GrayCode.decode_numpy8(image)
GrayImage.show_image_by_numpy(image)