Home Web Front-end PS Tutorial Quick implementation of PS tone equalization filter (C# source code).

Quick implementation of PS tone equalization filter (C# source code).

Feb 15, 2017 am 09:59 AM
ps

The tone equalization function of photoshop is usually one of the more commonly used functions in the early stage of photo retouching. It plays a certain role in expanding the contrast of the image and enhancing the visual effect. In many textbooks or articles, this kind of processing is also called gray equalization, histogram equalization, etc. The principle of the algorithm is to count the histogram of the original image, and then re-project the histogram data through the cumulative distribution function, so that the distribution probability of each color level is adjusted in the same direction. The descriptions of this process in the codes I have seen on the Internet or in some textbooks are quite redundant. Either the code is cumbersome and inefficient, or it is too long-winded and very uncomfortable.

Before giving my code, there are some issues that need to be explained. For grayscale images, since there is only one channel, this problem is not obvious. For common 24-bit images, since there are three RGB channels, there is a question of whether each channel is equalized individually or the three channels jointly calculate the histogram, and then use the same The mapping table reflects RGB data. After my testing, in Photoshop, the latter is used.

    for (Y = 0; Y <p></p><p><span style="font-size: 13px; font-family: 宋体;"> The algorithm part is just such a simple twenty-odd lines of code. The code is clear and the execution efficiency is very high. It is common in digital cameras. A photo of 4000*3000 can be processed within 100ms. </span></p><p><span style="font-size: 13px; font-family: 宋体;"> If an image is subjected to hue equalization once, then no pixels should be transformed if hue equalization is performed again. </span></p><p><span style="font-size: 13px; font-family: 宋体;"> Broadly speaking, hue equalization can be seen as a special case of histogram matching, that is, the matched histogram is distributed as a horizontal line. </span></p><p><span style="font-size: 13px; font-family: 宋体;"> The tone equalization in some books corrects each channel separately. It seems that the effect of this processing can easily lead to mismatch in the overall color of the image, such as the classic Lena picture: </span> </p><p><span style="font-size: 13px; font-family: 宋体;"> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/013/8eb48ac53c4b686a55a10d84272a9b1f-0.jpg" class="lazy" alt="Quick implementation of PS tone equalization filter (C# source code)."    style="max-width:90%"  style="max-width:90%" title="Quick implementation of PS tone equalization filter (C# source code)."> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/013/691628f7fd14aed82ce33125aefadd48-1.jpg" class="lazy" alt="Quick implementation of PS tone equalization filter (C# source code)."    style="max-width:90%"  style="max-width:90%" title="Quick implementation of PS tone equalization filter (C# source code)."> <img src="/static/imghw/default1.png" data-src="https://img.php.cn/upload/article/000/000/013/691628f7fd14aed82ce33125aefadd48-2.jpg" class="lazy" alt="Quick implementation of PS tone equalization filter (C# source code)."    style="max-width:90%"  style="max-width:90%" title="Quick implementation of PS tone equalization filter (C# source code)."></span></p><p>#                                                                                             The effect in Lang Rui’s textbook<span style="font-size: 13px; font-family: 宋体;"></span></p>More quick implementations of PS tone equalization filters (C# source code). For related articles, please pay attention to the PHP Chinese website! <p></p> <p></p>
Copy after login
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

ps serial number cs5 permanently free 2020 ps serial number cs5 permanently free 2020 Jul 13, 2023 am 10:06 AM

PS serial numbers cs5 permanent free 2020 include: 1. 1330-1384-7388-4265-2355-8589 (Chinese); 2. 1330-1409-7892-5799-0412-7680 (Chinese); 3. 1330-1616-1993 -8375-9492-6951 (Chinese); 4. 1330-1971-2669-5043-0398-7801 (Chinese), etc.

What to do if ps installation cannot write registry value error 160 What to do if ps installation cannot write registry value error 160 Mar 22, 2023 pm 02:33 PM

Solution to error 160 when ps installation cannot write registry value: 1. Check whether there is 2345 software on the computer, and if so, uninstall the software; 2. Press "Win+R" and enter "Regedit" to open the system registry, and then Find "Photoshop.exe" and delete the Photoshop item.

Introduction to the process of extracting line drawings in PS Introduction to the process of extracting line drawings in PS Apr 01, 2024 pm 12:51 PM

1. Open the software and import a piece of material, as shown in the picture below. 2. Then ctrl+shift+u to remove color. 3. Then press ctrl+J to copy the layer. 4. Then reverse ctrl+I, and then set the layer blending mode to Color Dodge. 5. Click Filter--Others--Minimum. 6. In the pop-up dialog box, set the radius to 2 and click OK. 7. Finally, you can see the line draft extracted.

How to delete selected area in ps How to delete selected area in ps Aug 07, 2023 pm 01:46 PM

Steps to delete the selected area in PS: 1. Open the picture you want to edit; 2. Use the appropriate tool to create a selection; 3. You can use a variety of methods to delete the content in the selection, use the "Delete" key, use the "Healing Brush Tool" , use "Content-Aware Fill", use the "Stamp Tool", etc.; 4. Use tools to repair any obvious traces or defects to make the picture look more natural; 5. After completing editing, click "File" > in the menu bar "Save" to save the editing results.

What should I do if the PS interface font is too small? What should I do if the PS interface font is too small? Dec 01, 2022 am 11:31 AM

How to fix the PS interface font that is too small: 1. Open PS, click the "Edit" button on the top menu bar of PS to expand the editing menu; 2. Click the "Preferences" button in the expanded editing menu, and then click "Interface. .." button; 3. In the interface settings, set the user interface font size to "Large", set the UI scaling to "200%" and save the settings, then restart PS to take effect.

How to automate tasks using PowerShell How to automate tasks using PowerShell Feb 20, 2024 pm 01:51 PM

If you are an IT administrator or technology expert, you must be aware of the importance of automation. Especially for Windows users, Microsoft PowerShell is one of the best automation tools. Microsoft offers a variety of tools for your automation needs, without the need to install third-party applications. This guide will detail how to leverage PowerShell to automate tasks. What is a PowerShell script? If you have experience using PowerShell, you may have used commands to configure your operating system. A script is a collection of these commands in a .ps1 file. .ps1 files contain scripts executed by PowerShell, such as basic Get-Help

Complete list of ps shortcut keys Complete list of ps shortcut keys Mar 11, 2024 pm 04:31 PM

1. Ctrl + N: Create a new document. 2. Ctrl + O: Open a file. 3. Ctrl + S: Save the current file. 4. Ctrl + Shift + S: Save as. 5. Ctrl + W: Close the current document. 6. Ctrl + Q: Exit Photoshop. 7. Ctrl + Z: Undo. 8. Ctrl + Y: Redo. 9. Ctrl + X: Cut the selected content. 10. Ctrl + C: Copy the selected content.

What is the ps curve shortcut key? What is the ps curve shortcut key? Aug 22, 2023 am 10:44 AM

The ps curve shortcut key is Ctrl+M. Other curve shortcut keys: 1. Convert to point control curve, Alt+Shift+Ctrl+T; 2. Automatically align the curve, Alt+Shift+Ctrl+O; 3. Restore the default curve, Ctrl+Alt+Shift+R; 4. Copy the curve, Ctrl+Alt+Shift+C; 5. Paste the curve, Ctrl+Alt+Shift+V; 6. Adjust the curve slope, Shift+up and down arrows; 7. Adjust the curve brightness, Shift+left and right arrows

See all articles