-
Book Overview & Buying
-
Table Of Contents
Visual Media Processing Using MATLAB Beginner's Guide
By :
Since photographs from holidays are a usual target for image enhancement applications, we'll use one of these for our example, showing three large rocks in the sea. The goal is to come up with a mask that includes just them. Let's start with our usual steps:
As always, we'll need to load our image into MATLAB, only now we will also have to convert it to grayscale:
>> img = imread('3Rocks.jpg');
>> img = rgb2gray(img);Now that our image is loaded and transformed to grayscale, let's show it to get a better idea of our goal:
>> imshow(img);

Let's now have a go at thresholding the image. Let's set our threshold to 30, since the rocks are dark. This time, the threshold denotes the maximum value kept, meaning we will ask MATLAB to make a mask containing only the pixels with values below 30, that is, set the pixels of the image with values below 30 equal to 1 (white), and the rest to 0 (black):
>> img_bin = img <...
Change the font size
Change margin width
Change background colour