943,816 Members | Top Members by Rank

Ad:
  • C++ Discussion Thread
  • Unsolved
  • Views: 520
  • C++ RSS
Nov 11th, 2008
0

quantisation of image colours

Expand Post »
hi i have an image which i can get RGB values, i have to quantitize it , a new to this i think i know the principle but need a few pointers as to how to go about "mapping" the image to a range of colours. basically i am doing a grey scale whic works but on colours not black thru to white it is greying only slightly. so i need to reduce the colour values.
hope someone can help.

regardes

ash
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ashbrenner is offline Offline
4 posts
since Nov 2008
Nov 11th, 2008
0

Re: quantisation of image colours

I think you need to state your problem a little more clearly for us. Are you trying to reduce the number of colors in a color image, or are you trying to convert a color image to greyscale? Or something else?
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007
Nov 11th, 2008
0

Re: quantisation of image colours

hi sorry about late reply, am trying to reduce the colours. i have whittled it down to performing something called a median cut. but unsure as to how to start . ie i need to first section the whole image and then break down the image into clusters of fewer colours. i think i know the principle but unsure of how to section etc..hope this helps explain. basically it works but colours are to many. thnx
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ashbrenner is offline Offline
4 posts
since Nov 2008
Nov 12th, 2008
0

Re: quantisation of image colours

the source image is a fixed palet of eight squares of different colours red, yellow, green orange etc, the code works fine on the black thru to grey and white , but not on the colours.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ashbrenner is offline Offline
4 posts
since Nov 2008
Nov 12th, 2008
1

Re: quantisation of image colours

This is not a trivial algorithm to implement. I'm familiar with it in general terms, and you can find some sample implementations to give you an idea of where to go.

The idea is not to segment the image, but to segment the color values found in it. Then replace the colors at each pixel with the palette color that it maps to in the color segmentations.
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007
Nov 12th, 2008
0

Re: quantisation of image colours

ok..do you mean something like the following.

if RGB values fall into a certain value range.
then make them a pre-defined values.

ie red is R=255, G=0, B=0. so if a pixel in the image has same values +or - a tolerance such as 20, then make that pixel same as red.
Reputation Points: 10
Solved Threads: 0
Newbie Poster
ashbrenner is offline Offline
4 posts
since Nov 2008
Nov 12th, 2008
0

Re: quantisation of image colours

Kind of sort of. The final step would be something like that, but it's a long way to get there.

Here's my understanding of the basis of Median Cut. First find what colors exist in the image, essentially a 3D histogram. Find the plane that divides the unique color triplets in half, making two boxes with equal number of colors. Divide each of those boxes at the plane (not necessarily the same in each box) that cuts the number of colors in each of the now 4 boxes to equal numbers. Keep dividing till you have the number of boxes representing the desired number of colors in the target palette. Find the median color in each box - these will be your palette colors. Then map each color in the image to that median color in the box in which the image color exists.
Reputation Points: 1268
Solved Threads: 228
Posting Virtuoso
vmanes is offline Offline
1,895 posts
since Aug 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in C++ Forum Timeline: Graph help please
Next Thread in C++ Forum Timeline: Need some help for a randomize code





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC