[prev in list] [next in list] [prev in thread] [next in thread] 

List:       scilab-users
Subject:    Re: [Scilab-users] {EXT} How to count pixels
From:       Tan Chin Luh <chinluh () tritytech ! com>
Date:       2019-06-10 4:25:32
Message-ID: 33b35ac1-67fe-e39e-fd76-dfb6e466197a () tritytech ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


Hi,

sorry to interrupt, the following lines should work in IPCV to count the 
white and black pixels:

1. after imread, the image return as boolean as the image is an binary 
image.

2. assume that you have previous code and imread the image and the 
scilab variable for the image is "img"

--> sum(img==%t)   // total white pixels
  ans  =
    273370.
--> sum(img==%f) // total black pixels
  ans  =
    7230.

hope this helps.

rgds,
Chin Luh

On 7/6/2019 7:03 PM, P M wrote:
> ... the code should work under win7 if you have the *scicv*-module 
> installed via atoms.
> Note that you have to "activate" scicv to use its functions....hence the:
> scicv_Init();
> at the beginning of the code.
>
> I wrote the code at win10, but I doubt that this has an influence.
>
> Good luck,
> Philipp
>
>
> Am Fr., 7. Juni 2019 um 12:16 Uhr schrieb Jean-Philippe Grivet 
> <jean-philippe.grivet@wanadoo.fr 
> <mailto:jean-philippe.grivet@wanadoo.fr>>:
>
>     Hello Philipp,
>
>     Thank you for your program, it looks like it would do exactly what I
>     wanted. However (as I should have stressed before) I work under
>     win7. In
>     this environment, the only image processing toolbox is IPCV in which
>     several functions are lacking, namely
>
>          scicv_Init(); matplot(); Mat_cols_get(); Mat_rows_get()
>
>     Further, in my case, img appears as a matrix of booleans (?).
>
>     I will try to download SIVP and determine the role of these functions.
>
>     Thank you,again
>
>     Jean-Philippe
>
>
>     ---
>     L'absence de virus dans ce courrier électronique a été vérifiée
>     par le logiciel antivirus Avast.
>     https://www.avast.com/antivirus
>
>     _______________________________________________
>     users mailing list
>     users@lists.scilab.org <mailto:users@lists.scilab.org>
>     http://lists.scilab.org/mailman/listinfo/users
>
>
> _______________________________________________
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


-- 
Tan Chin Luh
Trity Technologies Sdn Bhd
Tel : +603 80637737
HP : +6013 3691728


[Attachment #5 (text/html)]

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  </head>
  <body text="#000000" bgcolor="#FFFFFF">
    <p>Hi, <br>
    </p>
    <p>sorry to interrupt, the following lines should work in IPCV to
      count the white and black pixels:</p>
    <p>1. after imread, the image return as boolean as the image is an
      binary image.</p>
    <p>2. assume that you have previous code and imread the image and
      the scilab variable for the image is "img"<br>
      <br>
      --&gt; sum(img==%t)   // total white pixels<br>
       ans  =<br>
         273370.<br>
      --&gt; sum(img==%f) // total black pixels<br>
       ans  =<br>
         7230.<br>
    </p>
    <div class="moz-cite-prefix">hope this helps.</div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">rgds,<br>
      Chin Luh<br>
    </div>
    <div class="moz-cite-prefix"><br>
    </div>
    <div class="moz-cite-prefix">On 7/6/2019 7:03 PM, P M wrote:<br>
    </div>
    <blockquote type="cite"
cite="mid:CACf7ODthoQjVypEdNk3C_1guY-NA-_F44-xA3TEGcqXw2Et7Fg@mail.gmail.com">
      <meta http-equiv="content-type" content="text/html; charset=UTF-8">
      <div dir="ltr">
        <div>... the code should work under win7 if you have the <b>scicv</b>-module
          installed via atoms.</div>
        <div>Note that you have to "activate" scicv to use its
          functions....hence the: <br>
        </div>
        <div>
          <pre style="font-family:Monospaced;font-style:normal"><span \
style="color:rgb(50,185,185)">scicv_Init</span><span \
style="color:rgb(74,85,219)">(</span><span style="color:rgb(74,85,219)">)</span><span \
style="color:rgb(0,0,0)">;</span></pre>  </div>
        <div>at the beginning of the code.</div>
        <div><br>
        </div>
        <div>I wrote the code at win10, but I doubt that this has an
          influence.<br>
        </div>
        <div><br>
        </div>
        <div>Good luck,</div>
        <div>Philipp<br>
        </div>
        <div><br>
        </div>
      </div>
      <br>
      <div class="gmail_quote">
        <div dir="ltr" class="gmail_attr">Am Fr., 7. Juni 2019 um
          12:16 Uhr schrieb Jean-Philippe Grivet &lt;<a
            href="mailto:jean-philippe.grivet@wanadoo.fr"
            moz-do-not-send="true">jean-philippe.grivet@wanadoo.fr</a>&gt;:<br>
        </div>
        <blockquote class="gmail_quote" style="margin:0px 0px 0px
          0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hello
          Philipp,<br>
          <br>
          Thank you for your program, it looks like it would do exactly
          what I <br>
          wanted. However (as I should have stressed before) I work
          under win7. In <br>
          this environment, the only image processing toolbox is IPCV in
          which <br>
          several functions are lacking, namely<br>
          <br>
               scicv_Init(); matplot(); Mat_cols_get(); Mat_rows_get()<br>
          <br>
          Further, in my case, img appears as a matrix of booleans (?).<br>
          <br>
          I will try to download SIVP and determine the role of these
          functions.<br>
          <br>
          Thank you,again<br>
          <br>
          Jean-Philippe<br>
          <br>
          <br>
          ---<br>
          L'absence de virus dans ce courrier électronique a été
          vérifiée par le logiciel antivirus Avast.<br>
          <a href="https://www.avast.com/antivirus" rel="noreferrer"
            target="_blank" \
moz-do-not-send="true">https://www.avast.com/antivirus</a><br>  <br>
          _______________________________________________<br>
          users mailing list<br>
          <a href="mailto:users@lists.scilab.org" target="_blank"
            moz-do-not-send="true">users@lists.scilab.org</a><br>
          <a href="http://lists.scilab.org/mailman/listinfo/users"
            rel="noreferrer" target="_blank" \
moz-do-not-send="true">http://lists.scilab.org/mailman/listinfo/users</a><br>  \
</blockquote>  </div>
      <br>
      <fieldset class="mimeAttachmentHeader"></fieldset>
      <pre class="moz-quote-pre" \
wrap="">_______________________________________________ users mailing list
<a class="moz-txt-link-abbreviated" \
href="mailto:users@lists.scilab.org">users@lists.scilab.org</a> <a \
class="moz-txt-link-freetext" \
href="http://lists.scilab.org/mailman/listinfo/users">http://lists.scilab.org/mailman/listinfo/users</a>
 </pre>
    </blockquote>
    <p><br>
    </p>
    <pre class="moz-signature" cols="72">-- 
Tan Chin Luh
Trity Technologies Sdn Bhd
Tel : +603 80637737
HP : +6013 3691728
</pre>
  </body>
</html>



_______________________________________________
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic