Jump to content
xisto Community
longtimeago

Finding The Rgb Color Of An Image Using any programming language

Recommended Posts

hello friends i am doing a project , in that i am inneed to fine the mean RGB value of a particular image , is there any program in any language which can do this ? the input to the program will be any image ( can be linked in the program) and the putput must be the mean RGB value of that particular image , is this Possible ? If so please post the Coding , no matter in what ever language it may be written.Thanks in Advance

Share this post


Link to post
Share on other sites

Thank you for your help and i have found a solution, the same can be obtained using C# , C# has an inbuilt class known as the Bitmap and with C# i was successfully able to code a program to get the mean RGB color by giving the Image location as input.

Share this post


Link to post
Share on other sites

Please help

Finding The Rgb Color Of An Image

 

Replying to nirmaldaniel

 

Dear Nirmaldaniel,

 

I read your reply on the C++ used for the color detection. If possible

Could be please send me the codes coz I am also looking for similar probelm.

 

Thank you..Please help me

Catherine

 

-question by Catherine

Share this post


Link to post
Share on other sites
!!!HelpFinding The Rgb Color Of An Image

Replying to bluedragon

Dear BrotherI want to take some information about the RGB file.How can I read the RGB file and also tell me how I create the new RGB file in C/ C++.I will thanks to you

-Muhammad Mohsan Shabbir

Share this post


Link to post
Share on other sites
RGB creation and recreation ...Finding The Rgb Color Of An Image

I have below VB program which can segregate the are G B values and the same tries to recreate as the original file.  Recreation is done using C++; if you want you can collect it from me.

  Dim bmpObj As Object   Set bmpObj = CreateObject("jpeg.CJpegImage")   'CALL COMImageSize (Me.ImgJPG.ScaleWidth, Me.ImgJPG.ScaleHeight)   bmpObj.SetFormatSize Me.PicSourceImage.ScaleWidth, Me.PicSourceImage.ScaleHeight   With picSourceImage   For ctrY = 0 To Me.PicSourceImage.ScaleHeight - 1   For ctrX = 0 To Me.PicSourceImage.ScaleWidth - 1   Pixel = GetPixel(.HDC, ctrX, ctrY)   myGRed(ctrX, ctrY) = RgbColor(Pixel).Red   myGGreen(ctrX, ctrY) = RgbColor(Pixel).Green   myGBlue(ctrX, ctrY) = RgbColor(Pixel).Blue   bmpObj.SetJpegImageData myGRed(ctrX, ctrY), myGGreen(ctrX, ctrY), myGBlue(ctrX, ctrY)   Next ctrX   Next ctrY   End With   bmpObj.SaveJpegImage (App.Path & "ProcessedImage" & Left(Me.TxtFileName.Text, InStr(1, Me.TxtFileName.Text, ".") - 1) & ".Jpg")

-reply by Srinivasan

Share this post


Link to post
Share on other sites
conversion of rgb to hsiFinding The Rgb Color Of An Image

Replying to (G)SrinivasanI am doing this project actually showing a movie in opengl but I am using the green screen where I need to convert the rgb of the pictures to hsi in c++ and reverse. Can you help me?

-reply by pugsy

Share this post


Link to post
Share on other sites

As this was posted in C/C++ I feel it should be mentioned that if on windows, there are the windows GDI functions/classes to use and thus, no need for 3rd party libs or .NET.

#include <gdiplus.h>...Bitmap* bm = new Bitmap("image.jpg");...// bm->LockBits() or bm->GetPixel()...delete bm;...

Edited by nooc9 (see edit history)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.