Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

Importing Image for Colour Conversion

조회 수: 3 (최근 30일)
Justin
Justin 2012년 4월 16일
마감: MATLAB Answer Bot 2021년 8월 20일
Hi there,
I'm trying to use the colorspace transformation, which can be found here http://www.mathworks.com/matlabcentral/fileexchange/28790-colorspace-transformations
Here's the basic info on the function:
function varargout = colorspace(Conversion,varargin)
%COLORSPACE Transform a color image between color representations.
% B = COLORSPACE(S,A) transforms the color representation of image A
% where S is a string specifying the conversion. The input array %A should be a real full double array of size Mx3 or MxNx3. The % output B is the same size as A.
%
% S tells the source and destination color spaces, S = 'dest<-src', or
% alternatively, S = 'src->dest'.
%
% All conversions assume 2 degree observer and D65 illuminant.
So I've been trying to do this:
colour_wheel_lab = colorspace('hsv<-lab', colour_wheel)
But I keep getting error messages claiming there is an error when it gets to the source image Ii.e. image 'A' or the 'colour_wheel'). I've been loading the source image using 'imread' but I'm not sure if this puts it into the correct format for this function. Any ideas here? Do I need to convert the image into a different array?
Thanks in advance!

답변 (1개)

Walter Roberson
Walter Roberson 2012년 4월 16일
Notice that A should be "a real full double array". If you are using imread() then you are probably getting an uint8 image. Use im2double() to convert it.
  댓글 수: 1
Image Analyst
Image Analyst 2012년 4월 16일
He has an LAB image so he's already converted the RGB image into LAB, but that can be either integer or double depending on how he obtained it. I think if you used the built-in MATLAB color conversion function, makecform, then you can get either an integer LAB out, if you passed in uint8, or you can get a floating point lab image, if you passed in a floating point image. The range of the L, A, and B also varies depending on what you passed in, integers or doubles, and I'm not sure any of them are what you'd get out of a spectrophotometer or colorimeter. I'm not sure what he'd get for lab if he used the File Exchange file. Justin, any reason why you're not using the built-in "makecform()" function?

이 질문은 마감되었습니다.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by