How do I specify the color data as numeric or logical value?

I'm currently using a code from github for fringe analysis. It works perfectly for the example image but when Im using .tif images with an 'indexed' colormap and RGB-palette I always get this error:
Error using image
Complex values are not supported. Specify the color data as numeric or logical values.
Error in imagesc (line 52)
hh = image(varargin{:}, 'CDataMapping', 'scaled');
Error in example (line 61)
imagesc(1 ./ freq);
How do I need to specify the colordata?
Heres the part from the code:
subplot(2, 2, 1);
im.resize(scale).plot();
title('test image');
subplot(2, 2, 2);
imagesc(1 ./ freq);
axis image;
colorbar;
set(gca, 'XTick', [], 'YTick', []);
title('apparent spacing, nm');
Regards,
M

Réponses (1)

I'm going to have to assume that freq or 1./freq are complex-valued. The arguments to image()/imagesc() need to be real-valued. How you choose to reduce the complex values depends on what your intentions are. You could look at only the components of the data
real(1./freq)
or
imag(1./freq)
or you could look at the magnitude
abs(1./freq)

Catégories

En savoir plus sur Color and Styling dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by