开发者

Need to calculate the Value of a pixel [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have a RGBA values, R - 255, G - 103, B - 103, Alpha - 103.

Need combination of the (RGB) color value. Example - 26532.(combination of colour value/Pixel value)

Description - Image is made of pixels, each pixel has combination of colors(like - RGB). Need to calculate the mean of the image and we need to have the unique value of the pixel. Each pixel has 4 colour values but need the pixel value( combination of colo开发者_Python百科ur values)


You can use BitConverter to convert the RGBA bytes to a single int value:

        byte[] components = new byte[4];
        components[0] = 103;        // blue
        components[1] = 103;        // green
        components[2] = 255;        // red
        components[3] = 103;        // alpha

        int pixelValue = BitConverter.ToInt32(components, 0);


You should be able to do a loop through every pixel, and calculate the pixel value on the fly if you know the pixel color values.

Relevant questions:

How can I iterate through each pixel in a .gif image in C#?

How to calculate the average rgb color values of a bitmap


int value = Color.FromArgb(103, 103, 255, 103).ToArgb()
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜