The starting point for a new state.
Questions tagged [threshold]
715 questions
85
votes
2 answers
Efficient thresholding filter of an array with numpy
I need to filter an array to remove the elements that are lower than a certain threshold. My current code is like this:
threshold = 5
a = numpy.array(range(10)) # testing data
b = numpy.array(filter(lambda x: x >= threshold, a))
The problem is that…

fortran
- 74,053
- 25
- 135
- 175
46
votes
3 answers
How to use the OTSU Threshold in opencv?
I was using a fixed threshold but turns out that it's not so good for me. Then, someone told me about the otsu threshold. How can I use it in my code?
I read about it and I don't understand very well. Could someone explain to me how to use it in…

U23r
- 1,653
- 10
- 28
- 44
30
votes
5 answers
Fast image thresholding
What is a fast and reliable way to threshold images with possible blurring and non-uniform brightness?
Example (blurring but uniform brightness):
Because the image is not guaranteed to have uniform brightness, it's not feasible to use a fixed…

1''
- 26,823
- 32
- 143
- 200
20
votes
4 answers
How to set a pylint score threshold?
I'd like to extract my pylint rating and set a threshold. Let me explain, for example, if the score is under 5, I want exit 1; And if my code is rated higher than 5, I want exit 0 and continue my Jenkins procedure.

Axel Bayle
- 205
- 1
- 2
- 8
19
votes
2 answers
How to set a threshold for a sklearn classifier based on ROC results?
I trained an ExtraTreesClassifier (gini index) using scikit-learn and it suits my needs fairly. Not so good accuracy, but using a 10-fold cross validation, AUC is 0.95. I would like to use this classifier on my work. I am quite new to ML, so please…

Colis
- 323
- 1
- 2
- 7
17
votes
3 answers
Adaptive threshold of blurry image
I have a fairly blurry 432x432 image of a Sudoku puzzle that doesn't adaptively threshold well (take the mean over a block size of 5x5 pixels, then subtract 2):
As you can see, the digits are slightly distorted, there are a lot of breakages in…

1''
- 26,823
- 32
- 143
- 200
15
votes
3 answers
Android ACTION_MOVE Threshold
I'm writing an app that involves writing on the screen using one's finger, or eventually a stylus. I have that part working. On ACTION_DOWN, starts drawing; on ACTION_MOVE, adds line segments; on ACTION_UP, finishes line.
The problem is that after…

Erhannis
- 4,256
- 4
- 34
- 48
15
votes
2 answers
How to I use PIL Image.point(table) method to apply a threshold to a 256 gray image?
I have 8-bit greyscale TIFF images that I want to convert to Monochrome using a 75% white (decimal 190) threshold. In the Image.convert(mode) method section, the PIL manual says:
"When translating a greyscale image into a bitlevel image (mode "1"),…

tahoar
- 1,788
- 3
- 20
- 36
14
votes
5 answers
Python OpenCV - Find black areas in a binary image
There is any method/function in the python wrapper of Opencv that finds black areas in a binary image? (like regionprops in Matlab)
Up to now I load my source image, transform it into a binary image via threshold and then invert it to highlight the…

Marco L.
- 1,489
- 4
- 17
- 25
13
votes
2 answers
Difference between adaptive thresholding and normal thresholding in opencv
I have this gray video stream:
The histogram of this image:
The thresholded image by :
threshold( image, image, 150, 255, CV_THRESH_BINARY );
i get :
Which i expect.
When i do adaptive thresholding with :
adaptiveThreshold(image,…

Olivier_s_j
- 5,490
- 24
- 80
- 126
12
votes
1 answer
Jenkins xUnit test result report
I have a Jenkins job to copy some test reports(XML) to local and convert them to JUnit reports via xUnit.
The issue is that there are no failed or skipped tests, but I always get
[xUnit] [INFO] - Check 'Failed Tests' threshold.
[xUnit]…

Jay Cui
- 137
- 1
- 9
11
votes
1 answer
Scikit - changing the threshold to create multiple confusion matrixes
I'm building a classifier that goes through lending club data, and selects the best X loans. I've trained a Random Forest, and created the usual ROC curves, Confusion Matrices, etc.
The confusion matrix takes as an argument the predictions of the…

sapo_cosmico
- 6,274
- 12
- 45
- 58
10
votes
3 answers
Counting colonies on a Petri dish
I have a bunch of Petri dishes full of dots which I'd like to count in Matlab. Can this be done reliably and in batches?
E.g. This plate has 352 colonies
I've tried ImageJ but need to do quite a bit of cropping out of the border and get variable…

HCAI
- 2,213
- 8
- 33
- 65
10
votes
1 answer
Plotly: How to display different color segments on a line chart for specified thresholds?
I have a multi-line graph that displays percent increase over time. I'd like to set a threshold in my code to have an upper and lower bound. If the line falls outside these bounds, I'd like that specific part of the line graph to be a different…

Lynn
- 4,292
- 5
- 21
- 44
10
votes
1 answer
How to disable the move threshold when getting touch events?
I am creating an Android game that uses touch input. I noticed that, when I put down a finger and move it, there is a threshold of a couple of pixels until the first MotionEvent.ACTION_MOVE is generated. What is the correct way of disabling this…

Herr von Wurst
- 2,571
- 5
- 32
- 53