如何用颜色表示每个图像像素和轮廓之间的距离?

时间:2017-03-21 07:18:20

标签: python opencv image-processing

这是我使用的代码

<?xml version="1.0"?>
<configuration>
    <connectionStrings>
        <add name="abcConnection" connectionString="server=10.10.12.12;database=Test1;uid=myUI‌​D;password=hello;tim‌​eout=20;"providerNam‌​e="System.Data.SqlCl‌​ient" />
        <add name="123Connection" connectionString="server=10.10.23.45;database=test2;uid=MyUS‌​I;password=hello;" providerName="System.Data.SqlClient" />
    </connectionStrings>
</configuration>

此部分用颜色表示距离。我想我需要更多帮助。

import cv2
import numpy as np
img = cv2.imread('circle.png' )
imgray = cv2.cvtColor(img , cv2.COLOR_BGR2GRAY)
imgblured = cv2.GaussianBlur(imgray , (5,5) , 0)
_,threshold = cv2.threshold(imgblured,0,255,cv2.THRESH_BINARY+cv2.THRESH_OTSU )


_,contours,_=cv2.findContours(threshold , cv2.RETR_LIST ,cv2.CHAIN_APPROX_SIMPLE)
print 'number of contours is : ' , len(contours)
cnt = contours[0]
cv2.drawContours(img , [cnt] , -1 , (255,255,255),20)

提前致谢。

0 个答案:

没有答案
相关问题