closeallclearallf=imread('C:\Users\Administrator\Desktop\matlab\43.bmp');subplot(1,2,1);imshow(f);[M,N]=size(f);[f,revertclass]=tofloat(f);下面是tofloat函数function[out,r...
close all
clear all
f=imread('C:\Users\Administrator\Desktop\matlab\43.bmp');
subplot(1,2,1);imshow(f);
[M, N] = size(f);
[f, revertclass] = tofloat(f);
下面是tofloat函数
function [out, revertclass] = tofloat(in)
identity = @(x) x;
tosingle = @im2single;
table = {'uint8', tosingle, @im2uint8
'uint16', tosingle, @im2uint16
'int16', tosingle, @im2int16
'logical', tosingle, @logical
'double', identity, identity
'single', identity, identity};
classIndex = find(strcmp(class(in), table(:, 1)));
if isempty(classIndex)
error('Unsupported input image class.');
end
out = table{classIndex, 2}(in);
revertclass = table{classIndex, 3};
错误提示:
Undefined function 'tofloat' for input arguments of
type 'double'.
Error in fig43 (line 8)
[f, revertclass] = tofloat(f);
展开