Question: I have an image with a few bright pixels with the remaining ones very dark. The difference is in orders of magnitude.

I want to binarize this matrix (corresponding to the image) making all values zero besides the few bright ones. 

The function Binarize does what I want but it accepts only an image as an input. So indeed I can use the plot of the matrix as input but that messes up things because the image includes the axis, labels etc...

How can I do this? Any help will be appreciated.

Answer: 
`Clip` seems perfectly suited:

```
mat = RandomReal[{0, 10}, {100, 100}];
Manipulate[
 MatrixPlot[Clip[mat, {threshold, threshold}, {0, 1}]],
 {threshold, 0, 10}
 ]

```

![enter image description here](https://i.stack.imgur.com/cdXoV.png)

Here we use the form of [`Clip`](http://reference.wolfram.com/language/ref/Clip.html) with three arguments:

```
Clip[mat, {threshold, threshold}, {0, 1}]

```

It takes everything below `threshold` and sets it to `0`, and takes everything above `threshold` and sets it to `1`. You can change both thresholds and the extreme values, eg

```
Clip[Range[10], {5, Infinity}, {0, 1}]

```

which sets everything below `5` to `0` and does nothing else (the `1` does nothing the way I wrote it).
As you note [`Binarize`](http://reference.wolfram.com/mathematica/ref/Binarize.html) does just this:

> 
> `Binarize[image,t]`  
> 
>  creates a binary image by replacing all values above `t` with 1 and others with 0.
> 
> 
> 

Therefore you merely need to convert your data into an `Image`. First some test data:

```
m = Array[Plus, {21, 21}, -10];
m // MatrixPlot

```

![enter image description here](https://i.stack.imgur.com/8vSmP.png)

Now we convert to an `Image`:

```
img = Image[m]

```

![enter image description here](https://i.stack.imgur.com/4FhUk.png)

Do not worry that the data already appears binarized; it is still there:

> 
> `Image[data]` by default allows any real number, but displays only values between 0 and 1.
> 
> 
> 

We can still `Binarize` at any value within the range of the original array:

```
Binarize[img, #] & /@ {-18, -11, -4, 0, 4, 11, 18}

```

![enter image description here](https://i.stack.imgur.com/i1CvE.png)

If you wish to recover the numeric data use [`ImageData`](http://reference.wolfram.com/mathematica/ref/ImageData.html):

```
Binarize[img, 11] // ImageData // MatrixPlot

```

![enter image description here](https://i.stack.imgur.com/iqOHg.png)