Discover MakerZone

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn more

Discover what MATLAB® can do for your career.

Opportunities for recent engineering grads.

Apply Today

Thread Subject:
I need help for "region extract"

Subject: I need help for "region extract"

From: Hoang Quyet

Date: 19 Jan, 2011 15:41:05

Message: 1 of 6

Hi all,
Here is my image that I want to do my experiment on. Please take a glance on it before giving me some keywords or suggestions
http://lh5.ggpht.com/_X1Bj3EzcymM/TTcEhXpk7VI/AAAAAAAAEXE/Na9iwVzMOXQ/s512/demo.jpg

I want to identify the largest white area on this image. (I mean how to remove the surrounding black area).

I need your help, thanks in advanced

Subject: I need help for "region extract"

From: Sean de

Date: 19 Jan, 2011 15:54:05

Message: 2 of 6

"Hoang Quyet" <quyethm@gmail.com> wrote in message <ih70mh$5bd$1@fred.mathworks.com>...
> Hi all,
> Here is my image that I want to do my experiment on. Please take a glance on it before giving me some keywords or suggestions
> http://lh5.ggpht.com/_X1Bj3EzcymM/TTcEhXpk7VI/AAAAAAAAEXE/Na9iwVzMOXQ/s512/demo.jpg
>
> I want to identify the largest white area on this image. (I mean how to remove the surrounding black area).
>
> I need your help, thanks in advanced

1) Calculate the BoundingBox using regionprops.
2) Extract it.

Subject: I need help for "region extract"

From: ImageAnalyst

Date: 19 Jan, 2011 18:30:06

Message: 3 of 6

On Jan 19, 10:41 am, "Hoang Quyet" <quye...@gmail.com> wrote:
> Hi all,
> Here is my image that I want to do my experiment on. Please take a glance on it before giving me some keywords or suggestionshttp://lh5.ggpht.com/_X1Bj3EzcymM/TTcEhXpk7VI/AAAAAAAAEXE/Na9iwVzMOXQ...
>
> I want to identify the largest white area on this image. (I mean how to  remove the surrounding black area).
>
> I need your help, thanks in advanced

------------------------------------------------
Define what "remove the surrounding black area" means. The white area
is not a rectangle so you can't completely get rid of all the black
surround. You can crop it to the bounding box of the white region,
but you will still have some black around it.

Subject: I need help for "region extract"

From: Dominique

Date: 19 Jan, 2011 18:56:05

Message: 4 of 6

Ok, i find a part of the problem... See my code below... if i remove the code between the %%%%%%%, the programme run correctly.

But if i keep it, i have a probleme whit the second iteration....

It's my first programe in matlab and i need it for... yesterday. I'm discouraged.


function test
clc
clear

    data=[140 0.15 72 0.15 60 0.15;
        160 0.2 73 0.2 62 0.2;
        170 0.5 74 0.5 64.5 0.95;
        180 1 75.999 1 65 1;
        190 1 76.001 1 66.5 1;
        200 0.8 77 0.85 67 0.8;
        215 0.2 78 0.2 68 0.2
        235 0.15 79 0.15 70 0.15];
    
    echelle=[140 235 71 80 59 71];

C=horzcat(data(:,1), data(:,3),data(:,5));
D=horzcat(data(:,2), data(:,4),data(:,6));
I=horzcat(0, echelle(1), echelle(3),echelle(5));
S=horzcat(0, echelle(2), echelle(4),echelle(6));

for i = 1:3
    
    syms b1 t1 b2 t2 b4 t4 b5 t5
    eq11=exp(-b1*abs(C(1,i)-C(4,i))^t1)-D(1,i);
    eq21=exp(-b1*abs(C(2,i)-C(4,i))^t1)-D(2,i);
    eq12=exp(-b2*abs(C(2,i)-C(4,i))^t2)-D(2,i);
    eq22=exp(-b2*abs(C(3,i)-C(4,i))^t2)-D(3,i);
    eq14=exp(-b4*abs(C(6,i)-C(5,i))^t4)-D(6,i);
    eq24=exp(-b4*abs(C(7,i)-C(5,i))^t4)-D(7,i);
    eq15=exp(-b5*abs(C(8,i)-C(5,i))^t5)-D(8,i);
    eq25=exp(-b5*abs(C(7,i)-C(5,i))^t5)-D(7,i);

    [b1 t1]=Solve(eq11,eq21,'b1','t1');
    [b2 t2]=Solve(eq12,eq22,'b2','t2');
    [b4 t4]=Solve(eq14,eq24,'b4','t4');
    [b5 t5]=Solve(eq15,eq25,'b5','t5');
       
    b(i+1,:)=[double(b1),double(b2),0,double(b4),double(b5)]
    t(i+1,:)=[double(t1),double(t2),0,double(t4),double(t5)]
     
    z1 = linspace(I(i+1),C(2,i),101);
    z2 = linspace(C(2,i),C(4,i),101);
    z3 = linspace(C(4,i),C(5,i),11);
    z4 = linspace(C(5,i),C(7,i),101);
    z5 = linspace(C(7,i),S(i+1),101);
    z6(i+1,:)=horzcat(z1,z2,z3,z4,z5)

    r1=exp(-b(i+1,1).*abs(z1-C(4,i)).^t(i+1,1));
    r2=exp(-b(i+1,2).*abs(z2-C(4,i)).^t(i+1,2));
    r3=1+(0*z3);
    r4=exp(-b(i+1,4).*abs(z4-C(5,i)).^t(i+1,4));
    r5=exp(-b(i+1,5).*abs(z5-C(5,i)).^t(i+1,5));
    
    d(i+1,:) = horzcat(r1, r2,r3,r4,r5)

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
ndata = xlsread('Données.xls', 'c9');
donne=ndata;
nbr=size(donne);
nbrdonne=nbr(1);
    for n = 1:nbrdonne;
        D(1,n)=0; D12(1,n)=0;
        if donne(n,i)<C(2,i);
            D(i+1,n)=exp(-b(i+1,1)*abs(donne(n,1)-C(4,i)).^t(i+1,1));
        elseif ((donne(n,i)<C(4,i)) && (donne(n,i)>=C(2,i)));
            D(i+1,n)=exp(-b(i+1,2)*abs(donne(n,1)-C(4,i)).^t(i+1,2));
        
        elseif donne(n,1)>C(7,i);
            D(i+1,n)=exp(-b(i+1,5)*abs(donne(n,1)-C(5,i)).^t(i+1,5));

        elseif ((donne(n,i)>C(5,i)) && (donne(n,i)<=C(7,i)));
            D(i+1,n)=exp(-b(i+1,4)*abs(donne(n,1)-C(5,i)).^t(i+1,4));
        else
            D(i+1,n)=1+(0*donne(n,i));
        end
    end
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 
end
figure(1)
    subplot(221),plot(z6(2,:),d(2,:),'-','LineWidth', 2);axis([ I(2) S(2) 0 1.1]),grid,title('Fonction Desirabilité y2');
    subplot(223),plot(z6(3,:),d(3,:),'-','LineWidth', 2);axis([ I(3) S(3) 0 1.1]),grid,title('Fonction Desirabilité Y3');
    subplot(224),plot(z6(4,:),d(4,:),'-','LineWidth', 2);axis([ I(4) S(4) 0 1.1]),grid,title('Fonction Desirabilité Y4');

end

Subject: I need help for "region extract"

From: ImageAnalyst

Date: 19 Jan, 2011 20:43:17

Message: 5 of 6

I see a "syms" in there. Sorry, but I don't have Simulink so I can't
try this. Plus I've never used solve() and don't know if it's in any
of my toolboxes. That, plus the lack of any comments explaining what
is going on (because it doesn't look like cropping to me) make me not
want to try this at all.

Subject: I need help for "region extract"

From: Think two, count blue.

Date: 19 Jan, 2011 21:25:33

Message: 6 of 6

On 11-01-19 02:43 PM, ImageAnalyst wrote:
> I see a "syms" in there. Sorry, but I don't have Simulink so I can't
> try this. Plus I've never used solve() and don't know if it's in any
> of my toolboxes.

syms() and solve() are both part of the Symbolic Toolbox.

Tags for this Thread

What are tags?

A tag is like a keyword or category label associated with each thread. Tags make it easier for you to find threads of interest.

Anyone can tag a thread. Tags are public and visible to everyone.

Contact us