Topologically-Guided Color Image Enhancement

by   Junyi Tu, et al.
University of South Florida

Enhancement is an important step in post-processing digital images for personal use, in medical imaging, and for object recognition. Most existing manual techniques rely on region selection, similarity, and/or thresholding for editing, never really considering the topological structure of the image. In this paper, we leverage the contour tree to extract a hierarchical representation of the topology of an image. We propose 4 topology-aware transfer functions for editing features of the image using local topological properties, instead of global image properties. Finally, we evaluate our approach with grayscale and color images.



There are no comments yet.


page 2

page 6

page 8

page 9

page 10

page 12


Image color correction, enhancement, and editing

This thesis presents methods and approaches to image color correction, c...

Recoding Color Transfer as a Color Homography

Color transfer is an image editing process that adjusts the colors of a ...

SpaceEdit: Learning a Unified Editing Space for Open-Domain Image Editing

Recently, large pretrained models (e.g., BERT, StyleGAN, CLIP) have show...

Topology Maintained Structure Encoding

Deep learning has been used as a powerful tool for various tasks in comp...

Image preprocessing and modified adaptive thresholding for improving OCR

In this paper I have proposed a method to find the major pixel intensity...

An Adaptive Descriptor Design for Object Recognition in the Wild

Digital images nowadays have various styles of appearance, in the aspect...

Image recognition via Vietoris-Rips complex

Extracting informative features from images has been of capital importan...
This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

1 Introduction

Image enhancement techniques aim to provide users maximal control in directing the improvements of the appearance of an image. They are widely used in photography post-processing (i.e., retouching), medical image processing, and object recognition. Many image editing platforms, such as Adobe Photoshop, utilize region selection, similarity, and/or thresholding to determine groups of pixels to edit. Then, editing options (e.g., contrast or brightness) that only consider global image properties are provided, never considering the topological structure of an image. Topological information provides a new perspective on the “shape” of the image and new capabilities for manipulating it [14].

In this paper, we leverage a tool from Topological Data Analysis (TDA) [6], specifically the contour tree [3], to extract a hierarchical representation of key features of an image (i.e., critical points) and the monotonic regions connecting those features (i.e., Morse cells). The contour tree of a scalar function defined on a simply connected domain (i.e., an image) is obtained by encoding the evolution of the connectivity of the level sets induced by the scalar function. The key property of contour tree that makes it a viable tool for image enhancement is its graph-based representation that captures the changes of topology in image data. The contour tree can therefore be searched, modified, and pruned locally, in a quantifiable way, while retaining the global structures in the image. Using the contour tree, topology-aware transfer functions provide new image enhancement functionalities for editing images using local topological properties, instead of using global image properties.

The contributions of this paper are: (1) we provide a mapping of color images to the contour tree for extracting the topological structure of the image; (2) we describe an interface for selecting topological features for image editing; and (3) we provide 4 topology-aware transfer function modalities for image editing: brightness enhancement, contrast enhancement, denoising, and gamma correction.

(c) Terrain Visualized
(d) Contour Tree
Figure 1: (a) A scalar function defined on a simple domain (with contours shown for demonstration purposes only) (b) has monotonic regions differentiated by color. The function, (c) visualized as terrain with 2 isovalues highlighted (i.e., the red and blue planes), (d) produces a contour tree, where the nodes represent critical points and edges represent regions of monotonic behavior.

2 Capturing the Topology of an Image

Let be a continuous function on a simply connected domain . The level set of a single isovalue is, and a contour is a connected component of a level set. The most familiar context of contours are topographic maps (see Fig. 1), where is the elevation, and contours are shown at selected values. The contour tree tracks the creation, merging, splitting, and destruction of contours as a plane is swept across .

Consider the example height map in Fig. 1(c) and contour tree in Fig. 1(d). First, a plane is swept from . As the plane sweeps up, when it reaches local minima, nodes are created in the contour tree, denoted by labels , , and , since these represent the “birth” of a contour. As the plane continues its sweep up, one can observe that at there are 3 independent contours, each represented by an edge in the contour tree.

At , a special event occurs, where the contour of and merge together. The merge, called a join event, represents the “death” of the contour that was born more recently, in this case . The event creates the feature pair . Similarly, at , the contours of and join and “dies”, creating the pair.

The birth/death relationships are important, because they segment the space into a hierarchy of regions of uniform (i.e., monotonic) behavior. Furthermore, the difference between the birth and death, , of a contour is known as the persistence of the feature. Persistence is an important measure in our context, as it captures the amplitude/magnitude of a feature.

Likewise, we also consider a sweep plane that goes from . As the plane sweeps downwards, new contours are born at local maxima, such as and . For downward sweeps, when the contours merge together at , this is called a split event. Similarly to join events, the split represents the “death” of the feature born more recently, in this case . With splits, .

Finally, the global minimum and maximum are paired into a special feature, captured twice as and , representing the range of values.

(a) Scalar Field
(b) Augmented Join Tree
(c) Join Tree
(d) Augmented Split Tree
(e) Split Tree
(f) Augmented Contour Tree
Figure 2: (a) A low resolution version of Fig. 1(a) has its (b) augmented join and (d) split trees generated. (f) The trees combine into an augmented contour tree. The critical points of the augmented trees generate the (c) join, (e) split, and (Fig. 1(d)) contour trees of the scalar field.

2.1 Computing the Contour Tree

We briefly describe the computation of the contour tree. For a detailed description and efficient algorithm, see [4, 15].

As the previous section implies, the construction is split into 2 phases: an upward and downward sweep, implemented as join tree (see Fig. 2(c)) and split tree (see Fig. 2(e)) construction, respectively. To find the join and split trees, the construction first finds the augmented join tree and augmented split tree.

Using the scalar field in Fig. 2(a), which is a downsampled version of Fig. 1(a), the augmented join tree construction is shown in Fig. 2(b). First, the pixels are sorted by values, . Pixels are inserted 1 at a time into the augmented join tree. As they are inserted, connected components are tracked by connecting with neighboring pixels already in the augmented join tree. In our implementation we consider the ring of 8 neighbors surrounding a given pixel. In this example, we only consider 4 (i.e., left/right/up/down) neighbors. If a pixel joins 1 or more existing components, it is connected to the top of those components in the augmented join tree. If it joins no component, it starts a new connected component. For example, when is added to the tree, no connected components exist, so it creates one. When is inserted, it joins the component, since they are neighbors in the image. Continuing forward, when is inserted, it links the component to the component.

Augmented split tree construction is performed nearly identically, except it starts at the largest valued pixel first. The augmented contour tree is constructed by pealing leaf nodes off of the join/split trees and adding them to the augmented contour tree, as described in [4]. The join/split/contour trees consist of only critical nodes (i.e., nodes that cause birth and death events). They are calculated by removing “regular” nodes, those having only 1 upward and 1 downward edge, from the augmented tree. Finally, using the contour tree, the critical points are paired into birth/death units using the approach in [16].

This construction assumes that all pixels have unique values, which is not the case in real images. There are 2 cases of equal valued pixels we consider. When equal valued pixels are non-adjacent, no special handling is required—the pixels can be processed in arbitrary order, but the output is still deterministic. However, adjacent pixels of equal value are problematic, since changing their insertion order can change the contour tree structure. This is resolved by grouping adjacent equal-valued pixels into “super-pixel” units that are processed together.

2.2 Feature Subtree Extraction

Extracting the regions of monotonic behavior requires selecting a subtree from the augmented contour tree for a given feature pair. Given a join/split node and local minimum/maximum pair, starting at the join/split, find the 3 subtrees extending from it. The selected subtree for the feature pair is the one containing the local minimum/maximum node. For example, in Fig. 2(f), the feature pair contains join node and local minimum . Join node has 3 subtrees: up, down-left, and down-right. The down-left subtree contains the local minimum node , making it the feature subtree, containing nodes . The selection can be seen in Fig. 4(a).

2.3 Using the Contour Tree of Color Images

The contour tree requires (i.e., a single color channel). However, considering color images in RGB (Red, Green, Blue) colorspace, 3 channels map to each pixel. We consider each channel, red, green, and blue independently, generating 3 contour trees. We also consider HSB (Hue, Saturation, Brightness) colorspace. Saturation and brightness each map to their own contour trees. However, hue maps to (i.e., circular coordinates), and the contour tree does not work in . Resolving this limitation requires additional theoretical studies. Other colorspaces are possible, when channels map to .

3 Image Processing via Contour Trees

The basic procedure for topology-based enhancement of an image is: (1) first, the user selects a set of feature pairs of interest; (2) next, the feature pairs are used to automatically select pixels for editing; (3) finally, the image is edited by the user, and the contour trees are recalculated so the process can restart.

3.1 Visualizing the Contour Tree

Direct visualization of the contour tree is generally not advisable, as the size and complexity of the tree is unmanageable for even moderately sized data. To select features to edit, each contour tree is displayed using 2 interactive interfaces—the persistence diagram and persistence-volume diagram.

(a) Persistent diagram (left) and persistent-volume diagram (right) for contour tree in Fig. 1(d).
(b) Selection in persistence-volume diagram (left) precedes edit type (top right) and scale adjustment (bottom right).
Figure 3: (a) The main interfaces used for selecting topological features use the persistence diagram (left) and persistence-volume diagram (right). (b) Once features a selected (left) the editing interface enables selecting the type and scale of edits (right).

Persistence Diagram. A standard practice in TDA represents the contour tree with birth/death feature pairs in a scatterplot display, called a persistence diagram [5]. In a persistence diagram, the x-axis is tied to the feature birth value, while the death value is tied to the y-axis. Fig. 3(a)(left) shows an example for the contour tree in Fig. 1(d). Join features (i.e., and ) are on the upper left, while split features (i.e., ) are on the lower right. Features are also colored by their type—join features blue and split features red. The persistence diagram provides 2 powerful selection hints. First, features on the lower left are darker pixels, while those on the upper right are brighter pixels, since the birth and death are parameterized by pixel value. Second, the distance of the point from the diagonal is an analog of the persistence of the feature pair. In other words, features with larger magnitude are farther from the diagonal.

Persistence-Volume Diagram. The persistence diagram primarily captures the amplitude of a selected feature. The volume (i.e., the pixel count of a feature) is sometimes important as well. The persistence-volume diagram (see Fig. 3(a)(right)) is an alternative representation that encodes persistence (i.e., ) on the x-axis using a linear scale and volume on the y-axis using a log scale. Volume is calculated by counting the number of nodes/pixels in the feature subtree. For example, the contains 4 nodes/pixels, , , , and .

3.2 Subtree Selection

Once the contour trees are generated and visualized, user interaction can proceed. Many topological features come from an image, so while individual selection is possible, selection of multiple features is desirable. We provide a brushing mechanism on both the persistence diagram and persistence-volume diagram for selecting a set of features of interest. As the mouse is clicked-and-dragged, the features and feature subtrees are gathered for further processing. For example, brushing across the middle of the persistence-volume diagram in Fig. 3(a) would select feature and its subtree, as shown in Fig. 3(b). Features of the contour tree are hierarchical, thus, if more than one feature is selected, those features may be inclusions (i.e., one feature may be a subsets of another). In that case, only the larger/outermost feature is processed.

The selected feature pairs and their associated subtrees are relatively easy to use for segmentation. Starting with a full resolution binary mask, the nodes/pixels of each selected feature is marked in the mask. Fig. 4(f) shows how this would work given the selection of the feature from Fig. 1.

(a) Sel. Subtree
(b) Contrast
(c) Denoising
(d) Brightness
(e) Gamma
(f) Selection
Figure 4: Using the (a/f) selected subtree, (b/g) contrast enhancement, (c/h) denoising, (d/i) brightness enhancement, and (e/j) gamma correction operations are shown.

3.3 Subtree Modification as Image Editing

From a segmentation mask, global image editing options (i.e., contrast enhancement, brightness enhancements, etc.) could be easily executed. However, this misses an opportunity for modifications based upon local topology, by using subtree information. For subtree-based modification, we provide 4 transfer function options that utilize the properties of the subtree.

Contrast Enhancement. Contrast enhancement fixes value of the feature pair join/split node and linearly stretches rest of the subtree. For a given node in the subtree and a contrast scale factor , the value . Fig. 4(b) shows an example of the operation, where the local contrast enhancement fixes the death value of a feature, while lowering the birth value.

Denoising. Denoising linearly collapses the subtree, such that all pixels eventually have the same value, . The calculation of denoising is identical to contrast enhancement—for a given node in the subtree and a denoising scale factor , the value . Fig. 4(c) shows an example, where the death value is fixed and the values of other nodes/pixels are increased.

Brightness Enhancement. The brightness of the entire subtree can be modified up or down uniformly. For a given node in the subtree and a brightness scale factor , the value . Fig. 4(d) shows an example.

Gamma Correction. Gamma correction provides a nonlinear modification, which is usually applied to the luminance of an image. For a given node in the subtree and a gamma correction value , where , the value of a pixel is first normalized and gamma corrected

. The final value of the pixel is then linearly interpolated,

. Fig. 4(e) shows an example, where .

(a) Original Image
(b) Our Approach
(c) Reference Technique [9]
Figure 5: Florala dataset. The (a) original, (b) cleaned by a combination of denoised, contrast enhancement, and gamma correction, is compared to (c) a reference image from [9]. A persistence (left) and persistence-volume (right) diagram is shown for each.

Interface. The interface for selecting the editing mode and scale is shown in Fig. 3(b). The interface designed represents how a chosen function modifies the persistence of the feature (horizontally) and the birth and death of a feature (vertically). For example, contrast enhancement increases persistence, while denoising decreases it. Brightness enhancement modified both the birth and death of a feature, leaving persistence unchanged. Finally, gamma correction changes nothing about the birth, death, or persistence. To use this interface, the user simply selects the button (i.e., the arrow or the circle) for the edit type they prefer. Finally, the level of the transfer function is selected using a slider.

Topology Preservation. It is important to note that many of these edits will ultimately modify the local topology (i.e., within a subtree) and/or global topology (i.e., entire contour tree) of the image. Contrast enhancement and denoising change the persistence of local topology, and they can change feature pairs in the global context. Brightness enhancement makes no modification of the local topology, but significant changes can occur in the global topology (e.g., creation of new features, changes in persistence, etc.). Finally, gamma correction can modify the persistence of local topology, but it will have no effect on the global topology. To handle these cases, as part of the normal process of image editing, the contour trees are recalculated after an edit is applied to the image.

(a) Original Image
(b) Reference Image [9]
(c) Midpoint Enhancement
(d) Final Enhancement
Figure 6: Brain dataset cleaned using a combination of all 4 functions. Each image include its persistence diagram (top) and persistence-volume diagram (bottom).

4 Examples

We have implemented a prototypes of our approach using Java. Images were generated using a 2017 MacBook Pro. All aspects of our approach are interactive, except the construction of the contour trees and extraction of feature pair subtrees, which took between 5 and 30 seconds, depending upon the size and complexity of the image. Before considering the quality of an enhancement, context, such as how the image will be utilized, needs to be taken into account. We do not consider this context in our analysis, and instead only provide examples enhancements.

Synthetic Example. Our synthetic example, based upon the selection of the feature from Fig. 3(b), has the operations outlined in Fig. 4 applied: contrast enhancement (Fig. 4(g)), denoising (Fig. 4(h)), brightness enhancement (Fig. 4(i)), and gamma correction (Fig. 4(j)).

4.1 Grayscale Images

Since contour trees operate on a single channel, grayscale images are a natural way to demonstrate this functionality. For the following datasets, the brightness channel of the HSB colorspace was used for editing.

The Florala dataset, seen in Fig. 5(a), is a photograph of Florala Alabama, retrieved from [9]. The photograph had a series of denoising, contrast enhancement, and gamma correction steps applied to recover the final image in Fig. 5(b). The persistence and persistence-volume diagrams are shown for comparison.

The Brain dataset, seen in Fig. 6(a), is a noisy and low contrast MRI scan of a brain, retrieved from [9]. The figure shows a midpoint (Fig. 6(c)) and the final version (Fig. 6(d)) after a combination of 12 contrast, brightness, gamma correction, and denoising steps. The final image removes noise and highlights important features, such as the skull, white matter, and grey matter. The persistence and persistence-volume diagrams are shown for comparison.

The Lenna Grayscale Dataset, seen in Fig. 7 shows a series of 7 edits to a noisy version of the classic Lenna dataset.

(a) Original
(b) Original w/noise
(c) Denoising
(d) Denoising
(e) Denoising
(f) Contrast
(g) Contrast
(h) Denoising
Figure 7: (a/b) Lenna Grayscale. (c-h) Series of denoising and contrast enhancement.
(a) Original Data (b) Reference Method [7] (c) Green Channel (d) Saturation Channel
(e) Brightness Channel
Figure 8: (a) Notre Dame dataset. (b) Reference method [7] is compared to a version modified using (c) the green channel, then (d) saturation, and finally (e) the brightness.

4.2 Color Images

The Notre Dame dataset, retrieved from [7] and shown in Fig. 8(a), is a photo with an underexposed foreground. For this dataset, we first performed a (virtually invisible) brightness enhancement to the green color channel, to make the foliage a green hue (see Fig. 8(c)). Next, we performed a denoising and contrast enhancement to the saturation channel of the HSB colorspace (see Fig. 8(d)). Finally, denoising, gamma correction, and contrast enhancement were applied to the brightness channel of HSB. Persistence and persistence-volume diagram are not shown due to the number of diagrams involved (10 total—2 red, green, blue, saturation, and brightness). This is compared to a reference image (Fig. 8(b)) generated using a high-dynamic range technique (i.e., using significantly more data than our approach).

The Swan dataset, shown in Fig. 9(a) is a photograph of a swan with a mix of light and shadow, retrieved from [7]. We perform a series of enhancements that include denoising of the brightness channel (see Fig. 9(c)); followed by brightness enhancement in the saturation channel (see Fig. 9(d)); and contrast enhancement and gamma correction of the brightness channel (see Fig. 9(e)). This is compared to a reference image (Fig. 9(b)) generated using a high-dynamic range technique.

The Lenna Color Dataset, seen in Fig. 10 shows a series of 11 edits to a noisy version of the classic color Lenna dataset.

(a) Input Image (b) Reference Method [7] (c) Brightness Channel (d) Saturation Channel
(e) Brightness Channel
Figure 9: (a) Swan dataset. (b) Reference method [7] is compared to image enhanced using (c) denoising of brightness, then (d) brightness enhancement of saturation, and finally (e) contrast enhancement and gamma correction of the brightness.

5 Prior Work & Conclusions

We have presented a new approach to image enhancement based upon the topology of an image. Our approach provides a high-level of control to users, while not requiring an extensive number of interactions to achieve desirable results.

Like with most other image enhancement algorithms, artifacts are an important concern. Our approach does not introduce new artifacts, per se, but instead it may emphasize existing image artifacts. For example in Fig. 5, blocking artifacts appear due to lack of detail for generating a smooth result. In Fig. 6, artifacts occur due once again to missing contrast and detail that lead to small differences in intensity ending up emphasized.

Much of the prior work on image enhancement has focused on automated techniques. A number approaches have addressed segmentation. For example, algorithms for edge detection and image segmentation detected “contours” (i.e., edges) in a hierarchical manner for segmentation [1]

. Supervised learning, such as the hierarchical merge trees model in 

[12], are popular in image segmentation. Contrast enhancement has been proposed as an optimization problem that maximizes the average local contrast of an image [13]

. Recently, deep learning has been leveraged to automatically retouch images 

[8]. These approaches provide high quality results, but they offer limited opportunity for tuning the output.

TDA has also been used previously in image processing. The first use of the contour tree on a binary image was [2]. Edge detection and Delaunay triangulation were performed to decompose images into regions indexed by radius of a disk and persistence [11]. Finally, persistence-based segmentation of noisy 2D point clouds have been studied [10]. Our approach in this paper is different from these prior works in that it not only captures the structure of images, but it also enables a variety of methods for manipulating the segmented regions of images.

(a) Original
(b) Orig. w/noise
(c) Denoising x7
(d) Denoising
(e) Contrast
(f) Denoising
(g) Brightness
Figure 10: (a) Lenna Color with noise added. (b-f) A series of denoising, contrast enhancement, and brightness enhancement steps.


This project was supported in part by the National Science Foundation (IIS-1513616 and IIS-1845204).


  • [1] Arbelaez, P., Maire, M., Fowlkes, C., Malik, J.: Contour detection and hierarchical image segmentation. IEEE Trans. Pattern Anal. Mach. Intell. 33(5), 898–916 (2011)
  • [2] Aydogan, D.B., Hyttinen, J.: Binary image representation by contour trees. In: Medical Imaging 2012: Image Processing. vol. 8314, p. 83142X (2012)
  • [3] Boyell, R.L., Ruston, H.: Hybrid techniques for real-time radar simulation. In: Proc. 1963 Fall Joint Comp. Conf. pp. 445–458 (1963)
  • [4] Carr, H., Snoeyink, J., Axen, U.: Computing contour trees in all dimensions. Computational Geometry 24(2), 75–94 (2003)
  • [5] Cohen-Steiner, D., Edelsbrunner, H., Harer, J.: Stability of persistence diagrams. Discrete and Computational Geometry 37(1), 103–120 (2007)
  • [6] Edelsbrunner, H., Letscher, D., Zomorodian, A.J.: Topological persistence and simplification. Discrete and Computational Geometry 28, 511–533 (2002)
  • [7] Fattal, R., Lischinski, D., Werman, M.: Gradient domain high dynamic range compression. ACM transactions on graphics (TOG) 21(3), 249–256 (2002)
  • [8] Hu, Y., He, H., Xu, C., Wang, B., Lin, S.: Exposure: A white-box photo post-processing framework. ACM Transactions on Graphics (TOG) 37(2),  26 (2018)
  • [9] Kervrann, C., Boulanger, J.: Patch-based image denoising. (2019)
  • [10]

    Kurlin, V.: A fast persistence-based segmentation of noisy 2d clouds with provable guarantees. Pattern Recognition Letters

    83, 3 – 12 (2016)
  • [11] Letscher, D., Fritts, J.: Image segmentation using topological persistence. In: Kropatsch, W.G., Kampel, M., Hanbury, A. (eds.) Computer Analysis of Images and Patterns. pp. 587–595 (2007)
  • [12] Liu, T., Seyedhosseini, M., Tasdizen, T.: Image segmentation using hierarchical merge tree. IEEE Transactions on Image Processing 25(10), 4596–4607 (2016)
  • [13] Majumder, A., Irani, S.: Contrast enhancement of images using human contrast sensitivity. In: Applied Perception in Graphics and Visualization. pp. 69–76 (2006)
  • [14]

    Robles, A., Hajij, M., Rosen, P.: The shape of an image - a study of mapper on images. In: International Conference on Computer Vision, Imaging and Computer Graphics Theory and Applications (VISIGRAPP). pp. 339–347 (2018)

  • [15] Rosen, P., Tu, J., Piegl, L.A.: A hybrid solution to parallel calculation of augmented join trees of scalar fields in any dimension. Computer-Aided Design and Applications 15(4), 610–618 (2018)
  • [16] Tu, J., Hajij, M., Rosen, P.: Propagate and pair: A single-pass approach to critical point pairing in reeb graphs. International Symposium on Visual Computing (2019)