Demo entry 6775429

image1

   

Submitted by anonymous on Nov 25, 2018 at 08:02
Language: Matlab. Code size: 721 Bytes.

clc;
clear;

image = imread('image1-1.jpg');

[M,N,G] = size(image);

img = image;

for g = 1:3
    A = zeros(1,256);
    
    average = 0;
    
    for k = 1:256
        count = 0;
        for i = 1:N
            for j = 1:N
                value = image(i,j,g);
                if value == k
                    count = count + 1;
                end
            end
        end
        
        count = count / M /N;
        average = average + count;
        A(k) = average;
    end
    A=uint8(255.*A+0.5);
    for i=1:M
        for j=1:N
            img(i,j,g)=A(image(i,j,g)+0.5);
        end
    end
end

figure();
subplot(1,2,1);imshow(image);
subplot(1,2,2);imshow(img);

This snippet took 0.01 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).