Converting images to 1 bit color depth
Posted: 29 Jun 2011, 20:44
I'm currently working on making a dialog which enables users to convert their existing images into RIC sprites (for RICcreator). However converting images to use on the NXT is often a tricky process in my opinion. 1 bit color depth isn't an issue by itself but when it is combined with the small resolutions needed it becomes difficult to keep an acceptable amount of detail.
My normal approach when using GIMP is to start with scaling and cropping the image, then converting the color space into grayscale. The threshold tool is then used to limit it to pure black/white. I normally use the auto button to get a good starting point and then fine tuning it for better results. In the very end, I manually edit some pixels to add detail.
I have created a dialog with this work flow however the issue is that there are several methods to convert to grayscale. They produce similar results yet sometimes completely different. I don't know much about color spaces though
Method 1:Seems to provide rather good results.
Method 2: Desaturate a HSV value. Doesn't look too realistic at times but can be useful? (But since I can't figure out how to calculate it, I have use some of QT color conversion functions which are too slow...)
Method 3:Faster than method 1 but okay results.
(Just found out how GIMP calculates the "grayness" of a color: http://docs.gimp.org/2.6/C/gimp-tool-desaturate.html)
And then I found quite a few variations of method 1 and 3...
What other methods exits? Does anyone have some ideas of which actually are useful for this?
Perhaps I should just drop all those methods and use method 1, but where you can modify the constants which 3 scrollbars? (As far as I understand, this should modify the brightness of each color channel.)
Moving to a completely different approach, edge detection. I have used it in GIMP and with a bit of fiddling ended up with great results (depending on the source image).
Logically thinking it does seem to be the best approach when the available pixels and colors are sparse since it tries to preserve the shapes and not the colors.
However I know absolutely nothing about edge detection and I therefore don't know if there exists any useful algorithms for this. There are several in GIMP, but the issue is that they don't have any settings to modify the result. In particular I would like to control the complexity/amount of edges but again, I don't know if the algorithms can do this.
Of the algorithms in GIMP the best seemed to be laplace as it produces sharp lines. The amount of edges are a bit high, which is great at higher resolutions, but not always optimal with small. (In particular there was an implementation which made non-edges transparent instead of black which made the process much easier...)
What are your experiences with edge detection, do you think it could be useful in this context? If useful, would you like to see this in a program like RICcreator (as an extra method) or would you prefer to use GIMP anyway for this?
Does anyone have some good material about edge detection btw?
My normal approach when using GIMP is to start with scaling and cropping the image, then converting the color space into grayscale. The threshold tool is then used to limit it to pure black/white. I normally use the auto button to get a good starting point and then fine tuning it for better results. In the very end, I manually edit some pixels to add detail.
I have created a dialog with this work flow however the issue is that there are several methods to convert to grayscale. They produce similar results yet sometimes completely different. I don't know much about color spaces though
Method 1:
Code: Select all
sqrt( 0.241*R*R + 0.691*G*G + 0.068*B*B )
Method 2: Desaturate a HSV value. Doesn't look too realistic at times but can be useful? (But since I can't figure out how to calculate it, I have use some of QT color conversion functions which are too slow...)
Method 3:
Code: Select all
(R * 11 + G * 16 + B * 5)/32
(Just found out how GIMP calculates the "grayness" of a color: http://docs.gimp.org/2.6/C/gimp-tool-desaturate.html)
And then I found quite a few variations of method 1 and 3...
What other methods exits? Does anyone have some ideas of which actually are useful for this?
Perhaps I should just drop all those methods and use method 1, but where you can modify the constants which 3 scrollbars? (As far as I understand, this should modify the brightness of each color channel.)
Moving to a completely different approach, edge detection. I have used it in GIMP and with a bit of fiddling ended up with great results (depending on the source image).
Logically thinking it does seem to be the best approach when the available pixels and colors are sparse since it tries to preserve the shapes and not the colors.
However I know absolutely nothing about edge detection and I therefore don't know if there exists any useful algorithms for this. There are several in GIMP, but the issue is that they don't have any settings to modify the result. In particular I would like to control the complexity/amount of edges but again, I don't know if the algorithms can do this.
Of the algorithms in GIMP the best seemed to be laplace as it produces sharp lines. The amount of edges are a bit high, which is great at higher resolutions, but not always optimal with small. (In particular there was an implementation which made non-edges transparent instead of black which made the process much easier...)
What are your experiences with edge detection, do you think it could be useful in this context? If useful, would you like to see this in a program like RICcreator (as an extra method) or would you prefer to use GIMP anyway for this?
Does anyone have some good material about edge detection btw?