Spectrum to xy — Reflectance Color Classification Spectrum to xy — จำแนกสีจากการสะท้อนแสง

Upload a labelled reflectance table; this page computes peak/centroid and CIE xy/L*a*b* itself and lets you label pass/fail per row. อัปโหลดตารางการสะท้อนแสงที่ผ่านการติดป้ายกำกับ หน้านี้คำนวณ peak/centroid และ CIE xy/L*a*b* เอง พร้อมให้ label pass/fail ทีละแถว

Equations used on this pageสมการที่ใช้ในหน้านี้
  • Peak / centroid — Savitzky-Golay smoothing (window 51, polyorder 2) on the raw R(λ) → detect the apex with FWHM > 20 nm inside the peak-search range (Setting 3.2) → min-max normalize within that range → centroid over the contiguous region where the normalized curve Rn ≥ 0.5: \[ \lambda_c = \frac{\sum \lambda \,(R_n-0.5)}{\sum (R_n-0.5)} \]
  • Spectrum → XYZ — S(λ) = R(λ)/100, integrated on the 380-780 nm / 1 nm grid under CIE illuminant D65 [1], using the CIE 1931 2° color-matching functions [2], following Bruce Lindbloom's method [3]: \[ X = 100\,\frac{\int \bar{x}(\lambda)\,S(\lambda)\,I(\lambda)\,d\lambda}{\int \bar{y}(\lambda)\,I(\lambda)\,d\lambda}, \quad Y,Z \text{ likewise (with } \bar{y},\bar{z}\text{)} \]
  • XYZ → xy — \( x = X/(X+Y+Z),\; y = Y/(X+Y+Z) \) (falls back to the reference white when X=Y=Z=0), following Bruce Lindbloom's method [4]
  • XYZ → L*a*b* (ε=216/24389, κ=24389/27; reference white XrYrZr computed from S=1 on this page's own grid), following Bruce Lindbloom's method [5] — \[ f(t)=\begin{cases}t^{1/3}& t>\epsilon\\ (\kappa t+16)/116 & t\le\epsilon\end{cases},\quad L^*=116f(Y/Y_r)-16,\; a^*=500(f(X/X_r)-f(Y/Y_r)),\; b^*=200(f(Y/Y_r)-f(Z/Z_r)) \]
  • Peak / centroid — smooth R(λ) ดิบด้วย Savitzky-Golay (window 51, polyorder 2) → หายอดที่ FWHM > 20 nm ในช่วงหา peak (Setting 3.2) → normalize แบบ min-max ในช่วงนั้น → centroid จากช่วงต่อเนื่องที่เส้น normalize Rn ≥ 0.5: \[ \lambda_c = \frac{\sum \lambda \,(R_n-0.5)}{\sum (R_n-0.5)} \]
  • สเปกตรัม → XYZ — S(λ) = R(λ)/100 อินทิเกรตบน grid 380-780 nm ทุก 1 nm ภายใต้ illuminant D65 [1] โดยใช้ color-matching function ของ CIE 1931 2° [2] ตามวิธีของ Bruce Lindbloom [3]: \[ X = 100\,\frac{\int \bar{x}(\lambda)\,S(\lambda)\,I(\lambda)\,d\lambda}{\int \bar{y}(\lambda)\,I(\lambda)\,d\lambda}, \quad Y,Z \text{ เช่นเดียวกัน (ใช้ } \bar{y},\bar{z}\text{)} \]
  • XYZ → xy — \( x = X/(X+Y+Z),\; y = Y/(X+Y+Z) \) (ถ้า X=Y=Z=0 ใช้ค่า reference white แทน) ตามวิธีของ Bruce Lindbloom [4]
  • XYZ → L*a*b* (ε=216/24389, κ=24389/27 ; reference white XrYrZr คำนวณจาก S=1 บน grid ของหน้านี้เอง) ตามวิธีของ Bruce Lindbloom [5] — \[ f(t)=\begin{cases}t^{1/3}& t>\epsilon\\ (\kappa t+16)/116 & t\le\epsilon\end{cases},\quad L^*=116f(Y/Y_r)-16,\; a^*=500(f(X/X_r)-f(Y/Y_r)),\; b^*=200(f(Y/Y_r)-f(Z/Z_r)) \]

How to use this labวิธีใช้เครื่องมือ

  1. Upload your CSV/TXT file: the first row is the column names — at least one identifying column (e.g. id), optionally a label column for your own pass/fail or category tags (e.g. label), and one reflectance column per wavelength named R_<nm> (e.g. R_380, R_381, … R_780), each holding a % reflectance value.
  2. This page opens with a small demo file already loaded, so you can see it working right away — every chart, readout and the Labelling Table below reflect that demo until you upload your own. Not sure about the format? Download the demo file to see it as a plain CSV (3 rows, id/label/R_380–R_780).
  3. Step through rows with the Index controls or the ↑/↓ arrow keys; every chart and readout below updates to the selected row.
  4. Set the Peak/Centroid Search Range and the Pass/Fail Range to match where your material's own reflectance peak is expected to fall.
  5. Pick which column colors the CIE diagram's points under "Color by column", to see whether one category (e.g. a batch, or your own pass/fail tag) clusters separately from another.
  6. Use the Labelling Table's editable last column to record your own judgement per row, then Export to download the labelled file.
  1. Upload file CSV/TXT ของคุณ: แถวแรกเป็นชื่อ column — อย่างน้อย 1 column สำหรับระบุตัวอย่าง (เช่น id) จะมี column label สำหรับติดป้าย pass/fail หรือหมวดหมู่ของคุณเองด้วยก็ได้ (เช่น label) และ column ค่าการสะท้อนแสงหนึ่ง column ต่อความยาวคลื่น ชื่อในรูป R_<nm> (เช่น R_380, R_381, … R_780) แต่ละ column เป็นค่า percent การสะท้อนแสง
  2. หน้านี้เปิดมาพร้อม demo file ที่โหลดไว้ให้แล้ว จึงเห็นตัวอย่างการทำงานได้ทันที — กราฟ ค่าที่อ่าน และตาราง Labelling ด้านล่างเป็นของ demo นี้จนกว่าจะ Upload file ของคุณเอง ไม่แน่ใจเรื่อง format? Download demo file ดูเป็น CSV ธรรมดา (3 แถว, id/label/R_380–R_780)
  3. เลื่อนดูทีละแถวด้วยตัวควบคุม Index หรือลูกศร ↑/↓ — กราฟและค่าที่อ่านทุกช่องด้านล่างจะอัปเดตตามแถวที่เลือก
  4. ปรับช่วง Peak/Centroid Search Range และ Pass/Fail Range ให้ตรงกับตำแหน่ง peak ที่คาดว่าวัสดุของคุณจะมี
  5. เลือกคอลัมน์ที่จะใช้กำหนดสีจุดในกราฟ CIE ("Color by column") เพื่อดูว่าหมวดหมู่หนึ่ง (เช่น batch หรือ label pass/fail ของคุณ) แยกกลุ่มออกจากอีกหมวดหรือไม่
  6. แก้ไขคอลัมน์สุดท้ายของตาราง Labelling เพื่อบันทึกผลตัดสินของคุณเอง จากนั้นกด Export เพื่อดาวน์โหลดไฟล์ที่ติดป้ายแล้ว

Common mistakes & limitationsข้อควรระวังและข้อจำกัดของโมเดล

  • Peak/centroid detection needs at least 51 valid reflectance readings per row (the Savitzky-Golay smoothing window) — rows with fewer are reported as having no peak.
  • The peak search only looks inside 400–780 nm and only counts a peak whose full width at half maximum exceeds 20 nm; if a spectrum has more than one such peak, only the most prominent one is used.
  • Color (XYZ/xy/L*a*b*) is always computed for the CIE 1931 2° standard observer under the D65 illuminant on a fixed 380–780 nm, 1 nm grid — neither the observer nor the illuminant is selectable on this page.
  • If your file's own wavelength columns don't cover the full 380–780 nm grid, the missing part is left out of the color calculation rather than extrapolated — cover at least that range for a valid result.
  • This page only repeats the colorimetric calculation on the numbers you upload; it does not know whether your reflectance measurement itself (stray light, dark reference, instrument calibration) was correct.
  • การหา peak/centroid ต้องมีค่าการสะท้อนแสงที่ใช้ได้อย่างน้อย 51 ค่าต่อแถว (ตามขนาดหน้าต่าง Savitzky-Golay) — แถวที่มีน้อยกว่านี้จะถูกรายงานว่าไม่พบ peak
  • การหา peak มองเฉพาะในช่วง 400–780 nm และนับเฉพาะ peak ที่มีความกว้างครึ่งสูงสุด (FWHM) มากกว่า 20 nm ถ้าสเปกตรัมมี peak แบบนี้มากกว่า 1 จุด จะใช้เฉพาะจุดที่โดดเด่นที่สุด
  • การคำนวณสี (XYZ/xy/L*a*b*) ใช้ค่ามาตรฐาน CIE 1931 2° observer ภายใต้ illuminant D65 บน grid 380–780 nm ทุก 1 nm เสมอ — ไม่สามารถเปลี่ยน observer หรือ illuminant ในหน้านี้ได้
  • ถ้าคอลัมน์ความยาวคลื่นในไฟล์ของคุณไม่ครอบคลุมช่วง 380–780 nm เต็มช่วง ส่วนที่ขาดจะถูกเว้นออกจากการคำนวณสี (ไม่มีการประมาณค่านอกช่วง) — ควรครอบคลุมช่วงนี้ให้เต็มเพื่อผลลัพธ์ที่ถูกต้อง
  • หน้านี้คำนวณตามค่าตัวเลขที่คุณอัปโหลดเท่านั้น ไม่สามารถรู้ได้ว่าการวัดค่าการสะท้อนแสงเอง (stray light, dark reference, การคาลิเบรตเครื่องมือ) ถูกต้องหรือไม่

Real-world applicationsการประยุกต์ใช้งานจริง

  • Quick pass/fail sorting of optical components (filters, coatings, tinted lenses) by checking whether their reflectance peak/centroid falls inside a target wavelength band.
  • Batch-to-batch color consistency checks: plotting many samples on the same CIE diagram makes it easy to see whether one batch has drifted in color compared to another.
  • A lightweight, browser-only alternative to re-running a full colorimetric pipeline in spreadsheet or Python tools, when all you have is a table of measured reflectance spectra.
  • คัดแยก pass/fail ของอุปกรณ์ทางแสง (ฟิลเตอร์ ฟิล์มเคลือบ เลนส์แต่งสี) อย่างรวดเร็ว โดยดูว่า peak/centroid ของการสะท้อนแสงตกอยู่ในช่วงความยาวคลื่นเป้าหมายหรือไม่
  • ตรวจสอบความสม่ำเสมอของสีระหว่าง batch: การพล็อตหลายตัวอย่างบนกราฟ CIE เดียวกันช่วยให้เห็นได้ง่ายว่า batch ใดมีสีเพี้ยนไปจาก batch อื่นหรือไม่
  • เป็นเครื่องมือทางเบราว์เซอร์ที่เบา ใช้แทนการรันขั้นตอนคำนวณสีแบบเต็มในสเปรดชีตหรือ Python เมื่อมีแค่ตารางค่าการสะท้อนแสงที่วัดมาแล้ว
Spectrum to xy Spectrum to xy
Uploadอัปโหลด
No file selected ยังไม่ได้เลือกไฟล์
Indexแถวที่ดู (Index)
/ 0

Use the ↑/↓ arrow keys (when not typing in a field) to step through rows. กดลูกศร ↑/↓ บนคีย์บอร์ด (เมื่อไม่ได้พิมพ์ในช่องอื่น) เพื่อเลื่อนทีละแถว

Peak / Centroid Search Rangeช่วงหา Peak / Centroid
Pass / Fail Rangeช่วงเงื่อนไขผ่าน/ไม่ผ่าน

Centroid inside this range = pass; outside, or no peak found = fail. centroid อยู่ในช่วงนี้ = pass ; นอกช่วงหรือไม่มี peak = fail

Spectrum Column Rangeช่วงคอลัมน์ Spectrum
CIE Point Colorสีจุดในกราฟ CIE
Spectrum — Full Rangeสเปกตรัม — เต็มช่วง
Rawค่าดิบ Smoothค่า smooth Pass rangeช่วงผ่าน Rn≥0.5 regionช่วง Rn≥0.5 FWHM / peak maxFWHM / ยอด peak CentroidCentroid
Spectrum — Peak Zoomสเปกตรัม — ซูมช่วง Peak
Rawค่าดิบ Smoothค่า smooth Pass rangeช่วงผ่าน Rn≥0.5 regionช่วง Rn≥0.5 FWHM / peak maxFWHM / ยอด peak CentroidCentroid
CIE 1931 xy Diagramไดอะแกรม CIE 1931 xy

Background colors are approximate — many chromaticities fall outside a display's sRGB gamut. Scroll to zoom, click a point to select it. Boundary curve: CIE spectral chromaticity coordinates of the spectrum colours [6]. สีพื้นหลังเป็นค่าประมาณ เพราะหลายตำแหน่งสีอยู่นอกขอบเขตสี sRGB ของจอภาพ เลื่อนล้อเมาส์เพื่อซูม คลิกจุดเพื่อเลือกแถว เส้นขอบ: ค่าพิกัดสี spectral chromaticity ของ CIE [6]

Readoutค่าที่คำนวณได้
Selected Pointจุดที่เลือก
Labelling Tableตาราง Label

Pick which column each of the 6 selectable columns shows using the dropdowns in the table header. The last (6th) column is editable — click into its cell to change the value. เลือกว่าคอลัมน์ที่เลือกได้ทั้ง 6 คอลัมน์จะแสดงข้อมูลอะไร ผ่าน dropdown ที่หัวตาราง คอลัมน์สุดท้าย (ที่ 6) แก้ไขได้ — คลิกที่ cell เพื่อแก้ไขค่า

Referencesเอกสารอ้างอิง

  1. International Organization for Standardization, ISO 11664-2, Colorimetry — Part 2: CIE Standard Illuminants (D65).
  2. International Commission on Illumination (CIE), CIE 018:2019 / ISO/CIE 11664-1:2019. Accessed: Sep. 29, 2026. [Online]. Available: https://doi.org/10.25039/CIE.DS.xvudnb9b
  3. B. Lindbloom, "Spectral to XYZ," brucelindbloom.com. Accessed: Sep. 29, 2026. [Online]. Available: http://www.brucelindbloom.com/Eqn_Spect_to_XYZ.html
  4. B. Lindbloom, "XYZ to xyY," brucelindbloom.com. Accessed: Sep. 29, 2026. [Online]. Available: http://www.brucelindbloom.com/Eqn_XYZ_to_xyY.html
  5. B. Lindbloom, "XYZ to Lab," brucelindbloom.com. Accessed: Sep. 29, 2026. [Online]. Available: http://www.brucelindbloom.com/Eqn_XYZ_to_Lab.html
  6. International Commission on Illumination (CIE), CIE 2019 (spectral chromaticity coordinates of the spectrum colours). Accessed: Sep. 29, 2026. [Online]. Available: https://doi.org/10.25039/CIE.DS.mifmy4x4