1

曲線の輪郭を滑らかにするためにいくつかの問題に直面しています。画像処理したらこんな画像になりました。

ここに画像の説明を入力 このコードでより滑らかな曲線を取得しようとしています:

imgWithBridgesBw = convert_to_bw(imgWithBridges)

# add later this mask upper
ellipsekernel20 = cv2.getStructuringElement(cv2.MORPH_ELLIPSE, (3,3))
enhanceMask = np.ones((InterholesBw.shape[0],InterholesBw.shape[1]) ,dtype="uint8") * 255
enhanceMaskColor = np.ones((InterholesBw.shape[0],InterholesBw.shape[1],3) ,dtype="uint8") * 255

# invert the Layer to get less blank pixels
imgWithBridgesBwInv = 255 - imgWithBridgesBw

imgWithBridgesBwInv_dilate = cv2.dilate(imgWithBridgesBwInv,ellipsekernel20,iterations =1)
imgWithBridgesBwInv_erode = cv2.erode(imgWithBridgesBwInv_dilate, ellipsekernel20, iterations = 1)  

_ ,allCnts, hier = cv2.findContours(imgWithBridgesBwInv_dilate,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)

cv2.drawContours(enhanceMask,allCnts,-1,0,2)
cv2.drawContours(enhanceMaskColor,allCnts,-1,(255,0,0),2)

結果は次のとおりです。

https://dl.dropboxusercontent.com/u/710615/testEhhancBwColor_.jpg

「ズーム」であるこの画像でわかるように、私は成功していません。

ここに画像の説明を入力

4

0 に答える 0