[Scilab-users] {EXT} How to count pixels

Tan Chin Luh chinluh at tritytech.com
Mon Jun 10 06:25:32 CEST 2019


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 at wanadoo.fr 
> <mailto:jean-philippe.grivet at 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 at lists.scilab.org <mailto:users at lists.scilab.org>
>     http://lists.scilab.org/mailman/listinfo/users
>
>
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


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

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20190610/f20c518b/attachment.htm>


More information about the users mailing list