bgr162rgb
by Tim C. Lueth, SG-Lib Toolbox: SolidGeometry 5.6 - File handling
Introduced first in SolidGeometry 4.4, Creation date: 2018-11-29, Last change: 2025-09-14
converts a 16 Bit AbC color code (BGR 3 x 5 + 1 Bit) into a color vector [R G B] 3 x 8 Bit
Description
Used for READING COLORED STL FILES
Support of VisCAM and SolidView Colors as attribute by Byte
bits 0 to 4 are the intensity level for blue (0 to 31),
bits 5 to 9 are the intensity level for green (0 to 31),
bits 10 to 14 are the intensity level for red (0 to 31),
bit 15 is 1 if the color is valid, or 0 if the color is not valid (as with normal STL files).
The Company Materialize defined a color code for the BINARY STL format that exist only in binary STL files. Unfortunately is wasn't clear from left to right or right to left. Therefor the common used Software Meshlab does interpret the colors other than Materialize Software.
In the SG-Lib this is handled by swiching the Facet Colors for RED and BLUE channel. FC=FC(:,[3 2 1])
See Also: rgb2bgr16
Example Illustration
Syntax
rgb=bgr162rgb(AbC)
Input Parameter
AbC: | | List of "Attribute by Count" or BRG16Bit code |
Output Parameter
rgb: | | List of Matlab RGB Values |
Examples
a=rgb2bgr16('m'), b=bgr162rgb(a), rgb2char(b*255)
a=rgb2bgr16([255 0 0]), b=bgr162rgb(a), rgb2char(b*255)
a=rgb2bgr16([0.1 0.9 1.0])
Copyright 2018-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Last html export of this page out of FM database by TL: 2025-09-21