# Revision history [back]

I solved problem.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (70, 25, 25), (140, 255,255))

## slice the black

## save


Output:

I solved problem.problem. You don't needed threshold. Used cv2.InRange will suit your need.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (70, 25, 25), (140, 255,255))

## slice the black

## save


Output:

I solved problem. You don't needed threshold. Used cv2.InRange will suit your need.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (70, 25, 25), (140, 255,255))

## slice the black

## save


Output:

I can't go further. You cannot get bold. The pay slip is little visible about 25. Because of that it is black.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (100, 15, 15), (190, 165,165))

## slice the black

## save


Output:

I solved problem. You don't needed threshold. Used cv2.InRange will suit your need.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (70, 25, 25), (140, 255,255))

## slice the black

## save


Output:

I can't go further. You cannot get bold. The pay slip is little visible about 25. 25%. Because of that it is black.

#!/usr/bin/python37
#OpenCV 4.1.2-pre, THonny IDE
#Raspberry pi 3/4
#Date: 31 October, 2019

import cv2
import numpy as np

## convert to hsv
hsv = cv2.cvtColor(img, cv2.COLOR_BGR2HSV)
mask = cv2.inRange(hsv, (100, 15, 15), (190, 165,165))

## slice the black