在灰度png图像中存储较大值的影响是什么? [英] What is the effect of storing a larger value in a grayscale png image?

查看:242
本文介绍了在灰度png图像中存储较大值的影响是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在java中块大小为8X8的图像上执行DCT。在第一个块上执行DCT后,我得到第一个值为372。
在整个图像上执行DCT后,我将值写入PNG灰度图像。图像内的值自动更改。
灰度图像不会存储大于255的值。大于255的值会发生什么(例如,372)?

I am trying to perform the DCT on an image with block size 8X8 in java. After performing DCT on the first block, I get the very first value as "372". After performing the DCT on the entire image, I wrote the values into a PNG-grayscale image.Values inside the image automatically changed. The grayscale image will not store the value greater than 255. What will happen to the value which is greater than 255 (for eg., 372) ?

推荐答案

您在丢失信息后无法获取原始图像,因此您需要:

you can not get to original image after loss of information so you need to:


  1. 执行DCT或者什么

  2. 找到 min,max 整个图像中的值

  3. 更改范围所以任何 pixel(x,y)=(255 *(pixel(x,y)-min))/(max-min)


    • +/- 1 或一些如果要夹到合适的范围

  1. perform DCT or what ever
  2. find min,max values from whole image
  3. change range so any pixel(x,y)=(255*(pixel(x,y)-min))/(max-min)
    • +/-1 or some if to clamp to the right range

在此之后你会失去绝对值,但相对变化仍然存在

After this you lose absolute values but the relative changes stays there


  • 出于某些目的就够了

  • 如果你需要恢复原始图像

  • 那么你需要将最小值,最大值编码为 png 某处

  • 所以添加虚拟扫描线并编码 min,max 进入前几个像素......

  • for some purposes is this enough
  • if you need to restore the original image
  • then you need to encode min,max values to the png somewhere
  • so add a dummy scanline(s) and encode min,max into first few pixels ...

恢复很简单:


  1. 读取 png 图像

  2. 解码最小值,最大值

  3. 恢复原始动态范围像素(x,y)= min +((( max-min)* pixel(x,y))/ 255)


    • +/- 1 或一些如果要限制在合适的范围

  1. read png image
  2. decode min,max
  3. restore original dynamic range pixel(x,y)=min+(((max-min)*pixel(x,y))/255)
    • +/-1 or some if to clamp to the right range

这篇关于在灰度png图像中存储较大值的影响是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆