{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Playing with Contrast Enhancement, Histogram Equalization\n", "stough 202-\n", "\n", "We've now seen how to improve image contrast through the application of transfer functions like [windowing, power/gamma, log, and others](./enhance_transfer.ipynb). We've also seen how [Histogram Equalization](./enhance_histeq.ipynb) creates an ideal transfer function in some sense--that of leading to a uniform histogram. Use these other demos in order to answer the following questions" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Find an Image\n", "\n", "Find **at least** two reasonably inoffensive images (maybe a little offensive) to test on. One key here is that because we're doing contrast enhancement, you might err on the side of lower-contrast images. You don't have to do every test on both, but it wouldn't be difficult." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Parametric Transfer Functions \n", "\n", "- Use `vis_hists` to **show the histogram of an image**. \n", "- With that visual assistance consider what parametric transfer function (power/gamma, log, exponent) might be helpful in this image's case.\n", "- **Justify your choice** with written description\n", "- **Display the result** of applying the transfer function of choice to the image. \n", "- You can use `vis_pair` to show both the original and the presumeably contrast-enhanced images together.\n", "- **Explain how**, with written description, the figures you generate either do or do not reflect your justification from before. You can even **show a zoomed-in section** that illustrates your contentions." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Alternative Colorspaces\n", "\n", "**Show** the same parametric contrast enhancement as in Part 1, but performed **only on Luminance/Y/Value** dimension after conversion into [Lab](../Color/color_Lab.ipynb)/[YCbCr](../Color/color_YCbCr.ipynb)/[HSV](../Color/color_HSV.ipynb). **Try all three alternative colorspaces and explain your results**. Remember, you'll need to: \n", "\n", "- Convert to the alternative colorspace using the appropriate [skimage.color](https://scikit-image.org/docs/dev/api/skimage.color.html) function.\n", "- Change only the one channel you're working with. Be sure you're not producing out-of-bounds values for the particular colorspace you choose.\n", "- Convert back using the appropriate inverse from `skimage.color`.\n", "\n", "You can use `vis_hists` and/or extend `vis_pair` to show all three together. **Compare and contrast your results**." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Histogram Equalization\n", "\n", "Again you can use `vis_hists`, `vis_pair`, `vis_[rgb,lab,hsv,ybr]_cube` to visualize results.\n", "\n", "- **Histogram-equalize an image and show** the resulting change in the image (as in, \"Before\" and \"After\" with `vis_pair`).\n", "- **Explain how**, with written description, the figures you generate do or do not reflect good contrast enhancement. Are there artifacts in the corrected image that make it not an \"improvement\" in your eyes? \n", "- Try with two alternative colorspaces: **Perform the histogram equalization on only the Luminance/Y/Value** dimension after conversion into [Lab](../Color/color_Lab.ipynb)/[YCbCr](../Color/color_YCbCr.ipynb)/[HSV](../Color/color_HSV.ipynb) space, and **show the results**. \n", "- **Explain your results**." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.10.11" } }, "nbformat": 4, "nbformat_minor": 4 }