RGBHSV色彩空间模式的互相转换.docx
《RGBHSV色彩空间模式的互相转换.docx》由会员分享,可在线阅读,更多相关《RGBHSV色彩空间模式的互相转换.docx(10页珍藏版)》请在三一办公上搜索。
1、RGBHSV色彩空间模式的互相转换RGB、HSV色彩空间模式的互相转换 文章来源: 在开发有关bitmap方面的程序时,经常需要将位图的颜色在RGB和HSV色彩空间之间转换,前段时间本人研究过,现在整理一下,希望对大家能有所帮助,该颜色转换由C+实现 在开发有关bitmap方面的程序时,经常需要将位图的颜色在RGB和HSV色彩空间之间转换,前段时间本人研究过,现在整理一下,希望对大家能有所帮助,该颜色转换由C+实现: RGB颜色空间转换为HSV空间颜色值: void Rgb2Hsv(float R, float G, float B, float& H, float& S, float&V)
2、/ r,g,b values are from 0 to 1 / h = 0,360, s = 0,1, v = 0,1 / if s = 0, then h = -1 (undefined) float min, max, delta,tmp; tmp = min(R, G); min = min( tmp, B ); tmp = max( R, G); max = max(tmp, B ); V = max; / v delta = max - min; if( max != 0 ) S = delta / max; / s else / r = g = b = 0 / s = 0, v
3、is undefined S = 0; H = UNDEFINEDCOLOR; return; if( R = max ) H = ( G - B ) / delta; / between yellow & magenta else if( G = max ) H = 2 + ( B - R ) / delta; / between cyan & yellow else H = 4 + ( R - G ) / delta; / between magenta & cyan H *= 60; / degrees if( H Scripts-Browse. 找到你刚做好的文件,执行一下。 3,根据
4、提示找到Camera Raw.8bi这个Camera Raw插件的文件后确定。 4,破解完成,重新启动photoshop就可以了 如果要取消破解,重新执行一下这个.js文件就可以了 这个破解只是在ACR的插件的兼容型号里加一个30D的标签,不会有什么副作用的。 以下是代码: / Find the Official ACR plugin in the expected location or ask the user to help var originalACR = File(Folder.startup + /Plug-Ins/File Formats/Camera Raw.8bi); if
5、 ( !originalACR.exists ) if ( Folder.fs = Windows ) originalACR = File.openDialog(Find and Select the Camera Raw.8bi File, Photoshop Plug-ins:*.8bi); else if ( Folder.fs = Macintosh ) originalACR = File.openDialog(Find and Select the Camera Raw.8bi File, pluginFilter); / Check if hack already exists
6、 and prompt the user asking what to do var bRemove = false; var bProceed = false; var newACR = File(originalACR.path + /Camera Raw Unofficial Canon 30D.8bi); if ( newACR.exists ) bRemove = confirm(Unofficial Canon 30D support already exists.rDo you want to remove?); if (bRemove) newACR.remove; alert
7、(Unofficial Canon 30D support has been successfully removed.rYou should restart Photoshop.); else bProceed = confirm(Do you want to add Unofficial Canon 30D support?); if ( bProceed ) / Create a backup copy of the original ACR file to work with. originalACR.copy(newACR); / Read backup copy of ACR in
8、to memory newACR.encoding = BINARY; newACR.open(r); var memoryACR = newACR.read; newACR.close; / Perform some sanity checks to make sure this is the ACR plug-in var validACR = true; if (!memoryACR.match(/Adobe/) validACR = false; if (!memoryACR.match(/Camera Raw/) validACR = false; if (!memoryACR.ma
9、tch(/Thomas Knoll/) validACR = false; if (!memoryACR.match(/Canon EOS-1D Mark II/) validACR = false; if ( validACR ) / Do the hack var loc = memoryACR.search(/Canon EOS-1D Mark II/); newACR.open(e); newACR.seek(loc, 0); newACR.write(Canon EOS 30D0); newACR.close; alert(Unofficial Canon 30D support h
- 配套讲稿:
如PPT文件的首页显示word图标,表示该PPT已包含配套word讲稿。双击word图标可打开word文档。
- 特殊限制:
部分文档作品中含有的国旗、国徽等图片,仅作为作品整体效果示例展示,禁止商用。设计者仅对作品中独创性部分享有著作权。
- 关 键 词:
- RGBHSV 色彩 空间 模式 互相 转换
链接地址:https://www.31ppt.com/p-3165282.html