![]() |
|
Texture resampling techniques? [Calling Bob!] |
Chris Katko
Member #1,881
January 2002
![]() |
Anyone know of any texture resampling techniques that will take, for example, a bilinear filtered texture and restore it back to it's source image? Before you go "filtering is inherently a lossy operation and cannot be reversed," I would like to say that while I don't expect 100%, I do believe it possible to reverse the affect somewhat, or approximate the process by adding in "new" data that fakes the eye into believing it to be more accurate. It's clear with 2xSai, HQR and so on of pixel image scaling filters that it's possible to introduce appreciable quality when starting with some assumptions of the source material: {"name":"HQx-xBRZ-comparison.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a857d47b6a8f31f0729c089ef887167a.png","w":665,"h":580,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/a\/8\/a857d47b6a8f31f0729c089ef887167a"} But these are working on a different level that I'm asking... I think. So, for example, given this image: {"name":"7051-texture_sampling_issue.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/a\/9a2ba20a4ee66fad215b10b98a490d81.png","w":801,"h":412,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/9\/a\/9a2ba20a4ee66fad215b10b98a490d81"} We can tell that the left image has been bilinearly interpolated from the right image. I'm wondering if it's possible to reverse the process either automatically, or through hinting "I know it was bilinearly filtered." This is but one case, however. Given that the first example is what we would call "pixel art" let us consider the other end of art, photo-realistic: {"name":"filterings.png","src":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/3\/630cce193fa2d806c3e4739f892dd458.png","w":650,"h":292,"tn":"\/\/djungxnpq2nug.cloudfront.net\/image\/cache\/6\/3\/630cce193fa2d806c3e4739f892dd458"} I wonder how difficult it would be to reverse the process of filtering of textures "shrunken" from their source material (in file format, that is, before ever processed by the rendering pipeline). Whether by pattern recognition, or injecting noise and filtering the result. Anyone have any experience in the area? Any keywords to look for? -----sig: |
SiegeLord
Member #7,827
October 2006
![]() |
These local filters are probably easily reversed through some mathematical manipulation. In particular, reversing bilinear interpolation in principle requires solving a simple set of linear equations if you know the scaling factor and offset: for each 4 source pixels, you collect at least 4 destination pixels and solve. EDIT: A more general approach (also assuming you know the offset and scale) would be to do a greedy search pixel-by-pixel in the source image. The algorithm would be something like that: 1source_image = init_source_pixels(filtered_image) // Make an initial guess, e.g. by downsampling the filtered image
2
3test_image = filter(source_image) // filter the guess using the filter
4
5error = compute_error(test_image, filtered_image) // compute the reconstruction error
6changed = true
7
8while changed
9 changed = false
10 foreach pixel in source_image
11 foreach component in pixel
12 loop
13 old_component = component
14 component++
15 new_error = compute_error(test_image, filtered_image)
16 if new_error < error
17 error = new_error
18 changed = true
19 else
20 component = old_component
21 break
22 loop
23 old_component = component
24 component--
25 new_error = compute_error(test_image, filtered_image)
26 if new_error < error
27 error = new_error
28 changed = true
29 else
30 component = old_component
31 break
"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18 |
|