Comments (4)
Hi,
Line width is 1 pixel in our implementation. With a binary boundary map img_boundary.jpg (where pixels of the boundary line are set to be 255 while others are set to be 0), you can use the code below to get the distance transform results. Then the ground-truth boundary heatmap cen be obtained with Eq.1 in our paper.
`import cv2
import numpy as np
import matplotlib.pyplot as plt
img = cv2.imread('img_boundary.jpg', 0)
dist = cv2.distanceTransform(255-img, cv2.DIST_L2, cv2.DIST_MASK_PRECISE)
plt.figure()
plt.imshow((dist).astype(np.uint8), cmap='gray')
plt.show()`
Best,
Wayne
from lab.
Hi, wywu
Thanks for your reply.
I have modified the code.Here is my code.
import cv2
import numpy as np
import matplotlib.pyplot as plt
from utils import loadFromPts
import skimage.io as io
image = io.imread('/home/xiang/pytorch/testset/common/123.jpg')
ldms = loadFromPts('/home/xiang/pytorch/testset/common/123.pts')
def gauss(x, a, b, c, d=0):
return a * np.exp(-(x - b) ** 2 / (2 * c ** 2)) + d
def color_heatmap(x):
color = np.zeros((x.shape[0],x.shape[1],3))
color[:,:,0] = gauss(x, .5, .6, .2) + gauss(x, 1, .8, .3)
color[:,:,1] = gauss(x, 1, .5, .3)
color[:,:,2] = gauss(x, 1, .2, .3)
color[color > 1] = 1
color = (color * 255).astype(np.uint8)
return color
binary_map = np.zeros([256,256]).astype(np.uint8)
for i in range(15):
binary_map = cv2.line(binary_map,tuple(ldms[i].astype(np.int32)),tuple(ldms[i+1].astype(np.int32)),(255),1)
#plt.imshow(binary_map)
dist = cv2.distanceTransform(255-binary_map, cv2.DIST_L2, cv2.DIST_MASK_PRECISE)
#print(np.max(dist),np.min(dist))
#plt.figure()
##plt.imshow((dist).astype(np.uint8), cmap='gray')
#plt.imshow((dist).astype(np.uint8), cmap='gray')
#plt.show()
dist = dist / (np.max(dist))
heatmap = color_heatmap(dist)
new_img = (image0.7 + heatmap0.3).astype(np.uint8)
plt.imshow(new_img)
I still can not get the result as same as the distance map in your paper. Maybe some difference in the visualization function between yours and mine? The visualization of distance map uploaded to Baidu Drive,https://pan.baidu.com/s/13WxL6yUMIIPUlJZJI4wu2A(since some went wrong with github, i can not upload the distance map to github). Thanks.
from lab.
Hi,
It could be better to discuss the detail problem by e-mail. Please contact me at [email protected]
Best,
Wayne
from lab.
想请教下是怎么生成轮廓线的,直接画多边形吗
from lab.
Related Issues (20)
- 你好,请问Boundary Heatmaps的Truth Heatmap我们是怎么打标得到的,而且打标后有经过什么处理? HOT 1
- Hello, I want to evaluate my own model on WFLW, will you release a concise code for a convenient evaluation?(in python or matlab) HOT 1
- want to know how to interpolate HOT 1
- 请问怎么在opencv使用模型文件? HOT 2
- WFLW Ground Truth landmark coordinates doubts
- comment `#pragma omp parallel for num_threads` in tools/alignment_tools.cpp works for me
- make problem HOT 2
- Model comparision HOT 1
- How to modify the other version caffe to the version needed?
- How to compile in windows? HOT 4
- How to transform landmarks to boundary heatmaps.?
- make problem
- Closing-eye data
- 不能单独跑一张图片吗?没找到示例。
- 关于IPN和ION差距的疑问,IPN和ION的测试是同一个模型吗 HOT 2
- Unknown layer type: Interp HOT 1
- Dataset
- Basel face model embedding HOT 1
- It seemed that there are two wrong annotated images in the dataset annotation
- Licence problem HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lab.