hi i have problem with the memory when i was applying filters for the jpg image

1 次查看(过去 30 天)
this is my code
clear;
clc;
pic=imread('C:\masters courses\applications of dsp\project2\GW_1200.jpg');
subplot(3,3,1);
image(pic);
title('original image');
a1=fspecial('average');
t1=conv2(pic,a1);
subplot(3,3,2);
image(t1);
title('Average of image GW_1200');
a2=fspecial('gaussian');
t2=conv2(pic,a2);
subplot(3,3,3);
image(t2);
title('Gaussian of image GW_1200');
a3=fspecial('log');
t3=conv2(pic,a3);
subplot(3,3,4);
image(t3);
title('Log of image GW_1200');
a4=fspecial('sobel');
t4=conv2(pic,a4);
subplot(3,3,5);
image(t4);
title('Sobel of image GW_1200');
a5=fspecial('disk');
t5=conv2(pic,a5);
subplot(3,3,6);
image(t5);
title('Circular of image GW_1200');
a6=fspecial('laplacian');
t6=conv2(pic,a6);
subplot(3,3,7);
image(t6);
title('Laplacian of image GW_1200');
a7=fspecial('motion');
t7=conv2(pic,a7);
subplot(3,3,8);
image(t7);
title('Motion of image GW_1200');
a8=fspecial('prewitt');
t8=conv2(pic,a8);
subplot(3,3,9);
image(t8);
title('Prewitt of image GW_1200');
and i am getting the error as
Warning: CONV2 on values of class UINT8 is obsolete.
Use CONV2(DOUBLE(A),DOUBLE(B)) or CONV2(SINGLE(A),SINGLE(B)) instead.
> In uint8.conv2 at 10
In project2_7 at 8
Error using double
Out of memory. Type HELP MEMORY for your options.
Error in uint8/conv2 (line 13)
varargin{k} = double(varargin{k});
Error in project2_7 (line 8)
t1=conv2(pic,a1);
i am new to matlab how do i overcome this error,

采纳的回答

Image Analyst
Image Analyst 2014-6-24
So why didn't you just do what it says: cast to double?
t1 = conv2(double(pic), a1);
And you should definitely put in some comments and spaces to improve readability and maintainability.

更多回答(1 个)

seshi reddy
seshi reddy 2014-6-24
thank you so much.

Community Treasure Hunt

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

Start Hunting!

Translated by