clear
I = imread('C:\Users\admin\Desktop\书稿图片再加工\3.3.8.png');
figure
imshow(I);
% I = I(72:232,579:599,:);
iimag = double(reshape(I,[],3));
cmap = jet(256)*256;
cmap = [cmap;[255,255,255];[0,0,0]];
cmaphot = hot(256)*256;
cmaphot = [cmaphot;[255,255,255];[0,0,0]];
for i = 1:length(iimag)
% aa = find(cmap==squeeze(iimag(i,:)));
for ii = 1:258
aa(ii) = norm(cmap(ii,:)-squeeze(iimag(i,:)));
end
[aaa,id] = min(aa);
if isempty(aa)
indexx(i) = 258;
% elseif iimag(i,1)==iimag(i,2) && iimag(i,1)==iimag(i,3) && iimag(i,1)~=255
% indexx(i) = 258;
else
indexx(i) = id;
end
%
end
for i = 1:length(iimag)
imaghot(i,:) = cmaphot(indexx(i),:);
end
figure
Isize = size(I);
imshow(uint8(reshape(imaghot,[Isize(1),Isize(2),3])))
04-29
2008
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交