tested on blue background
remove blue colors in hsv
This commit is contained in:
parent
b8b641537e
commit
016510ecc8
BIN
data/LegosBlue/blue1.JPG
Normal file
BIN
data/LegosBlue/blue1.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 458 KiB |
BIN
data/LegosBlue/blue2.JPG
Normal file
BIN
data/LegosBlue/blue2.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 376 KiB |
BIN
data/LegosBlue/blue3.JPG
Normal file
BIN
data/LegosBlue/blue3.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 397 KiB |
BIN
data/LegosBlue/blue4.JPG
Normal file
BIN
data/LegosBlue/blue4.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 323 KiB |
BIN
data/LegosBlue/blue5.JPG
Normal file
BIN
data/LegosBlue/blue5.JPG
Normal file
Binary file not shown.
After Width: | Height: | Size: 459 KiB |
@ -5,9 +5,14 @@ import os
|
|||||||
|
|
||||||
print('-----')
|
print('-----')
|
||||||
dirname = os.path.dirname(__file__)
|
dirname = os.path.dirname(__file__)
|
||||||
filename = os.path.join(dirname,'data/legos3.jpg')
|
filename = os.path.join(dirname,'data/LegosBlue/blue5.jpg')
|
||||||
print(os.path.exists(filename))
|
print(os.path.exists(filename))
|
||||||
img = cv2.imread(filename)
|
img = cv2.imread(filename)
|
||||||
|
hsv = cv2.cvtColor(img,cv2.COLOR_BGR2HSV)
|
||||||
|
lwr = np.array([85,50,40])
|
||||||
|
upr = np.array([135,255,255])
|
||||||
|
msk = cv2.inRange(hsv, lwr, upr)
|
||||||
|
img[msk>0]=(0,0,0)
|
||||||
b,g,r = cv2.split(img)
|
b,g,r = cv2.split(img)
|
||||||
rgb_img = cv2.merge([r,g,b])
|
rgb_img = cv2.merge([r,g,b])
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user