Skip to content

Commit

Permalink
dress up success
Browse files Browse the repository at this point in the history
  • Loading branch information
RyosukeSuzukii committed Jan 1, 2022
1 parent f07123e commit 944a5ad
Show file tree
Hide file tree
Showing 184 changed files with 607,631 additions and 257 deletions.
Binary file modified .DS_Store
Binary file not shown.
Binary file modified db/postgres/base/13757/1247
Binary file not shown.
Binary file modified db/postgres/base/13757/1249
Binary file not shown.
Binary file modified db/postgres/base/13757/1249_fsm
Binary file not shown.
Binary file modified db/postgres/base/13757/1259
Binary file not shown.
Binary file modified db/postgres/base/13757/1259_fsm
Binary file not shown.
Binary file modified db/postgres/base/13757/16384
Binary file not shown.
Binary file modified db/postgres/base/13757/16385
Binary file not shown.
Binary file modified db/postgres/base/13757/16391
Binary file not shown.
Binary file modified db/postgres/base/13757/16393
Binary file not shown.
Binary file modified db/postgres/base/13757/16394
Binary file not shown.
Binary file modified db/postgres/base/13757/16398
Binary file not shown.
Binary file modified db/postgres/base/13757/16400
Binary file not shown.
Binary file removed db/postgres/base/13757/16642
Binary file not shown.
Binary file removed db/postgres/base/13757/16662
Binary file not shown.
Binary file added db/postgres/base/13757/16666
Binary file not shown.
Binary file added db/postgres/base/13757/16666_fsm
Binary file not shown.
Binary file not shown.
Binary file added db/postgres/base/13757/16669
Binary file not shown.
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file added db/postgres/base/13757/16702
Binary file not shown.
Binary file added db/postgres/base/13757/16703
Binary file not shown.
File renamed without changes.
Binary file not shown.
Binary file not shown.
Binary file modified db/postgres/base/13757/2224
Binary file not shown.
Binary file modified db/postgres/base/13757/2579
Binary file not shown.
Binary file modified db/postgres/base/13757/2604
Binary file not shown.
Binary file modified db/postgres/base/13757/2606
Binary file not shown.
Binary file modified db/postgres/base/13757/2606_fsm
Binary file not shown.
Binary file modified db/postgres/base/13757/2608
Binary file not shown.
Binary file modified db/postgres/base/13757/2610
Binary file not shown.
Binary file modified db/postgres/base/13757/2619
Binary file not shown.
Binary file modified db/postgres/base/13757/2619_fsm
Binary file not shown.
Binary file modified db/postgres/base/13757/2620
Binary file not shown.
Binary file modified db/postgres/base/13757/2656
Binary file not shown.
Binary file modified db/postgres/base/13757/2657
Binary file not shown.
Binary file modified db/postgres/base/13757/2658
Binary file not shown.
Binary file modified db/postgres/base/13757/2659
Binary file not shown.
Binary file modified db/postgres/base/13757/2662
Binary file not shown.
Binary file modified db/postgres/base/13757/2663
Binary file not shown.
Binary file modified db/postgres/base/13757/2664
Binary file not shown.
Binary file modified db/postgres/base/13757/2665
Binary file not shown.
Binary file modified db/postgres/base/13757/2666
Binary file not shown.
Binary file modified db/postgres/base/13757/2667
Binary file not shown.
Binary file modified db/postgres/base/13757/2673
Binary file not shown.
Binary file modified db/postgres/base/13757/2674
Binary file not shown.
Binary file modified db/postgres/base/13757/2678
Binary file not shown.
Binary file modified db/postgres/base/13757/2679
Binary file not shown.
Binary file modified db/postgres/base/13757/2696
Binary file not shown.
Binary file modified db/postgres/base/13757/2699
Binary file not shown.
Binary file modified db/postgres/base/13757/2701
Binary file not shown.
Binary file modified db/postgres/base/13757/2702
Binary file not shown.
Binary file modified db/postgres/base/13757/2703
Binary file not shown.
Binary file modified db/postgres/base/13757/2704
Binary file not shown.
Binary file modified db/postgres/base/13757/3455
Binary file not shown.
Binary file modified db/postgres/base/13757/5002
Binary file not shown.
Binary file modified db/postgres/base/13757/pg_internal.init
Binary file not shown.
Binary file modified db/postgres/global/pg_control
Binary file not shown.
Binary file modified db/postgres/global/pg_internal.init
Binary file not shown.
Binary file modified db/postgres/pg_stat_tmp/db_0.stat
Binary file not shown.
Binary file modified db/postgres/pg_stat_tmp/db_13757.stat
Binary file not shown.
Binary file modified db/postgres/pg_stat_tmp/global.stat
Binary file not shown.
Binary file modified db/postgres/pg_wal/000000010000000000000001
Binary file not shown.
Binary file modified db/postgres/pg_xact/0000
Binary file not shown.
2 changes: 1 addition & 1 deletion db/postgres/postmaster.pid
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1
/var/lib/postgresql/data
1639828618
1640956858
5432
/var/run/postgresql
*
Expand Down
1,571 changes: 1,571 additions & 0 deletions nginx/log/access.log

Large diffs are not rendered by default.

181 changes: 181 additions & 0 deletions nginx/log/error.log

Large diffs are not rendered by default.

Binary file modified src/DressApp/__pycache__/apps.cpython-37.pyc
Binary file not shown.
Binary file modified src/DressApp/__pycache__/models.cpython-37.pyc
Binary file not shown.
Binary file modified src/DressApp/__pycache__/urls.cpython-37.pyc
Binary file not shown.
Binary file modified src/DressApp/__pycache__/views.cpython-37.pyc
Binary file not shown.
3 changes: 3 additions & 0 deletions src/DressApp/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
class DressappConfig(AppConfig):
default_auto_field = 'django.db.models.BigAutoField'
name = 'DressApp'

def ready(self):
from . import signals
Binary file modified src/DressApp/dress_lib/__pycache__/image_cut.cpython-37.pyc
Binary file not shown.
Binary file not shown.
386 changes: 271 additions & 115 deletions src/DressApp/dress_lib/change_clothes_lib/clothes_on_top.py

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neck": {"right_point":[120,24],"left_point":[238,16],"height":[178,39]},
"right_shoulder": [92,84],
"right_elbow": [36,305],
"right_wrist": [43,487],
"left_shoulder": [367,79],
"left_elbow": [417,280],
"left_wrist": [435,475],
"right_arm": {"right_elbow":[39,210]},
"left_arm": {"left_elbow":[36,266]}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neck": {"right_point":[93,5],"left_point":[208,5],"height":[153,25]},
"right_shoulder": [83,64],
"right_elbow": [45,196],
"right_wrist": [29,291],
"left_shoulder": [280,61],
"left_elbow": [330,198],
"left_wrist": [350,287],
"right_arm": {"right_elbow":[52,162]},
"left_arm": {"left_elbow":[59,182]}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neck": {"right_point":[208,17],"left_point":[367,24],"height":[296,125]},
"right_shoulder": [156,170],
"right_elbow": [78,538],
"right_wrist": [100,881],
"left_shoulder": [662,159],
"left_elbow": [735,558],
"left_wrist": [732,887],
"right_arm": {"right_elbow":[73,563]},
"left_arm": {"left_elbow":[121,500]}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neck": {"right_point":[52,7],"left_point":[90,7],"height":[71,37]},
"right_shoulder": [53,25],
"right_elbow": [19,106],
"right_wrist": [30,182],
"left_shoulder": [140,27],
"left_elbow": [178,108],
"left_wrist": [165,187],
"right_arm": {"right_elbow":[18,109]},
"left_arm": {"left_elbow":[33,108]}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"neck": {"right_point":[44,3],"left_point":[88,3],"height":[66,6]},
"right_shoulder": [60,20],
"right_elbow": [30,106],
"right_wrist": [12,168],
"left_shoulder": [146,21],
"left_elbow": [167,106],
"left_wrist": [186,170],
"right_arm": {"right_elbow":[35,100]},
"left_arm": {"left_elbow":[48,111]}
}
33 changes: 33 additions & 0 deletions src/DressApp/dress_lib/construction.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import cv2
import matplotlib.pyplot as plt

if __name__ == "__main__":
human_segm = cv2.imread("./materials/part_segms/IMG_0138.png",0)
plt.figure(1)
plt.title('Segmentation Mask')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(human_segm)

skeleton_img = cv2.imread("./images/skeleton_images/IMG_0138.png")
plt.figure(2)
plt.title('skeleton_img')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(cv2.cvtColor(skeleton_img,cv2.COLOR_BGR2RGB))

'''brank_img = cv2.imread("./images/temporary_imgs/brank.png",-1)
plt.figure(3)
plt.title('brank_img')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(cv2.cvtColor(brank_img,cv2.COLOR_BGRA2RGBA))
boding_img = cv2.imread("./images/temporary_imgs/boding.png",0)
plt.figure(4)
plt.title('boding_img')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(boding_img)'''
print("yes")
plt.show()
46 changes: 35 additions & 11 deletions src/DressApp/dress_lib/image_cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,31 @@

import time
import json
import os
import cv2

def image_cut(filename):
start = time.time()
def image_cut(filename,input_img_path,height):
imgProc_start = time.time()
#exif_cut.exifcut_compression_risize("segm")#haikeiを実行するならコメントアウト
#segm.cutting_out()#haikeiを実行するならコメントアウト
dir_path,file_name = exif_cut.exifcut_compression_risize("haikei")#segmを実行するならコメントアウト
blur_img,trimap,image_path = haikei.cutting_out(dir_path,file_name)#segmを実行するならコメントアウト
matte = demo.infer(blur_img,trimap,image_path)
alpha_img_path = cut.cutting(blur_img,matte,file_name)
dir_path,filename = exif_cut.exifcut_compression_risize("haikei",filename,input_img_path)#segmを実行するならコメントアウト
blur_img,trimap,image_path = haikei.cutting_out(dir_path,filename)#segmを実行するならコメントアウト
#trimaps_dir = "./DressApp/dress_lib/images/trimaps/"
#images_dir = "./DressApp/dress_lib/images/images/"
#cv2.imwrite(images_dir+filename,blur_img)#確認保存用
#cv2.imwrite(trimaps_dir+filename,trimap)#確認保存用
matte = demo.infer(blur_img,trimap,filename)
#RESULT_DIR = './DressApp/dress_lib/images/mattes'
#RESULT_DIR = "./DressApp/dress_lib/images/via/"#臨時追加
#Image.fromarray(alpha.astype(np.uint8)).save(os.path.join(RESULT_DIR, filename))#確認保存用
alpha_img = cut.cutting(blur_img,matte,filename)
#cv2.imwrite("./DressApp/dress_lib/images/via/"+filename,alpha_img)#確認保存用

actual_img,human_segm = body_part_segm.segm_run(alpha_img_path,file_name)
candidate = pose_check.pose_esti(actual_img,file_name)
actual_img,human_segm = body_part_segm.segm_run(alpha_img,height)
#outdirPath = "./DressApp/dress_lib/images/part_segm_images/"
#cv2.imwrite(outdirPath+file_name,human_segm)#確認保存用
#cv2.imwrite("./DressApp/dress_lib/images/cut_images/",actualimg)
candidate = pose_check.pose_esti(actual_img,filename)
print(type(candidate))
print(type(candidate[0]))
print(type(candidate[0][0]))
Expand All @@ -32,6 +45,17 @@ def image_cut(filename):
print(candidate_list)
candidate_json = json.dumps(candidate_list)

elapsed_time = time.time() - start
print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
return("elapsed_time:{0}".format(elapsed_time) + "[sec]",actual_img,human_segm,candidate_json)
#os.remove('./DressApp/dress_lib/images/via/'+filename)#処理時に使った経由用の画像を消しておく
imgProc_time = time.time() - imgProc_start
print ("imgProc_time:{0}".format(imgProc_time) + "[sec]")
return(filename,"imgProc_time:{0}".format(imgProc_time) + "[sec]",actual_img,human_segm,candidate_json)

'''if __name__ == "__main__":
import cv2
import matplotlib.pyplot as plt
img = cv2.imread("./materials/part_segms/IMG_0137.png",0)
plt.title('Segmentation Mask')
plt.ylabel('y')
plt.xlabel('x')
plt.imshow(img)
plt.show()'''
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed src/DressApp/dress_lib/images/input_imgs/Hito.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file removed src/DressApp/dress_lib/images/mattes/nusu.png
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Diff not rendered.
Binary file added src/DressApp/dress_lib/images/via/test.png
24 changes: 14 additions & 10 deletions src/DressApp/dress_lib/indexnet_matting/scripts/cut.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,11 @@
import cv2
import matplotlib.pyplot as plt

def cutting(blur_img,matte_img,file_name):
def cutting(blur_img,matte_img,filename):
#画像、マスク(アルファチャンネル)を読み込み、背景を準備します。
#id = 'Hito_risize.jpg'
#id = "bler.png"
#id = "masut.png"
id = 'bler_Hito_risize.png'
result_dir='./DressApp/dress_lib/images/cut_images/'
result_dir="./DressApp/dress_lib/images/via/"#確認保存用
id = 'bler_IMG_0137_risize.png'
#id = 'bler_Hito_risize_risize.png'
#img = cv2.imread('./DressApp/dress_lib/images/images/'+id)
img = blur_img
img = img[...,::-1]
Expand Down Expand Up @@ -52,23 +49,30 @@ def cutting(blur_img,matte_img,file_name):
plt.show()'''
#cv2.imwrite('./DressApp/dress_lib/indexnet_matting/examples/cut_images/rs_'+id,alpha_img)

# 背景削除画像の補正処理 より正確に背景を切り抜く
kernel = np.ones((10,10),np.uint8) #要素が全て1の配列を生成
eroded = cv2.erode(mask,kernel,iterations = 1)
mask[eroded==255] = 0
gray_img = cv2.cvtColor(alpha_img,cv2.COLOR_BGRA2GRAY)
for y in range(h):
for x in range(w):
if mask[y][x]==255 and gray_img[y][x] > 241:
#print("kita")
alpha_img[y][x][3] = 0
plt.imshow(mask,cmap='gray', vmin=0, vmax=255)
plt.show()
plt.title("alpha_img")
plt.imshow(cv2.cvtColor(alpha_img,cv2.COLOR_BGRA2RGBA))
plt.show()
cv2.imwrite('./DressApp/dress_lib/images/cut_images/'+file_name,alpha_img)

return('./DressApp/dress_lib/images/cut_images/'+file_name)
#cv2.imwrite(result_dir+filename,alpha_img)#確認保存用
import tensorflow as tf
img = tf.keras.preprocessing.image.array_to_img(alpha_img, scale=True)
with open("./DressApp/log.txt", mode='a') as f:# python側の処理が見えるようにログファイルに書き込み
f.write("tf.keras.preprocessing.image.array_to_img(alpha_img, scale=True)")
f.write("\n")
f.write(str(img.getpixel((0,0))))
f.write("\n")
#return(result_dir+filename)
return(alpha_img)

if __name__ == "__main__":
cutting()
17 changes: 9 additions & 8 deletions src/DressApp/dress_lib/indexnet_matting/scripts/demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@

STRIDE = 32
RESTORE_FROM = './DressApp/dress_lib/indexnet_matting/pretrained/indexnet_matting.pth.tar'
RESULT_DIR = './DressApp/dress_lib/images/mattes'
#RESULT_DIR = './DressApp/dress_lib/images/mattes'
RESULT_DIR = "./DressApp/dress_lib/images/via/"#臨時追加

device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")

Expand Down Expand Up @@ -85,7 +86,7 @@ def image_alignment(x, output_stride, odd=False):

return new_x

def inference(image_path, image, trimap):
def inference(filename, image, trimap):
with torch.no_grad():
#image, trimap = read_image(image_path), read_image(trimap_path)
trimap = np.expand_dims(trimap, axis=2)
Expand Down Expand Up @@ -120,8 +121,8 @@ def inference(image_path, image, trimap):
mask = np.equal(trimap, 128).astype(np.float32)
alpha = (1 - mask) * trimap + mask * alpha

_, image_name = os.path.split(image_path)
Image.fromarray(alpha.astype(np.uint8)).save(os.path.join(RESULT_DIR, image_name))
#_, image_name = os.path.split(image_path)
#Image.fromarray(alpha.astype(np.uint8)).save(os.path.join(RESULT_DIR, filename))#確認保存用
# Image.fromarray(alpha.astype(np.uint8)).show()

running_frame_rate = 1 * float(1 / (end - start)) # batch_size = 1
Expand All @@ -131,7 +132,7 @@ def inference(image_path, image, trimap):
return(alpha.astype(np.uint8))


def infer(blur_img,trimap_img,img_path):
def infer(blur_img,trimap_img,filename):
image_path = [
#'./examples/images/beach-747750_1280_2.png',
#'./examples/images/boy-1518482_1920_9.png',
Expand Down Expand Up @@ -169,10 +170,10 @@ def infer(blur_img,trimap_img,img_path):
print(1)
imgs = [blur_img]
trimaps = [trimap_img]
image_paths = [img_path]
filenames = [filename]
#for image, trimap in zip(image_path, trimap_path):
for image_path, image, trimap in zip(image_paths, imgs, trimaps):
matte = inference(image_path, image, trimap)
for filename, image, trimap in zip(filenames, imgs, trimaps):
matte = inference(filename, image, trimap)
print("last")
return(matte)

47 changes: 34 additions & 13 deletions src/DressApp/dress_lib/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,30 @@
import cv2
import matplotlib.pyplot as plt
import json
import numpy as np

def image_cut():
start = time.time()
def image_cut(filename,input_img_path,height):
imgProc_start = time.time()
#exif_cut.exifcut_compression_risize("segm")#haikeiを実行するならコメントアウト
#segm.cutting_out()#haikeiを実行するならコメントアウト
dir_path,file_name = exif_cut.exifcut_compression_risize("haikei")#segmを実行するならコメントアウト
blur_img,trimap,image_path = haikei.cutting_out(dir_path,file_name)#segmを実行するならコメントアウト
matte = demo.infer(blur_img,trimap,image_path)
alpha_img_path = cut.cutting(blur_img,matte,file_name)
dir_path,filename = exif_cut.exifcut_compression_risize("haikei",filename,input_img_path)#segmを実行するならコメントアウト
blur_img,trimap,image_path = haikei.cutting_out(dir_path,filename)#segmを実行するならコメントアウト
#trimaps_dir = "./DressApp/dress_lib/images/trimaps/"
#images_dir = "./DressApp/dress_lib/images/images/"
#cv2.imwrite(images_dir+filename,blur_img)#確認保存用
#cv2.imwrite(trimaps_dir+filename,trimap)#確認保存用
matte = demo.infer(blur_img,trimap,filename)
#RESULT_DIR = './DressApp/dress_lib/images/mattes'
#RESULT_DIR = "./DressApp/dress_lib/images/via/"#臨時追加
#Image.fromarray(alpha.astype(np.uint8)).save(os.path.join(RESULT_DIR, filename))#確認保存用
alpha_img = cut.cutting(blur_img,matte,filename)
#cv2.imwrite("./DressApp/dress_lib/images/via/"+filename,alpha_img)#確認保存用

actual_img,human_segm = body_part_segm.segm_run(alpha_img_path,file_name)
candidate = pose_check.pose_esti(actual_img,file_name)
actual_img,human_segm = body_part_segm.segm_run(alpha_img,height)
#outdirPath = "./DressApp/dress_lib/images/part_segm_images/"
#cv2.imwrite(outdirPath+file_name,human_segm)#確認保存用
#cv2.imwrite("./DressApp/dress_lib/images/cut_images/",actualimg)
candidate = pose_check.pose_esti(actual_img,filename)
print(type(candidate))
print(type(candidate[0]))
print(type(candidate[0][0]))
Expand All @@ -41,14 +53,23 @@ def image_cut():
plt.imshow(actual_img)
plt.show()

'''actual_img = cv2.imread("./media/cut_images/IMG_0137.png",-1)
human_segm = cv2.imread("./DressApp/dress_lib/materials/part_segms/IMG_0137.png",0)
with open("./DressApp/dress_lib/materials/skeleton_jsons/IMG_0137.json") as f:
candidate_txt = json.load(f)#strになる
print(type(candidate_txt))
candidate = json.loads(candidate_txt)#listになる
print(type(candidate))
candidate = np.array(candidate)#ndarrayになる
print(type(candidate))'''
result_img = None
part_clothes = 1
clothes_name = "model_0"
if part_clothes == 1:
result_img = clothes_on_top.change(actual_img,human_segm,candidate,clothes_name)
cv2.imwrite("./DressApp/dress_lib/images/result_images/"+file_name,result_img)
result_img,brank_img = clothes_on_top.change(actual_img,human_segm,candidate,clothes_name)
cv2.imwrite("./DressApp/dress_lib/images/result_images/"+filename,result_img)

elapsed_time = time.time() - start
print ("elapsed_time:{0}".format(elapsed_time) + "[sec]")
imgProc_time = time.time() - imgProc_start
print ("imgProc_time:{0}".format(imgProc_time) + "[sec]")

image_cut()
image_cut("IMG_0138.png","./media/human_img/IMG_0138.png",169)
1 change: 1 addition & 0 deletions src/DressApp/dress_lib/materials/skeleton_jsons/test.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"[\"foo\",{\"baz\":[\"baz\",null,1.0,34]}]"
Binary file modified src/DressApp/dress_lib/pytorch_openpose_master/.DS_Store
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def pose_esti(actual_img,file_name):#acutual_img = BGRA
canvas = util.draw_bodypose(canvas, candidate, subset)

result_image_path = OUT_DIR_PATH + file_name
cv2.imwrite(result_image_path, canvas)
cv2.imwrite(result_image_path, canvas)#確認保存用
plt.imshow(cv2.cvtColor(canvas,cv2.COLOR_BGR2RGB))
plt.show()

Expand Down
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 944a5ad

Please sign in to comment.