示例#1
0
def remote_result_produce():
    composition = request.files.get('composition')
    sketch_1024 = request.files.get('sketch_1024')
    points = request.json['points']
    result = result_produce(sketch_1024=sketch_1024, points=points, composition=composition)
    cv2.imwrite('result.jpg', result)
    return static_file('result.jpg', root='.')
示例#2
0
def remote_composition_determine():
    baby = request.files.get('baby')
    sketch_256 = request.files.get('sketch_256')
    sketch_1024 = request.files.get('sketch_1024')
    points = request.json['points']
    composition = composition_determine(sketch_256=sketch_256, baby=baby)
    result = result_produce(sketch_1024=sketch_1024, points=points, composition=composition)
    cv2.imwrite('result.jpg', result)
    return static_file('result.jpg', root='.')
示例#3
0
def remote_sketch_norm():
    sketch = request.files.get('sketch')
    sketch.save('sketch_norm.jpg')
    sketch = cv2.imread('sketch_norm.jpg')
    points = points_ping
    sketch_1024, sketch_256, sketch_128 = sketch_norm(sketch=sketch)
    baby = baby_determine(sketch_128=sketch_128, points=points)
    composition = composition_determine(sketch_256=sketch_256, baby=baby)
    result = result_produce(sketch_1024=sketch_1024, points=points, composition=composition)
    cv2.imwrite('result.jpg', result)
    return static_file('result.jpg', root='.')
示例#4
0
def remote_string_to_sketch():
    data = request.json
    image = data['image']
    points = data['points']
    sketch = string_to_sketch(image=image, points=points)
    sketch = sketch_blurry(sketch=sketch)
    std = judge_improve(sketch=sketch)
    if std:
        sketch = continue_improve(sketch=sketch)
    sketch = go_gray(sketch=sketch)
    sketch_1024, sketch_256, sketch_128 = sketch_norm(sketch=sketch)
    baby = baby_determine(sketch_128=sketch_128, points=points)
    composition = composition_determine(sketch_256=sketch_256, baby=baby)
    result = result_produce(sketch_1024=sketch_1024, points=points, composition=composition)
    cv2.imwrite('result.jpg', result)
    return static_file('result.jpg', root='.')
示例#5
0
def remote_baby_determine():
    sketch_128 = request.files.get('sketch_128')
    sketch_256 = request.files.get('sketch_256')
    sketch_1024 = request.files.get('sketch_1024')
    sketch_128.save('sketch_128.jpg')
    sketch_256.save('sketch_256.jpg')
    sketch_1024.save('sketch_1024.jpg')
    sketch_128 = cv2.imread('sketch_128.jpg')
    sketch_256 = cv2.imread('sketch_256.jpg')
    sketch_1024 = cv2.imread('sketch_1024.jpg')
    points = points_ping
    baby = baby_determine(sketch_128=sketch_128, points=points)
    composition = composition_determine(sketch_256=sketch_256, baby=baby)
    result = result_produce(sketch_1024=sketch_1024, points=points, composition=composition)
    cv2.imwrite('result.jpg', result)
    return static_file('result.jpg', root='.')
示例#6
0
time_sign = time.time()
sketch = continue_improve(sketch=sketch)
process_time = time.time() - time_sign
print('图片再次进行模糊去噪操作时间:' + str(process_time))

time_sign = time.time()
sketch = go_gray(sketch=sketch)
process_time = time.time() - time_sign
print('图片进行灰度化处理:' + str(process_time))

time_sign = time.time()
sketch_1024, sketch_256, sketch_128 = sketch_norm(sketch=sketch)
process_time = time.time() - time_sign
print('图片进行归一化处理时间:' + str(process_time))

time_sign = time.time()
baby = baby_determine(sketch_128=sketch_128, points=points)
process_time = time.time() - time_sign
print('baby模型训练生成时间:' + str(process_time))

time_sign = time.time()
composition = composition_determine(sketch_256=sketch_256, baby=baby)
process_time = time.time() - time_sign
print('composition模型训练生成时间:' + str(process_time))

time_sign = time.time()
result = result_produce(sketch_1024=sketch_1024,
                        points=points,
                        composition=composition)
process_time = time.time() - time_sign
print('上色图片生成时间:' + str(process_time))