Method of determining a chemical composition of a slag portion, the method comprising the steps of: - providing the slag portion, the slag portion having a surface, - collecting light reflected from the surface using an optical system, - obtaining a data set from the collected light, the data set at least defining a matrix (Λ) containing values representative of an intensity of a part (L M,λ) of the collected light, each part (L M,λ) being respectively collected from one of a plurality of points at one of a plurality of wavelengths, the matrix (Λ) being indexed at least by: - a plurality of space coordinates (x1, x2,...) of the plurality of points, and - a plurality of spectral parameters (λ1, λ2,...) representative of the plurality of wavelengths, - conditioning the matrix in order to obtain a reduced set of values, and - performing a mathematical algorithm using the reduced set of values in order to obtain the chemical composition, wherein the step of obtaining a data set includes the following substeps: - providing gray scale values representative of an intensity of the parts (L M,λ), and - obtaining the values (I x,y,λ) contained in the matrix using said gray scale values wherein the step of conditioning includes the following substeps: - normalizing each value in the matrix in order to obtain normalized values adapted to be free of an influence of an external illumination of the slag portion during the step of collecting the reflected light, - segmenting the matrix, wherein at least some of the values of the matrix are analyzed in order to determine whether the corresponding points belong to the slag portion, and wherein only the values of the matrix corresponding to points that belong to the slag portion are kept in the matrix, - spatially smoothing the normalized values in order to obtain a spectral signature of the slag portion, and - reducing the size of the spectral signature by selecting a subset of values in the spectral signature in order to obtain the reduced set of values, the selected subset being indexed by a subset of spectral parameters (Ω(λ)) selected from the plurality of spectral parameters (λ1, λ2...), wherein spatially smoothing is a computation of a spatial mean at each wavelength over the entire slag portion. - providing the slag portion, the slag portion having a surface, - collecting light reflected from the surface using an optical system, - obtaining a data set from the collected light, the data set at least defining a matrix (Λ) containing values representative of an intensity of a part (L M,λ) of the collected light, each part (L M,λ) being respectively collected from one of a plurality of points at one of a plurality of wavelengths, the matrix (Λ) being indexed at least by: - a plurality of space coordinates (x1, x2,...) of the plurality of points, and - a plurality of spectral parameters (λ1, λ2,...) representative of the plurality of wavelengths, - a plurality of space coordinates (x1, x2,...) of the plurality of points, and - a plurality of spectral parameters (λ1, λ2,...) representative of the plurality of wavelengths, - conditioning the matrix in order to obtain a reduced set of values, and - performing a mathematical algorithm using the reduced set of values in order to obtain the chemical composition, wherein the step of obtaining a data set includes the following substeps: - providing gray scale values representative of an intensity of the parts (L M,λ), and - obtaining the values (I x,y,λ) contained in the matrix using said gray scale values - providing gray scale values representative of an intensity of the parts (L M,λ), and - obtaining the values (I x,y,λ) contained in the matrix using said gray scale values wherein the step of conditioning includes the following substeps: - normalizing each value in the matrix in order to obtain normalized values adapted to be free of an influence of an external illumination of the slag portion during the step of collecting the reflected light, - segmenting the matrix, wherein at least some of the values of the matrix are analyzed in order to determine whether the corresponding points belong to the slag portion, and wherein only the values of the matrix corresponding to points that belong to the slag portion are kept in the matrix, - spatially smoothing the normalized values in order to obtain a spectral signature of the slag portion, and - reducing the size of the spectral signature by selecting a subset of values in the spectral signature in order to obtain the reduced set of values, the selected subset being indexed by a subset of spectral parameters (Ω(λ)) selected from the plurality of spectral parameters (λ1, λ2...), - normalizing each value in the matrix in order to obtain normalized values adapted to be free of an influence of an external illumination of the slag portion during the step of collecting the reflected light, - segmenting the matrix, wherein at least some of the values of the matrix are analyzed in order to determine whether the corresponding points belong to the slag portion, and wherein only the values of the matrix corresponding to points that belong to the slag portion are kept in the matrix, - spatially smoothing the normalized values in order to obtain a spectral signature of the slag portion, and - reducing the size of the spectral signature by selecting a subset of values in the spectral signature in order to obtain the reduced set of values, the selected subset being indexed by a subset of spectral parameters (Ω(λ)) selected from the plurality of spectral parameters (λ1, λ2...), wherein spatially smoothing is a computation of a spatial mean at each wavelength over the entire slag portion.