Marthee commited on
Commit
637a3fe
·
1 Parent(s): 5cc3bdb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -14
app.py CHANGED
@@ -424,22 +424,22 @@ def allLevelsofColor(BlackmaskDetected,img,levelonly, invertedmask,color,finalCo
424
  firstLevel[black_pixels] = [255, 255, 255]
425
  firstLevel1=cv2.bitwise_and(levelonly,firstLevel)
426
 
427
- for othercolor in finalColorArray:
428
- othercolor=hexRGB(othercolor)
429
 
430
- if othercolor.all()!=color.all():
431
 
432
- masked0=DetectColor(firstLevel,othercolor)[0]
433
- pil_image0=Image.fromarray(masked0)
434
- extrema0 = pil_image0.convert("L").getextrema()
435
- if extrema != (0, 0): # if image is not black --> has a colored mask within
436
- ColoredContour0, Coloredhierarchy0 = cv2.findContours(masked0, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
437
- for cnt in ColoredContour0:
438
- area1 = cv2.contourArea(cnt)
439
- if (area1 > 1000 ):
440
- cv2.drawContours(firstLevel1,[cnt],0,(255,255,255), -1)
441
- cv2.drawContours(firstLevel1,[cnt],0,(255,255,255), 20)
442
- cv2.drawContours(BlackmaskDetected,[cnt],0,(0,0,0), -1)
443
 
444
  return firstLevel1, BlackmaskDetected
445
 
 
424
  firstLevel[black_pixels] = [255, 255, 255]
425
  firstLevel1=cv2.bitwise_and(levelonly,firstLevel)
426
 
427
+ # for othercolor in finalColorArray:
428
+ # othercolor=hexRGB(othercolor)
429
 
430
+ # if othercolor.all()!=color.all():
431
 
432
+ # masked0=DetectColor(firstLevel,othercolor)[0]
433
+ # pil_image0=Image.fromarray(masked0)
434
+ # extrema0 = pil_image0.convert("L").getextrema()
435
+ # if extrema != (0, 0): # if image is not black --> has a colored mask within
436
+ # ColoredContour0, Coloredhierarchy0 = cv2.findContours(masked0, cv2.RETR_EXTERNAL, cv2.CHAIN_APPROX_SIMPLE)
437
+ # for cnt in ColoredContour0:
438
+ # area1 = cv2.contourArea(cnt)
439
+ # if (area1 > 1000 ):
440
+ # cv2.drawContours(firstLevel1,[cnt],0,(255,255,255), -1)
441
+ # cv2.drawContours(firstLevel1,[cnt],0,(255,255,255), 20)
442
+ # cv2.drawContours(BlackmaskDetected,[cnt],0,(0,0,0), -1)
443
 
444
  return firstLevel1, BlackmaskDetected
445