Closed thb1314 closed 5 years ago
我在github里放了matlab的代码,你可以参考下,就三行主要代码,python应该也有对应的实现方法。
发件人:thb1314 notifications@github.com 发送日期:2019-09-17 13:37:50 收件人:JXingZhao/EGNet EGNet@noreply.github.com 抄送人:Subscribed subscribed@noreply.github.com 主题:[JXingZhao/EGNet] 可以提供下生成边缘label的python实现么 (#8) 您好,南开的师兄或老师,您那边可以提供下生成边缘label的python实现么? — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
好的 谢谢您,我给一下我的实验,给其他同学以参考
import cv2
import numpy as np
# In[2]:
img_path = './ILSVRC2012_test_00000018.png'
img_data = cv2.imread(img_path)
img_data = img_data > 128
print(img_data.shape)
# In[3]:
img_data = np.asarray(img_data[:,:,0], dtype=np.double)
gx,gy = np.gradient(img_data)
# In[4]:
temp_edge = gy*gy + gx*gx
# In[5]:
temp_edge
# In[6]:
temp_edge[temp_edge != 0.0] = 255.0
# In[7]:
temp_edge = np.asarray(temp_edge,dtype=np.uint8)
# In[8]:
cv2.imwrite('./ILSVRC2012_test_00000018_edge_opencv.png',temp_edge)
您好,南开的师兄或老师,您那边可以提供下生成边缘label的python实现么?