Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

5
  • 2
    Thanks! Since a colored image has RBG three channels, what does/can the threshold apply to in general? Commented Jan 9, 2014 at 23:00
  • @Tim It probably depends on the software, but I would expect the threshold (unless you specify per channel or for a specific channel, see e.g. ImageMagick's convert's -channel option) to be applied to some sort of "value" of the pixel, which is computed from all channels. That's the reason why I said you might want to convert to grayscale first for more predictable results. (Also see my edit.) Commented Jan 10, 2014 at 8:17
  • Thanks! Does there exist some documentation for what the threshold apply to in the command shown in your post? Commented Jan 10, 2014 at 18:29
  • @Tim Not really. I expected convert to take either a percentage of the maximum value (which should have been 256 per channel) or a specific value, but I could only get a useful result when specifying a percentage. When you do it with a graphical tool, including GIMP, you'll generally have a histogram that shows the tonal distribution of the image; that will be a great aid in picking the proper value. Using only the command line, unless you have a specific reason to do so, is probably more trouble than it's worth, really. Commented Jan 10, 2014 at 18:31
  • 2
    As a side note, there exist other thresholding methods that don't have to rely on a hard-coded threshold level. For example, ImageMagick includes -lat which performs a local adaptive threshold, taking into account the surrounding pixels. Commented Jan 15, 2014 at 22:37