【问题标题】:Generating the background of imatest color error chart generated by using color checker?生成使用颜色检查器生成的 imatest 颜色错误图表的背景?
【发布时间】:2021-03-31 06:00:27
【问题描述】:

我在查找使用 imatest 制作的以下情节的背景时遇到了一些麻烦。基本上我想知道的是,我如何或从哪里可以找到这个情节的背景。 imatest 网站提到图表的颜色是在恒定亮度L* = 90 和可变a* and b* from -80 to +80 下生成的。我一直在寻找 Lab 颜色生成器,但所有软件都会生成彩色点。但我想通过改变 a 和 b 值来获得连续图像。有什么想法吗?

【问题讨论】:

    标签: c++ matlab colors adobe-illustrator cielab


    【解决方案1】:

    使用matlab,您可以简单地将您的 cielab 空间转换为 RGB 空间:

    range = -80:0.5:80;                            % a,b range, change the step to change the size of the output image.
    L     = 100*ones(size(range,2),size(range,2)); % L intensity
    [b,a] = meshgrid(range);                       % generate a 2D grid
    Lab   = cat(3,L,a,b);                          % create the 3D Lab array
    I     = lab2rgb(rot90(Lab));                   % Lab -> RGB
    imshow(I)                                      % Display the result
    

    我们得到:

    【讨论】:

      【解决方案2】:

      只是为了好玩,如果有人想要 Python OpenCV 版本,我做了一个这样的:

      #!/usr/bin/env python3
      
      import cv2
      import numpy as np
      
      # Set size of output image
      h, w = 500, 500
      
      # Create "L" channel, L=90
      L = np.full((h,w), 90.00, np.float32)
      
      # Create "a" channel, -80 to +80
      a = np.linspace(-80,80,w,endpoint=True,dtype=np.float32)
      a = np.resize(a,(h,w))
      
      # Create "b" channel by rotating "a" channel 90 degrees
      b = cv2.rotate(a, cv2.ROTATE_90_COUNTERCLOCKWISE)
      
      # Stack the 3-channels into single image and convert from Lab to BGR
      res = np.dstack((L,a,b))
      res = cv2.cvtColor(res, cv2.COLOR_LAB2BGR)
      
      # Save result
      cv2.imwrite('result.png', (res*65535).astype(np.uint16))
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2011-11-28
        • 1970-01-01
        • 2019-05-11
        • 1970-01-01
        相关资源
        最近更新 更多