dongzao3923 2012-08-14 15:33
浏览 618

如何解决:HSI到RGB转换导致RGB颜色超过255

Edit: Thank you everyone who helped but the problem still persist. So, is there any better formula to edit saturation without needing clamping? Non linear formula might work but I don't know exact good formula. Thx

I am trying to develop a photo editing system that allow people to increase and decrease hue/saturation/lightness which is similar to what ipiccy.com does. I am using HSI<->RGB conversion. First, each pixel are convert from RGB to HSI. Secondly, user specify the amount of saturation she wants to add. Thirdly, system add user's specified value to original saturation value converted in first step and then convert these HSI value to RGB. My problem is that when I convert new HSI value back to RGB, some of the RGB values are more than 255. So, colors are not displayed properly.

I have been reading and trying for days but no luck in getting right. Anyone know how to solve it? Any clue or any link to read or solution is welcome. Thanks a lot.

  • 写回答

2条回答 默认 最新

  • doutuo7156 2012-08-14 15:43
    关注

    It all depends on how you alter the saturation value. If you do a simple add, then you absolutely must employ clamping, i.e. truncate over-255 values to 255. And the same for sub-zero values. This will lead some colors to overlap. You could also employ different formulas to make overflowing more difficult, but this might lead to behavior the user doesn't understand. fact is, when you change a picture, information loss due to truncation is almost a given. I'd try to warn the user and offering an undo function: e.g. showing oversaturated areas as white or magenta or blinking, as some cameras do. Keeping the user from causing info loss would limit user interaction too much, IMHO.

    评论

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用