कैसे कर सकते हैं मैं पहचान गुलाबी लकड़ी में एक छवि है? मैं इस कोड का इस्तेमाल किया, लेकिन मैं नहीं मिल रहा था किसी भी गुलाबी छोटे से लकड़ी की छवि में.
मुझे उम्मीद है कि अगर मैं इस तरह के एक छवि के रूप में इनपुट, आउटपुट की गुलाबी लकड़ी मान्यता प्राप्त हो जाएगा.
अन्य की तुलना में, इस विधि आप के लिए एक सुझाव है पहचानने गुलाबी लकड़ी????
इनपुट:
उत्पादन की उम्मीद है (मैन्युअल रूप से के रूप में चिह्नित)
कोड:
import numpy as np
import cv2
from cv2 import *
im = cv2.imread(imagePath)
im = cv2.bilateralFilter(im,9,75,75)
im = cv2.fastNlMeansDenoisingColored(im,None,10,10,7,21)
hsv_img = cv2.cvtColor(im, cv2.COLOR_BGR2HSV) # HSV image
COLOR_MIN = np.array([233, 88, 233],np.uint8) # HSV color code lower and upper bounds
COLOR_MAX = np.array([241, 82, 240],np.uint8) # color pink
frame_threshed = cv2.inRange(hsv_img, COLOR_MIN, COLOR_MAX) # Thresholding image
imgray = frame_threshed
ret,thresh = cv2.threshold(frame_threshed,127,255,0)
contours, hierarchy = cv2.findContours(thresh,cv2.RETR_TREE,cv2.CHAIN_APPROX_SIMPLE)
print(contours)
for cnt in contours:
x,y,w,h = cv2.boundingRect(cnt)
print(x,y)
cv2.rectangle(im,(x,y),(x+w,y+h),(0,255,0),2)
cv2.imwrite("extracted.jpg", im)
आउटपुट कोड:
print(contours)
()
समस्या यह है कि गुलाबी लकड़ी मान्यता प्राप्त नहीं है