本文介绍了完全的ColorContext混乱的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在搜索有关"Media"中ColorContext类的(微薄的)文档.命名空间,以及在线搜索数小时,只会变得更加混乱.我仍然不明白我们应该如何使用ColorContext  class 开发适当的颜色管理应用程序.

我的情况如下:给我一个BitmapSource对象.我对这些位执行了一些处理,然后需要返回另一个体现结果的BitmapSource.我需要确保颜色管理没有中断.从我已经能够 弄清楚我需要生成一个具有与原始ColorContext相同的ColorContext的新BitmapSource(因为我正在修改原始图像,而不是捕获它的颜色上下文).但是,我看不到任何访问ColorContext方面"的方法. BitmapSource. 确实,还不清楚BitmapSource是否甚至有一个!认为我可能对ColorContext的理解是完全错误的,因此我在文档中进行了查找:

表示与位图图像相关联的ICC或ICM配置文件".

到目前为止,这看起来像我需要重点关注的,对吗?例如,设备颜色配置文件(如果有)应包含有关我的相机的光谱响应的信息.这是设备相关的色彩空间,应描述 (即封装ICC/ICM颜色配置文件),打印机,监视器等.现在,关于MSDN文档所声明的颜色空间:

像素格式本身没有色彩空间.通常,颜色空间是像素值的语义解释,取决于位图的上下文.某些图像会标识定义图像颜色空间的颜色上下文."

请稍等...现在听起来,ColorContext实际上并没有像最初暗示的那样指代与设备相关的色彩空间,而是指与设备无关的色彩空间(如上文所指).在检查时进一步暗示了这一点 ColorConvertedBitmap类,该类应该将图像从一种颜色空间(例如sRGB)传输到另一种颜色空间(例如scRGB),尽管似乎无法指定要转换为哪个颜色空间.如果要更改颜色空间,请参阅文档 警告我不要更改像素格式,而应使用ColorConvertedBitmap类,该类需要作为其参数之一,是的,您猜到了它是像素格式.我可以继续前进,但我不想碰见我!

 

如果有人可以发布几行代码来显示ColorContext应该如何使用,并描述其实际功能,我将不胜感激.它包含哪些信息?如何使用?假设它 包含设备配置文件信息,当我访问这些位时该配置文件是否已应用到图像,还是仅在显示图像时才应用(连同显示器配置文件一起使用)?如果它已经被应用了,为什么在进入时我必须再次提供它 不同的色彩空间,例如ColorConvertedBitmap?为什么只有BitmapFrame似乎具有颜色上下文?这是原始图像捕获系统的属性,难道不应该将其嵌入BitmapSource中吗? WPF/WIC应该制作色彩管理软件 如此之多的可访问性,但是没有适当的文档,甚至几乎无法上手.

先谢谢了,
-L

解决方案


I've been scouring the (meager) documentation regarding the ColorContext class in the "Media" namespace, as well as on-line searching for hours and have only grown more confused. I still cannot understand how we're supposed to use the ColorContext class to develop a properly color-managed application.

My scenario is as follows: I'm given a BitmapSource object. I perform some processing on the bits and then I need to return another BitmapSource that embodies the result. I need to ensure that the color management isn't broken. From what I've been able to figure out I need to generate a new BitmapSource with the same ColorContext as the original since (I'm modifying the original image, not the color context of how it was captured). However, I don't see any way to access the ColorContext "aspect" of BitmapSource. Indeed, it's unclear whether BitmapSource even has one! Thinking that maybe my understanding of ColorContext was all wrong I looked it up in the documentation:

"Represents the ICC or ICM profile that is associated with a bitmap image".

So far so good, this looks like what I need to focus on, right? The device color profile (when available) should contain information about the spectral response of my camera, for example. This is a device-dependant color space that should characterize (i.e. encapsulate the ICC/ICM color profile) a printer, a monitor, etc. Now, regarding color spaces the MSDN docs state:

"Pixel formats in themselves do not have a color space. Generally, color space is a semantic interpretation of the pixel values that depends on the context of the bitmap. Some images identify a color context that defines the color space of the image."

Wait a minute...now it sounds like the ColorContext actually doesn't refer to device-dependant color spaces as originally implied, but rather device-independant color spaces like what is being alluded to above. This is further hinted at when examining the ColorConvertedBitmap class which is supposed to transfer images from one color space (say sRGB) to another (say scRGB), although there seems to be no way to specify which color space you'd like to convert to. If I want to change color spaces, the documentation warns me not to change pixel formats, but instead use the ColorConvertedBitmap class which requires, as one of its arguments...yup, you guessed it...a pixel format. I could go on and on but I don't want to come across as snide!

I would be EXTREMELY grateful if someone could please post a few lines of code showing just how ColorContext is supposed to be used and please describe what the heck it's actually doing. What information does it contain? How do I use it? Assuming it contains device profile information, has that profile been applied to the image when I access the bits, or is it only applied (along with the monitor profile) when the image is displayed? If its already been applied why must I supply it again when going to a different color space ala ColorConvertedBitmap? Why does only BitmapFrame seem to have a color context? It's a property of the original image capture system, shouldn't it be embedded in BitmapSource? WPF/WIC is supposed to make color-managed software so much more accessable but wthout the proper documentation it seems almost impossible to even get started.

Thanks in advance,
-L

解决方案


这篇关于完全的ColorContext混乱的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 11:14