Function iathreshad

namespace:morph
page:iathreshad

Synopse

Threshold (adaptive)

  • y = iathreshad(f, f1, f2=NULL)
    • y: Image
    • f: Image
    • f1: Image lower value
    • f2: Image upper value
01. from numpy import *
02. 
03. def iathreshad(f, f1, f2=None):
04.     from iabinary import iabinary
05. 
06.     if f2 is None:
07.       y = (f1 <= f)
08.     else:
09.       y = ((f1 <= f) & (f <= f2))
10. 
11.     return y

Description

iathreshad creates the image y as the threshold of the image f by the images f1 and f2. A pixel in y has the value 1 when the value of the corresponding pixel in f is between the values of the corresponding pixels in f1 and f2.

Examples

Example 1

1. from ia870 import iathreshad
2. 
3. 
4. a = adreadgray('keyb.tif')
5. adshow(a)
6. b = iathreshad(a,uint8(10), uint8(50))
7. adshow(b)
8. c = iathreshad(a,238)
9. adshow(c)

Equation

Algorithm

function y = iathreshad_equ( f, f1, f2 )
  y = (f1 <= f) & (f <= f2);