Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Image analysis problem

yuvalmaimona

Newbie
Joined
Mar 27, 2021
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
10
i'm trying to take a photo of blood cell and paint each one with a different grey level in Matlab.
Can you help me find out what's wrong my code?

Code:
global img1 A B;
img=imread('cell.bmp');
A=size(img,1);
B=size(img,2);
c=gray(256);
img1=zeros (A,B)
val=0;

for x=1:A
    for y=1:B
        if img(x,y)==0 &&img1(x,y)==0
           val=val+1;
           seg(img,val,x,y)
        end
    end
end

max_val=val;
img1=abs(255-img1*(255/max_val));
figure(1)
subplot(2,1,1);
image(img1)
colormap(c)
subplot(2,1,2);
imhist(img1,c);


function seg(image, val, x, y)
    global img1 A B;
    img1(x,y)=val;
    for i=-1:1
        for j=-1:1
            if (x > 1 && y > 1) && (x < A && y <B)
                if img1(x+i,y+j)==0&&...
                    img1(x+i,y+i)==0
                    seg(img1,val,x+i,y+j)
                end
            end
        end
    end
end

thanks for your help!
 
Last edited by a moderator:

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,284
Helped
4,272
Reputation
8,547
Reaction score
4,236
Trophy points
1,393
Activity points
127,990
Hi,

You give a riddle. We should try to find out what this undocumented code is supposed to do?

This takes much time and relies on guessing. So we may solve the riddle or not.
You have to prove our replies.

Why that much effort for us and for you? Why not simply give useful informations?
This also will motivate more members to reply and help you.

Klaus
 

LaTeX Commands Quick-Menu:

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top