Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize simple grayscale image and cool HeatMap thermal map winform in C #

Shulou Source: shulou.com Published: 2022-06-02 06:57:01 10月27日 Update

It is believed that many inexperienced people have no idea about how to realize simple grayscale image and cool HeatMap thermal map winform. Therefore, this paper summarizes the causes and solutions of the problem. Through this article, I hope you can solve this problem.

First, the effect display

Second, randomly generate thermal points

Thermal point class

Class HeatPoint {public int X; public int Y; public byte Intensity; public HeatPoint (int iX, int iY, byte bIntensity) {X = iX; Y = iY; Intensity = bIntensity;}}

Randomly generated thermal points

Privatevoid generateBtn_Click (object sender, EventArgs e) {Random rRand = new Random (); for (int I = 0; I < 500; iTunes +) {int iX = rRand.Next (0800); int iY = rRand.Next (0800); byte iIntense = (byte) rRand.Next (0180); heatPoints.Add (new HeatPoint (iX, iY, iIntense));} UpdateView () Private Bitmap CreateIntensityMask (Bitmap bitmap, List aHeatPoints) {Graphics graphics = Graphics.FromImage (bitmap); graphics.Clear (System.Drawing.Color.White); foreach (HeatPoint point in aHeatPoints) {if (point.Intensity * 30 / 180 = = 0) continue; DrawHeatPoint (graphics, point, point.Intensity * 30 / 180); / / DrawHeatPoint (graphics, point, 15);} return bitmap } / / this method is used to draw actual radial gradient "points" on the drawing surface. This is probably the most important method in the entire project because it can handle drawing points of different sizes and densities. Private void DrawHeatPoint (Graphics graphics, HeatPoint HeatPoint, int radius) {List pointsList = new List (); for (double degrees = 0; degrees)

Tags: Color generation grayscale position image byte intensity method heat simplicity Clipper content radius circumference attributes radial indication more surface problem Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Tech Info OPPO Reno Microsoft MariaDB Linux