www.GetXFactor.com

Leading Technology, Science,
Agriculture News and information


Part of the Identityscape.com network...

getxfactor.com jmoodmusic.com smartbusinesschoices.com mintdepot.com lowfaresalways.com evangelicalview.com shoppingpodder.com soproudlywehail.com webnews.ws currenthumor.com

 

 

Dithering using windows palette (16 colors)
Goto page 1, 2  Next
   Science and Technology news... Forum Index -> Image Processing Forum  
View previous topic :: View next topic  
Author Message
4N
Guest






PostPosted: Fri Oct 03, 2008 9:52 pm    Post subject: Dithering using windows palette (16 colors) Reply with quote

Hi,

I>m trying to enhance my code for ordered dithering because my
code picks, in relatively large areas, almost always the grays in
the 16 colors palette of windows.
I can>t seem to find a simple and effective solution to loss of color,
that>s why I>m trying to discuss this with other people.
I hope someone can give me a good hint.

Thanks in advance.
Back to top
toby
Guest






PostPosted: Mon Oct 06, 2008 3:24 am    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

On Oct 3, 12:52 pm, "4N" <x...@yyy.com> wrote:
[quote]Hi,

I>m trying to enhance my code for ordered dithering because my
code picks, in relatively large areas, almost always the grays in
the 16 colors palette of windows.
I can>t seem to find a simple and effective solution to loss of color,
that>s why I>m trying to discuss this with other people.
I hope someone can give me a good hint.

Thanks in advance.
[/quote]
Methods that work well with somewhat higher bit depths are well
studied. One particularly effective algorithm is this one:

http://members.ozemail.com.au/~dekker/NEUQUANT.HTML

In the FAQ on that page you can see suggestions that might work for 16
colours.

Also see:
http://en.wikipedia.org/wiki/Color_quantization
http://web.cs.wpi.edu/~matt/courses/cs563/talks/color_quant/CQindex.html
Back to top
4N
Guest






PostPosted: Mon Oct 06, 2008 9:38 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

"toby" <toby@telegraphics.com.au> ha scritto nel messaggio
news:3659ca8b-a160-4900-9803-f03ce5c0f794@d1g2000hsg.googlegroups.com...
[quote]Methods that work well with somewhat higher bit depths are well
studied. One particularly effective algorithm is this one:
http://members.ozemail.com.au/~dekker/NEUQUANT.HTML
In the FAQ on that page you can see suggestions that might work for 16
colours.
Also see:
http://en.wikipedia.org/wiki/Color_quantization
http://web.cs.wpi.edu/~matt/courses/cs563/talks/color_quant/CQindex.html
[/quote]
Thanks for your reply, but my problem isn>t the quantization, in fact the
palette is fixed and it is the 16-colors palette of windows.
Using the euclidean metric with that palette, the grays in the palette are
picked pretty often resulting in relatively larges gray zones.
I tried Riemersma metric and it doesn>t help, and honestly I>m short on
option if I want to keep good performaces...
Back to top
Martin Leese
Guest






PostPosted: Tue Oct 07, 2008 4:09 am    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

4N wrote:
[quote]Hi,

I>m trying to enhance my code for ordered dithering because my
code picks, in relatively large areas, almost always the grays in
the 16 colors palette of windows.
[/quote]
If you mix a set of random colours then the
result will be something like a shade a grey.
Have you considered that your algorithm, in
relatively large areas, might actually be
doing what you want it to do?

--
Regards,
Martin Leese
E-mail: please@see.Web.for.e-mail.INVALID
Web: http://members.tripod.com/martin_leese/
Back to top
bugbear
Guest






PostPosted: Tue Oct 07, 2008 2:23 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

4N wrote:
[quote]Hi,

I>m trying to enhance my code for ordered dithering because my
code picks, in relatively large areas, almost always the grays in
the 16 colors palette of windows.
I can>t seem to find a simple and effective solution to loss of color,
that>s why I>m trying to discuss this with other people.
I hope someone can give me a good hint.
[/quote]
As a simple test, try using your code on a LARGE
picture, then convert your image to RGB, and smooth/subsample
it.

Then compare the result with a similarly subsampled original.

The original image needs to be large enough that the subsampling
can be around 8 or more.

If your code is working correctly, the two images should
be similar.

If they>re not, you have a bug.

BugBear
Back to top
4N
Guest






PostPosted: Tue Oct 07, 2008 7:18 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

"Martin Leese" <please@see.Web.for.e-mail.INVALID> ha scritto nel messaggio
news:gUwGk.18$%%2.11@edtnps82...
[quote]4N wrote:
Hi,
If you mix a set of random colours then the
result will be something like a shade a grey.
Have you considered that your algorithm, in
relatively large areas, might actually be
doing what you want it to do?
[/quote]
Well, it happens eg on the skin of a face and such an area shouldn>t be
gray.
Obviously the diffusion of the error isn>t enough to reach the colors stored
inside the palette and I think that one of the causes may be that the
errors, negative and positive, cancel each other so they don>t have the time
to pile up enough.
Back to top
4N
Guest






PostPosted: Tue Oct 07, 2008 7:37 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:cJ6dnfnyCc0Vt3bVnZ2dnUVZ8s3inZ2d@posted.plusnet...
[quote]As a simple test, try using your code on a LARGE
picture, then convert your image to RGB, and smooth/subsample
it.
Then compare the result with a similarly subsampled original.
The original image needs to be large enough that the subsampling
can be around 8 or more.
If your code is working correctly, the two images should
be similar.
[/quote]
I hope I got it right.
I reduced an image to 10% than I scaled it up again to its original size.
The dithering resulted similar on both the original and the smoothed image.
Back to top
bugbear
Guest






PostPosted: Wed Oct 08, 2008 2:43 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

4N wrote:
[quote]"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:cJ6dnfnyCc0Vt3bVnZ2dnUVZ8s3inZ2d@posted.plusnet...
As a simple test, try using your code on a LARGE
picture, then convert your image to RGB, and smooth/subsample
it.
Then compare the result with a similarly subsampled original.
The original image needs to be large enough that the subsampling
can be around 8 or more.
If your code is working correctly, the two images should
be similar.

I hope I got it right.
I reduced an image to 10% than I scaled it up again to its original size.
The dithering resulted similar on both the original and the smoothed image.
[/quote]
That>s not what I suggested.

I suggested:

case (A) dither a large image, sub sample by (e.g.) 8
case (B) subsample the same large image by (e.g.) 8

compare the result of (A) and (B).

BugBear
Back to top
4N
Guest






PostPosted: Wed Oct 08, 2008 10:36 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:zamdnQU7iIBHHXHVnZ2dnUVZ8t7inZ2d@posted.plusnet...
[quote]4N wrote:
"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:cJ6dnfnyCc0Vt3bVnZ2dnUVZ8s3inZ2d@posted.plusnet...
I suggested:
case (A) dither a large image, sub sample by (e.g.) 8
case (B) subsample the same large image by (e.g.) 8
compare the result of (A) and (B).
[/quote]
well, obviously there is some desaturated area...
but my code is organized so that only the generator of the palette changes,
so actually the code of the dithering is the same and only the content of
the palette is changed (its colors).
When I use median cut everything is fine, the problems arise only when I
fill the palette with the colors of the windows palette.
Anyway this happens in other programs too.
Back to top
bugbear
Guest






PostPosted: Thu Oct 09, 2008 1:46 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

4N wrote:
[quote]"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:zamdnQU7iIBHHXHVnZ2dnUVZ8t7inZ2d@posted.plusnet...
4N wrote:
"bugbear" <bugbear@trim_papermule.co.uk_trim> ha scritto nel messaggio
news:cJ6dnfnyCc0Vt3bVnZ2dnUVZ8s3inZ2d@posted.plusnet...
I suggested:
case (A) dither a large image, sub sample by (e.g.) 8
case (B) subsample the same large image by (e.g.) 8
compare the result of (A) and (B).

well, obviously there is some desaturated area...
but my code is organized so that only the generator of the palette changes,
so actually the code of the dithering is the same and only the content of
the palette is changed (its colors).
When I use median cut everything is fine, the problems arise only when I
fill the palette with the colors of the windows palette.
[/quote]
Over a sufficiently large area (the point of my subsampling in the check
I propose) any accurate implementation of error diffusion dithering should work,
as long as the pallette has examples of the color space extremes.

Obviously (?) if the pallette doesn>t contain (e.g.) a fully saturated
blue, a fully saturated blue input cannot be handled.

BugBear
Back to top
4N
Guest






PostPosted: Thu Oct 09, 2008 6:49 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

"bugbear" <bugbear@trim_papermule.co.uk_trim> wrote:
[quote]Over a sufficiently large area (the point of my subsampling in the check
I propose) any accurate implementation of error diffusion dithering should
work,
as long as the pallette has examples of the color space extremes.
[/quote]
It>s obvious, that>s why I previously misinterpreted what you wrote.

[quote]Obviously (?) if the pallette doesn>t contain (e.g.) a fully saturated
blue, a fully saturated blue input cannot be handled.
[/quote]
Palette:

255 255 255
0 255 255
255 0 255
255 255 0
0 0 255
0 255 0
255 0 0
0 0 0
128 128 128
0 128 128
128 0 128
128 128 0
0 0 128
0 128 0
128 0 0
192 192 192

as you can see it contains the fully saturated r,g and b components:
0 0 255
0 255 0
255 0 0
Back to top
toby
Guest






PostPosted: Sat Oct 11, 2008 10:52 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

On Oct 6, 12:38 pm, "4N" <x...@yyy.com> wrote:
[quote]... the
palette is fixed and it is the 16-colors palette of windows.
Using the euclidean metric with that palette, the grays in the palette are
picked pretty often resulting in relatively larges gray zones.
[/quote]
It seems that the problem is somewhat subjective, and I>m not sure
what kind of solution you>re looking for, but as simple workarounds
you could try weighting the picks away from greys, e.g. using
probabilistic rejection. Did you try just increasing saturation of the
source image?

[quote]I tried Riemersma metric and it doesn>t help, and honestly I>m short on
option if I want to keep good performaces...[/quote]
Back to top
toby
Guest






PostPosted: Sun Oct 12, 2008 6:44 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

On Oct 12, 1:56 pm, "4N" <x...@yyy.com> wrote:
[quote]It seems that the problem is somewhat subjective, and I>m not sure
what kind of solution you>re looking for, but as simple workarounds
you could try weighting the picks away from greys, e.g. using
probabilistic rejection.

deterministic rejection works except with this palette.
I wonder how to code a probabilistic rejection...
[/quote]
I was thinking that your colour matching function (you>re using
closest Euclidean?) could ignore greys with a certain probability (or
a variable probability). Obviously the resulting increased numerical
error would feed back into the diffusion algorithm. My hunch is that
this will lead error diffusion to balance with a more saturated
complementary colour. In any case, it should result in fewer grey
pixels in the output. I>d be interested to hear about the results.

[quote]
Did you try just increasing saturation of the
source image?

yes, the whole image is affected => not good.[/quote]
Back to top
4N
Guest






PostPosted: Sun Oct 12, 2008 10:56 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

[quote]It seems that the problem is somewhat subjective, and I>m not sure
what kind of solution you>re looking for, but as simple workarounds
you could try weighting the picks away from greys, e.g. using
probabilistic rejection.
[/quote]
deterministic rejection works except with this palette.
I wonder how to code a probabilistic rejection...

[quote]Did you try just increasing saturation of the
source image?
[/quote]
yes, the whole image is affected => not good.
Back to top
toby
Guest






PostPosted: Mon Oct 13, 2008 8:33 pm    Post subject: Re: Dithering using windows palette (16 colors) Reply with quote

On Oct 13, 1:56 pm, "4N" <x...@yyy.com> wrote:
[quote]I was thinking that your colour matching function (you>re using
closest Euclidean?)

yes, I do

could ignore greys with a certain probability (or
a variable probability).

to make a pratical example I could use a gaussian noise generator and to
reject the grays if the value is over 0.5?
[/quote]
Uniform random number, yes.

[quote]Using these parameters the image looks only slightly better, and I think I
have to tweak my code a little, but I introduce too much randomness in the
ordered dithering.
[/quote]
Ordered dithering? You mean error diffusion?

[quote]Btw I>ll upload a couple of images to show you the results later.
[/quote]
Thanks, it would be interesting to compare.
Back to top
Display posts from previous:   
   Science and Technology news... Forum Index -> Image Processing Forum Goto page 1, 2  Next  
Page 1 of 2
All times are GMT

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum