How do I count the total number of objects detected?

I'm trying to make a counter to count the number of objects detected. I have followed the relevant webinars and used the Image Processing Toolbox to identify 4 objects with these solidity:
COMMAND WINDOWS
[imageStats(:).Solidity]
ans =
0.8787 0.9547 0.7749 0.9721
I need a counter to count the number of object with solidity above 0.7, and display "Total number of objects detected: 4" Can anyone help me with this?

 Accepted Answer

sum([imageStats(:).Solidity]>0.7)

2 Comments

Thank you! I figured this out while searching up other questions as well. Thank you for your help! :)
I have a follow-up to this counter.
I need it to reset every hour. which means the counter = sum([imageStats(:).Solidity]>0.7) will be zeroed every hour.
If anyone can help me out further, I will appreciate it!

Sign in to comment.

More Answers (0)

Products

Release

R2020a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!