Click here to Skip to main content
15,895,667 members
Home / Discussions / C#
   

C#

 
QuestionCustom Pop UP windows Pin
Anil Kumar.Arvapalli22-Nov-10 19:31
Anil Kumar.Arvapalli22-Nov-10 19:31 
AnswerRe: Custom Pop UP windows Pin
Mycroft Holmes22-Nov-10 20:22
professionalMycroft Holmes22-Nov-10 20:22 
GeneralRe: Custom Pop UP windows Pin
Anil Kumar.Arvapalli22-Nov-10 22:31
Anil Kumar.Arvapalli22-Nov-10 22:31 
AnswerRe: Custom Pop UP windows Pin
JF201522-Nov-10 22:47
JF201522-Nov-10 22:47 
QuestionMain Colors of an image Pin
pancakeleh22-Nov-10 18:55
pancakeleh22-Nov-10 18:55 
AnswerRe: Main Colors of an image Pin
JF201522-Nov-10 19:17
JF201522-Nov-10 19:17 
GeneralRe: Main Colors of an image [modified] Pin
pancakeleh22-Nov-10 19:26
pancakeleh22-Nov-10 19:26 
AnswerRe: Main Colors of an image Pin
Bernhard Hiller22-Nov-10 23:46
Bernhard Hiller22-Nov-10 23:46 
While JF2015 suggest to predefine colors and their RGB ranges, I think the main color(s) could be anywhere in the RGB range - hence predefined ranges do not help.
Beyond counting the occurrences of every color, I would add a weighted amount for pixels whose color is "similar" to the color in question.

My suggestion for getting the main colors is hence a very slow one - you will need a specialist for fast algorithms to get it optimized!

- define how far the second (third etc.) color must be away from the main color
- create an array of doubles for all RGB values (oh yes, some 16 million)....
- iterate through all the pixels of the image:
- - add 1.0 at the array position of the pixel's color
- - for the array positions of "similar" colors, add the weighted amount, e.g. 1.0/(1.0+delta R)/(1.0+delta G)/(1.0+delta B) (ehm, that's another nested loop(s)...)
- now iterate through your array of RGB values, and select the highest value (you may sort the array): this is the main color.
- take the RGB value with the next highest value
- - if it is "close" to the main color, repeat the step above
- - otherwise, it is the second color.
- with third (forth etc) color, do as outlined for the second color, but do not forget that it must be sufficiently away from all previously selected colors.

When you test this "naive" algorithm with your example image, bear in mind that it is not at all optimized, and surely terribly slow! Better test with a very small image first.
Questionhacking of yahoo Pin
inayathussaintoori22-Nov-10 15:16
inayathussaintoori22-Nov-10 15:16 
JokeRe: hacking of yahoo Pin
Luc Pattyn22-Nov-10 15:47
sitebuilderLuc Pattyn22-Nov-10 15:47 
AnswerRe: hacking of yahoo Pin
Mycroft Holmes22-Nov-10 18:55
professionalMycroft Holmes22-Nov-10 18:55 
AnswerRe: hacking of yahoo Pin
Pete O'Hanlon22-Nov-10 22:43
mvePete O'Hanlon22-Nov-10 22:43 
JokeRe: hacking of yahoo Pin
Bernhard Hiller22-Nov-10 23:00
Bernhard Hiller22-Nov-10 23:00 
GeneralRe: hacking of yahoo Pin
fjdiewornncalwe23-Nov-10 1:39
professionalfjdiewornncalwe23-Nov-10 1:39 
AnswerRe: hacking of yahoo Pin
Dave Kreskowiak23-Nov-10 2:06
mveDave Kreskowiak23-Nov-10 2:06 
AnswerRe: hacking of yahoo Pin
CPallini23-Nov-10 3:24
mveCPallini23-Nov-10 3:24 
JokeRe: hacking of yahoo Pin
_Erik_23-Nov-10 4:31
_Erik_23-Nov-10 4:31 
AnswerRe: hacking of yahoo Pin
RaviRanjanKr24-Nov-10 6:42
professionalRaviRanjanKr24-Nov-10 6:42 
QuestionHow to convert string to an int with operators? [modified] Pin
venomation22-Nov-10 12:14
venomation22-Nov-10 12:14 
AnswerRe: How to convert string to an int with operators? Pin
PIEBALDconsult22-Nov-10 15:50
mvePIEBALDconsult22-Nov-10 15:50 
GeneralRe: How to convert string to an int with operators? Pin
venomation22-Nov-10 23:52
venomation22-Nov-10 23:52 
AnswerRe: How to convert string to an int with operators? [modified] Pin
Luc Pattyn22-Nov-10 16:03
sitebuilderLuc Pattyn22-Nov-10 16:03 
GeneralRe: How to convert string to an int with operators? Pin
venomation22-Nov-10 23:54
venomation22-Nov-10 23:54 
AnswerRe: How to convert string to an int with operators? Pin
Luc Pattyn23-Nov-10 4:54
sitebuilderLuc Pattyn23-Nov-10 4:54 
QuestionNewbi Label question Pin
vegetable99922-Nov-10 9:34
vegetable99922-Nov-10 9:34 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.