-1
\$\begingroup\$

After doing certain pre processing on image serialized image will be obtained. Once we do thresh holding binary image will be displayed. How do I count the number of white pixels in a binary image using xilinx system generator blocks?

If I consider the image below: The result should be

No. of white pixels = 3

No. of black pixels = 17

enter image description here

\$\endgroup\$
  • 1
    \$\begingroup\$ You want to determine the exact number of white pixels or number of white patches in the image after processing it? \$\endgroup\$ – Durgaprasad Mar 11 '15 at 6:41
  • \$\begingroup\$ Thanks for your reply. After binarization certain pixels will be in black(0) and some other will be white(1).I want number of ones.How to count this using xilinx block sets.Since the image will be in serialized form i.e single vector ,do we have to write mcode.Here am not doing post processing,just count values I will be giving to gateway out. \$\endgroup\$ – Shalini C Mar 12 '15 at 16:31
  • \$\begingroup\$ Check whether the edit is right or not? \$\endgroup\$ – Durgaprasad Mar 12 '15 at 16:54
  • \$\begingroup\$ Durgaprasad sir whatever u said is correct. \$\endgroup\$ – Shalini C Mar 13 '15 at 19:36
  • \$\begingroup\$ matlab code I can count ,I just have to give sum...but in sysgen how to do..I dont think I can use count inside mcode. \$\endgroup\$ – Shalini C Mar 13 '15 at 19:38
1
\$\begingroup\$

A simple algorithm to find the number of white and black pixels could be as given below: Run a loop throughout the image and keep comparing the image value with '0' and '1' and have counter to count the number of white and black pixels. This somehow you have to manage to write in Xilinx.

\$\endgroup\$
  • \$\begingroup\$ mcode does not support loop ,do we have any alternative methods \$\endgroup\$ – Shalini C Mar 18 '15 at 3:01
  • \$\begingroup\$ If it doesn't support loop then how did you convert the image to binary format? Do you have some inbuilt functions? \$\endgroup\$ – Durgaprasad Mar 18 '15 at 7:51
  • \$\begingroup\$ conversion of image is done using simulink blocks i,e.conversion from 2D to 1D. After serialization xilinx blocks are used. \$\endgroup\$ – Shalini C Mar 24 '15 at 1:25
  • \$\begingroup\$ Don't you have any provision to count the number of white pixels in Simulink itself using the above said method? \$\endgroup\$ – Durgaprasad Mar 24 '15 at 4:34
  • \$\begingroup\$ I dint find any other method \$\endgroup\$ – Shalini C Mar 25 '15 at 10:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.