Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
- - - - -

Finding The Rgb Color Of An Image


8 replies to this topic

#1 nirmaldaniel

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 519 posts
  • Gender:Male
  • Location:India
  • Interests:Surfing the Internet !
  • myCENT:53.01

Posted 13 September 2008 - 01:37 PM

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

#2 jlhaslip

    Insert Custom Title Here

  • [MODERATOR]
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,040 posts
  • Gender:Not Telling
  • Location:Linux, DOS and Windows…the good, the bad and the ugly
  • myCENT:81.07
  • Spam Patrol

Posted 13 September 2008 - 03:55 PM

Check this php function http://ca3.php.net/m...magecolorat.php
Requires the GD Library, which is fairly standard for a PHP installation.
User Notes at that link include some scripts.

#3 nirmaldaniel

    Privileged Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 519 posts
  • Gender:Male
  • Location:India
  • Interests:Surfing the Internet !
  • myCENT:53.01

Posted 16 September 2008 - 07:38 AM

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.

#4 bluedragon

    Super Member

  • Kontributors
  • PipPipPipPipPipPipPipPipPip
  • 384 posts
  • Gender:Male
  • Location:Jupiter
  • myCENT:26.63

Posted 18 September 2008 - 03:09 PM

You can also do that in C++ using CImg library..

#5 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 08 October 2008 - 06:46 AM

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

#6 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 13 December 2008 - 02:42 PM

!!!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



#7 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 07 January 2009 - 01:40 PM

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

#8 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 02 December 2009 - 07:57 AM

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



#9 nooc9

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 31 posts

Posted 08 December 2009 - 08:52 AM

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, 08 December 2009 - 08:53 AM.





Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users