scilab - 在图像上实现日志功能

时间:2017-01-17 08:31:41

标签: image-processing scilab

我想对图像应用日志功能。但它未能显示此错误:function is not defined on this type of argument

uk=imread('image.jpg');
result=log(uk(:,:,1));

1 个答案:

答案 0 :(得分:1)

我认为您的问题是imread会返回uint8类型的矩阵。要应用log,您应将其转换为double。至少有两种方法可以做到这一点,一种是内置的,一种来自SIVP:

clc;
clear;
im = imread("d:\Attila\PROJECTS\Scilab\Stackoverflow\mixer_crop.jpg");
//imshow(im);
disp(typeof(im(:,:,1)),"Original type:");

//use double
M = double(im(:,:,1));
disp(typeof(M),"Modified type:");
result=log(M);
//imshow(uint8(M));

//use im2double
M2 = im2double(im);
disp(typeof(M2(:,:,1)),"Modified type 2:");
result=log(M2(:,:,1));
//imshow(im2uint8(M2));