Questions tagged [image-thresholding]

To be used with regards to converting any image to a binary image having two values 0 and 1. It is a simple elementary image segmentation step.

For details on various methods used visit THIS WIKI PAGE

189 questions
0
votes
1 answer

How to know if I need to reverse the thresholding TYPE after findContour

I'm working with OpenCV on hand detection. But I'm struggling when trying to contours of the threshed image. findContour will always try to find white area as contour. So basically it works in most cases but sometimes my threshed image looks like…
Zenocode
  • 656
  • 7
  • 19
0
votes
0 answers

How is Double Thresholding done on an image?

I am implementing Canny Edge Detection in C++.I am stuck in Double Thresholding. I have given the threshold values manually which work fine for a given image.But when i try it on other image the threshold values are not correct and the image doesn't…
0
votes
1 answer

Why cv::findContours return so many contours?

I've read this post, but even after using cv::threshold to create a really binarry image, I still get ~500 contours. What am I doing wrong? Shouldn't cv::findContours return only 13 contours since there are clear 13 blobs? Mat img =…
theateist
  • 13,879
  • 17
  • 69
  • 109
0
votes
1 answer

Adaptive thresholding handling for big black letters

I have a document that has both very big and very small letters and I'm applying adaptive thresholding to it. cvtColor(mbgra, dst, CV_BGR2GRAY); GaussianBlur(dst, dst, Size(11, 11), 0); adaptiveThreshold(dst, dst, 255, ADAPTIVE_THRESH_GAUSSIAN_C,…
0
votes
1 answer

Best image thresholding technique that will return a high/low threshold?

I'm finding it difficult to find an adaptive image thresholding technique for mazes that will return either a high or low value to make sure that all the paths are the same color. So far I have tried a fixed threshold which obviously didn't work and…
0
votes
0 answers

Segment dyed cells from digital pathology images using Matlab

I am trying to segment colored cells from original images like this: The blue colored cells are targets that I want to segment and counted. Here is the code I use: global ButtonDown img=imread('Zoom.png'); hsv=rgb2hsv(img); s=hsv(:,:,2); bw =…
0
votes
2 answers

Combining masks

I'm trying to obtain an image which has everything but several colorful objects grayed out, as shown here: My original image is this (the caps have slightly different colors than the example above): I tried to apply a threshold process then…
0
votes
1 answer

Calculating threshold by the "slower version" of Otsu's method

This site gives an implementation of the approach with between class variance. I want, however, to do it with within class variance(unfortunately I can't post the formula, but you can see it on the site), which is considered to be slower. This is my…
Dreikäsehoch
  • 131
  • 2
  • 7
0
votes
1 answer

Reg: Copy blob based on the area of the blob size

Objective: Copy the bigger blobs in another mask image I have a threshold image with blobs as shown: How could I copy the bigger blobs into a mask image and leave out the one-pixel blobs? My code (but I am not getting the desired result): import…
Jeremy
  • 189
  • 4
  • 14
0
votes
1 answer

What's the most efficient way of identifying items of a specific shade of colour in an image with matlab?

im trying to identify a specific shade of green leaves (e.g. navy green) from the attached image. how do i do that in the most efficient way? So far, i'm converting the RGB to HSV and then thresholding the image based on some specific range of…
0
votes
1 answer

cv2 treshold does not work correctly on second image

I am new to python and I was playing around with background subtraction to visualize changes in pre and post change images. I wrote a short and simple script using the cv2 library: #!/usr/bin/env python import cv2 as cv import numpy as np from…
ViktorG
  • 505
  • 1
  • 7
  • 30
0
votes
1 answer

How to convert from MATLAB Lab color scale to OpenCV Lab color scale?

I am trying to sample colors in MATLAB using the Color Thresholder App and then use the L * a * b output in OpenCV. But there seems to be a scale mismatch. The following are the L * a * b scales in MATLAB and OpenCV: MATLAB: 0 <= L <= 100; -100 <=…
Arun Kumar
  • 634
  • 2
  • 12
  • 26
0
votes
0 answers

threshold an image in C

I am trying to threshold a PGM in C. I am trying to access the array and trying to convert array elements from one color and then other array elements into another color. The array is set to the following: int inputPicture[1025][1025]; The code…
0
votes
1 answer

Error in using adaptive thresholding on gray-scale image

I read an image, and converted it to gray-scale using this function: def rgb2gray(img): if len(img.shape)==3 & img.shape[-1] == 3: # img is RGB return cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) return img now, I try to convert my image…
Binyamin Even
  • 3,318
  • 1
  • 18
  • 45
0
votes
0 answers

How to threshold a grayscale image with lighting and noise

I am trying to threshold images with challenging noise. . The numbers on the side are the dimensions. I have tried various standard methods: ret,thresh1 = cv2.threshold(img,95,255,0) #cv2.THRESH_BINARY thresh2 =…