hi, i want to convert a color image into a greyscale image. after loading the color image, i have to count pixel by pixel to get the frequency of the color (0-255) to be placed in an array. can anyone help me how to count the frequency? thx in advance.
methmignonne
0
Newbie Poster
Recommended Answers
Jump to Postby "frequency of the colour" do you mean count how many pixels are, for example red (255,0,0) or some other specified color (230,126,72 for example)? What do you mean when you say "to be placed in an array"? (an array of every colour and their frequencies would be 256^3 (i …
Jump to Post:/
I really have no idea how you got a grayscale image from the frequencies of the colours... To get Grayscale image I would:
grayPixel[x,y] = (1/3)*getPixelRed(x,y) + (1/3)*getPixelGreen(x,y) + (1/3)*getPixelBlue(x,y);
where getPixelRed etc is the Red value of the pixel at x,y. (it doesnt have to …
Jump to PostYou are trying to make a histogram like this this? to find the threshold? Is that what the above code is trying to do (and is this the code that doesnt work?)
…
All 12 Replies
hanvyj
7
Posting Whiz in Training
methmignonne
0
Newbie Poster
hanvyj
7
Posting Whiz in Training
methmignonne
0
Newbie Poster
hanvyj
7
Posting Whiz in Training
methmignonne
0
Newbie Poster
hanvyj
7
Posting Whiz in Training
methmignonne
0
Newbie Poster
hanvyj
7
Posting Whiz in Training
JamesCherrill
4,733
Most Valuable Poster
Team Colleague
Featured Poster
methmignonne
0
Newbie Poster
methmignonne
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.