tested on blue background

remove blue colors in hsv
This commit is contained in:
Philipp Mock 2023-03-20 17:59:47 +01:00
parent b8b641537e
commit 016510ecc8
6 changed files with 6 additions and 1 deletions

BIN
data/LegosBlue/blue1.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 458 KiB

BIN
data/LegosBlue/blue2.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 376 KiB

BIN
data/LegosBlue/blue3.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 397 KiB

BIN
data/LegosBlue/blue4.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 323 KiB

BIN
data/LegosBlue/blue5.JPG Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

View File

@ -5,9 +5,14 @@ import os
print('-----')
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))
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)
rgb_img = cv2.merge([r,g,b])