# 3.2 Placing Markers
The following tools can be used to place markers in 2D iamge in an interactive manner:
-- Grain markers
 add grain marker
 erase grain marker - by pixel
 delete grain marker - by connected pixels
-- Background markers
 add background marker
 erase background marker - by pixel
 delete background marker - by connected pixels
## For both grain and background markers
- Markers are of the size of "a pixel".
- Placing markers in a connected fashion (see following examples) to guide the segmentation process to produce desirded result.
- Although they have different names, they are treated equally as "markers" in marker controlled watershed segmentation in iPeriGrain. This means they have the same influence on the segmentation process to generate segments.
- The only difference is in the post-processing, where the resultant segments would be discarded if the background markers are placed inside it. In the case when both grain and background markers are present in the same segment, it will be discarded due to the presence of background marker.
## Common issues of delineating gravel grains in 2D images with automatic algorithm
- Oversegmentation
 - A grain is divided into more than two segments.
- Undersegmentation
 - Several grains are grouped as one segment.
- Backgound area
 - Blurry area in the image that cannot be regarded as a grain with certainty.
## Example with DEM
### ***How to fix oversegmentation with iPeriGrain***
In this example, the target grain in the DEM is oversegmented as 3 grains.
-- DEM

-- Result with oversegmentation

-- Use "add grain marker" tool to place the grain markers on the target grain in a connected fashion.

-- ReSegment

---
### ***How to fix undersegmentation with iPeriGrain***
In this example, several grains are undersegmented as one large grain.
-- DEM

-- Result with undersegmentation

-- Use "add grain marker" tool to place the grain markers on the target grain and its neighboring grain in a connected fashion. Robust result can be obtained by placing the grain markers follwing the perimenters of the grain-of-interest, while staying inside the grain. Avoid placing markers on the edge.

-- ReSegment

---
### ***How to discard background area***
-- DEM

-- First, grains that surround the background area should be segmented. Grain markers should be used to guide the segementation process when necessary.

-- Second, use "add background marker" tool to place the background marker in the background area.

-- ReSegment

---
## Example with optical image
### ***How to fix oversegmentation and undersegmentation simulataneously in iPeriGrain***
The issues of oversegmentation and undersegmentaion is prominent due to variations of textures, size, shape, shadow, etc, inside the optical image. It is quite common to see co-existence of oversegmentation and undersegmentaion.
-- Optical image

-- The target grain is oversegmented into several grains while the upper portion of the target grain is grouped into another grain (i.e., undersegmentation).

-- Use "add grain marker" tool to place the grain markers on the target grain in a connected fashion. Robust result can be obtained by placing the grain markers follwing the perimenters of the grain-of-interest, while staying inside the grain.

-- ReSegment

### ***How to discard background area***
-- Optical image

-- First, grains that surround the background area should be segmented. Grain markers should be used to guide the segementation process when necessary.

-- Second, use “add background marker” tool to place the background marker in the background area

-- ReSegment
