Jump to content
  • Advertisement
Sign in to follow this  
Nikster

Decoding grayscale intensities

This topic is 2640 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all, I'm currently having a brain fart and hope you nice people could perhaps point me in the right direction, be it an algorithm or terminology to help me search what I'm looking for.

Imagine a 2d gray scaled image with values 0 -> 1 which are the coverage values, I want to translate this to a 2d positional grid, this is simple enough for full coverage values as they would be *= grid size.
I'm having trouble in working with <1 coverage values and how they should translate to 2d positional values, in my particular case the <1 values relate to sub-pixel anti-aliasing so I need to convert these back to some approximate values.

Hopefully this makes sense.

Regards,

N.

Share this post


Link to post
Share on other sites
Advertisement
Do you need to determine which sub-pixel samples correspond to the non-zero portion of your coverage values? If so, you will need to do some analysis of the neighbors of each pixel, probably similar in nature to what is done for MLAA.

What exactly do you need to do with the coverage values???

Share this post


Link to post
Share on other sites
For coverage all samples are originally 0 or 1. How subpixel samples are used to create the final value for a pixel depends on the antialiasing method. With standard MSAA, a box filter is used to combine samples which weights them all instantly. So if you had 4 MSAA samples 1 passed sample would result in a value of 0.25, 2 would result in 0.5. Other filter types will weight subsamples differently based on their position within the pixel, and might even factor in subsamples from neighboring pixels. At any rate, you're not going to have enough information from just the resolved pixel value to determine the original values of subsamples, except for in a few trivial cases.

Share this post


Link to post
Share on other sites
Cheers guys, the application I'm using it with is getting the alpha channel data from an image, how the anti-aliasing is computed is unknown to me, I then use this data for use with the dead reckoning distance transform which uses source-destination 2d points to get the distance, this works well for binary images but for certain effects, outlining for example, the none full coverages need to be taken into account (for good results at least)

I've already tried using pixels t,b,l,r of the current pixel with some success but obviously it's a flawed hack which didn't quite work, however, depending on how much analysis I'd need to do for each none full coverage, might outdo the speed gains using dead reckoning.

Some paper on how Photoshop does it would be the holy grail for me. ;)

Share this post


Link to post
Share on other sites
Ok thanks guys I've managed to parp my brain fart and all is clear, the solution is to use sobel, well, I'm playing around with different kernels to improve accuracy, but it's a job done.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!