[英]Setting the luminance of an image in skimage does not return constant luminance
我有一個 rgb 圖像 (rgb),我想設置亮度以確保它是恆定的。 我首先檢查原始圖像的亮度(greyrgb)。 然后我將圖像轉換為 Lab,然后將 L 值設置為 50 (lab50),然后再轉換回 rgb (rgb50)。 然后我計算生成圖像的亮度(greyrgb50),但它不是恆定的——它實際上看起來更糟。
import numpy as np
from skimage import color
import matplotlib.pyplot as plt
rgb = np.loadtxt("my_image.txt").reshape((512,512,4))
greyrgb = color.rgb2gray(rgb)
lab = color.rgb2lab(rgb)
lab50 = lab
lab50[:,:,0] = 50
rgb50 = color.lab2rgb(lab50)
greyrgb50 = color.rgb2gray(rgb50)
我發現當我將亮度設置為不同的值時,生成的 rgb 圖像的亮度仍然略有不同。 我是否錯誤地設置了亮度,或者我是否錯誤地計算了最終 rgb 圖像的亮度?
您正在嘗試創建全域 colors。 colors,可以寫成數字,但不能存在於現實生活或其他色彩空間中。 例如,純紅色的最大亮度不能超過 0.3,純藍色的最大亮度不能超過 0.1,綠色或多或少很好,但仍然不能超過 0.6——因此你有較暗的區域,其中只有一種顏色 ( r,g,b) 存在,因為它無法在 RGB 顏色空間中正確表示。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.