face_merge_master icon indicating copy to clipboard operation
face_merge_master copied to clipboard

关于项目的问题和解决方法

Open tonyiweb opened this issue 6 years ago • 8 comments

face_merge_master这个项目其实并不完善,还有很多地方需要改进和迭代,大家有什么问题和改进建议,欢迎在这个issue下留言。

tonyiweb avatar Feb 14 '19 07:02 tonyiweb

Hi~tonyiweb 我用项目自带的两张图跑效果,输入为这样可以正常运行 --src_image images/model.jpg --dst_image images/smallgirl.jpg
把两张图调换一下,则会报异常?不太懂哈,望指教 --src_image images/smallgirl.jpg --dst_image images/model.jpg

File "/mnt/vdb1/workspace/face_merge_master-master/core/morpher.py", line 200, in face_merge src_img = tran_src(src_img, src_points, dst_points,face_area) File "/mnt/vdb1/workspace/face_merge_master-master/core/morpher.py", line 106, in tran_src dt = core.measure_triangle(src_img, dst_list) File "/mnt/vdb1/workspace/face_merge_master-master/core/triangulation.py", line 30, in measure_triangle sub_div.insert(p) cv2.error: OpenCV(4.0.0) /io/opencv/modules/imgproc/src/subdivision2d.cpp:288: error: (-211:One of arguments' values is out of range) in function 'locate'

crikee avatar Feb 28 '19 11:02 crikee

原因是在运行一次之后会把这里的dst_image删除掉。为什么要这样做呢,是因为,要融合的这个图片下载过多之后会占用本地内存,所以在完成融合操作之后会删除掉这张图片。 # 生成不同融合度的图片 # images.append(url) output_image = merge_one(src_img,dst_img, 1,dst_matrix, dst_points) self.write({"imageUrl": output_image}) tempImage = str(dst_img) if os.path.exists(tempImage): # 删除文件 os.remove(tempImage)

所以你在运行第二次的时候,其实是没有smallgirl.jpg这张图片的。补上这张图片就可以。 为避免后面出现这种情况,可以去掉最后删除dst_image这个过程。

tonyiweb avatar Mar 02 '19 09:03 tonyiweb

另一个原因是用model.jpg这张图片去做morph的时候会出现图片色彩位不对的问题,暂时无法修改。

tonyiweb avatar Mar 02 '19 09:03 tonyiweb

Hi, tonyiweb 我用项目的测试图合成后,结果图上出现了一个黑块,不知道怎么才能去掉它?如下图: out

zuzige avatar May 28 '19 09:05 zuzige

将model换成了 image 就出错了

doufufang avatar Sep 28 '19 07:09 doufufang

File "F:\python3\lib\site-packages\tornado\web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "run.py", line 97, in get output_image = merge_one(src_img,dst_img, 1,dst_matrix, dst_points) File "run.py", line 63, in merge_one mat_multiple=0.9, dst_matrix=dst_matrix, dst_points=dst_points) File "E:\renlian\face_merge_master\core\morpher.py", line 199, in face_merge src_img = tran_src(src_img, src_points, dst_points,face_area) File "E:\renlian\face_merge_master\core\morpher.py", line 105, in tran_src dt = core.measure_triangle(src_img, dst_list) File "E:\renlian\face_merge_master\core\triangulation.py", line 30, in measure_triangle sub_div.insert(p) cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\imgproc\src\subdivision2d.cpp:288: error: (-211:One of the arguments' values is out of range) in function 'cv::Subdiv2D::locate'

是不是model换了就要重新改参数,怎么改啊,谢谢

doufufang avatar Sep 28 '19 07:09 doufufang

File "F:\python3\lib\site-packages\tornado\web.py", line 1697, in _execute result = method(*self.path_args, **self.path_kwargs) File "run.py", line 97, in get output_image = merge_one(src_img,dst_img, 1,dst_matrix, dst_points) File "run.py", line 63, in merge_one mat_multiple=0.9, dst_matrix=dst_matrix, dst_points=dst_points) File "E:\renlian\face_merge_master\core\morpher.py", line 199, in face_merge src_img = tran_src(src_img, src_points, dst_points,face_area) File "E:\renlian\face_merge_master\core\morpher.py", line 105, in tran_src dt = core.measure_triangle(src_img, dst_list) File "E:\renlian\face_merge_master\core\triangulation.py", line 30, in measure_triangle sub_div.insert(p) cv2.error: OpenCV(4.1.1) C:\projects\opencv-python\opencv\modules\imgproc\src\subdivision2d.cpp:288: error: (-211:One of the arguments' values is out of range) in function 'cv::Subdiv2D::locate'

是不是model换了就要重新改参数,怎么改啊,谢谢

You need to change the coordinates of the template face area.

DylanMaeng avatar Nov 05 '19 11:11 DylanMaeng

请问黑色色块的问题应该要怎么解决,我发现你的展示图片好像没有黑色色块问题

jo-dean avatar Jul 05 '21 07:07 jo-dean