解决MATLAB中的内存不足错误

时间:2015-01-08 05:52:32

标签: image matlab compression fractals

在我为分形图像压缩编写的代码中,我得到了一个错误:

Out of memory. Type HELP MEMORY for your options.

Error in tformarray (line 228)
    B(prod(fsize_B)) = A(1);

Error in imtransform (line 275)
B = tformarray(args.A, args.tform, args.resampler, tdims_a, tdims_b, ...

Error in test1_UI (line 85)
        I = imtransform(I,tform);

我该如何解决这个问题?

我发现这种情况的代码如下:

[optimizer, metric] = imregconfig('monomodal');
% find the affine transformation from the damain block to range block

    for rR=1:nrR
        for cR=1:ncR
            i=1;
            for rd=1:nrD
                for cd=1:ncD
                    s(i)= ssim(caR{rR,cR},imresize(caD{rd,cd},[64 64]));
                    if s(i)== d(rR,cR)
                        tformO = imregtform(caD{rd,cd},caR{rR,cR},'affine',optimizer,metric);
                        T(rR,cR) = tformO;
                    else
                        i=i+1;
                    end
                end
            end
            d(rR,cR) = max(s);
        end
    end

    clear d

    % A - any initial image
    A = imread('lena_jpgx80.jpg');
    I = A;

    for rR=1:nrR
        for cR=1:ncR
            tform = maketform('affine',T(rR,cR).T);
            I = imtransform(I,tform);
            i=i+1;
        end
    end

    imshow(I)

0 个答案:

没有答案