Click here to Skip to main content
15,906,574 members
Home / Discussions / C#
   

C#

 
GeneralRe: Reading web page Pin
memk123-Nov-10 1:25
memk123-Nov-10 1:25 
GeneralRe: Reading web page Pin
Eddy Vluggen23-Nov-10 1:48
professionalEddy Vluggen23-Nov-10 1:48 
AnswerRe: Reading web page Pin
fjdiewornncalwe23-Nov-10 1:33
professionalfjdiewornncalwe23-Nov-10 1:33 
GeneralRe: Reading web page Pin
memk123-Nov-10 22:14
memk123-Nov-10 22:14 
QuestionC# and VSS Pin
Zeyad Jalil22-Nov-10 21:15
professionalZeyad Jalil22-Nov-10 21:15 
AnswerRe: C# and VSS Pin
Pete O'Hanlon22-Nov-10 22:41
mvePete O'Hanlon22-Nov-10 22:41 
AnswerRe: C# and VSS Pin
PIEBALDconsult23-Nov-10 2:34
mvePIEBALDconsult23-Nov-10 2:34 
QuestionDisable "close box (X button)" on child forms Pin
peropata22-Nov-10 20:53
peropata22-Nov-10 20:53 
AnswerRe: Disable "close box (X button)" on child forms Pin
JF201522-Nov-10 21:05
JF201522-Nov-10 21:05 
GeneralRe: Disable "close box (X button)" on child forms Pin
peropata22-Nov-10 21:51
peropata22-Nov-10 21:51 
GeneralRe: Disable "close box (X button)" on child forms Pin
JF201522-Nov-10 22:13
JF201522-Nov-10 22:13 
GeneralRe: Disable "close box (X button)" on child forms Pin
peropata22-Nov-10 22:36
peropata22-Nov-10 22:36 
GeneralRe: Disable "close box (X button)" on child forms Pin
_Erik_23-Nov-10 4:25
_Erik_23-Nov-10 4:25 
AnswerRe: Disable "close box (X button)" on child forms Pin
OriginalGriff23-Nov-10 3:03
mveOriginalGriff23-Nov-10 3:03 
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 

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.