Statistics.cs
(开头部分) 4KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;
using System.Drawing.Imaging;
using System.Collections;
using System.Runtime.InteropServices;
using System.Windows.Forms;
using System.Diagnostics;
namespace ColorStatistics
{
static unsafe class Statistics
{
//'*****************************************************************************************
//'** 开发日期 : 2013-6-21
//'** 作 者 : laviewpbt
//'** 联系方式: 33184777
//'** 修改日期 : 2013-6-21
//'** 版 本 : Version 1.1.1
//'** 转载请不要删除以上信息
//'****************************************************************************************
[StructLayout(LayoutKind.Sequential)]
public struct MajorColor : IComparable<MajorColor>
{
internal int Color;
internal int Amount;
public MajorColor(int Color, int Amount)
{
this.Color = Color;
this.Amount = Amount;
}
public int CompareTo(MajorColor obj)
{
return this.Amount.CompareTo(obj.Amount);
}
}
// http://www.coolphptools.com/color_extract
// http://www.wookmark.com/image/268753/30-inspiring-examples-of-levitation-photography-inspirationfeed-com
public static List<MajorColor> PrincipalColorAnalysis(Bitmap Bmp, int PCAAmount, int Delta = 24)
{
List<MajorColor> MC = new List<MajorColor>();
int X, Y, Width, Height, Stride, Index, TotalColorAmount = 0;
int HalfDelta;
byte* Pointer, Scan0;
BitmapData BmpData = Bmp.LockBits(new Rectangle(0, 0, Bmp.Width, Bmp.Height), ImageLockMode.ReadWrite, PixelFormat.Format24bppRgb);
Height = Bmp.Height; Width = Bmp.Width; Stride = BmpData.Stride; Scan0 = (byte*)BmpData.Scan0;
int[] Table = new int[256 * 256 * 256];
int[] NonZero = new int[Width * Height];
int[] Map = new int[256];
if (Delta > 2)
HalfDelta = Delta / 2 - 1;
else
后面还有 39 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。