开发者

Percentage of white pixel

开发者 https://www.devze.com 2022-12-30 23:46 出处:网络
After performing processing I want to calculate the percentage of white pixels between this images after the change.

After performing processing I want to calculate the percentage of white pixels between this images after the change.

I'm doing this: var = (int2str(nnz(Img2)) / in开发者_运维问答t2str(nnz(Img1))) * 100;

but it returns as result ]

What's the problem ?


The function INT2STR is only needed to convert an integer value to a string (usually for the purpose of displaying it). If you just want the numerical value, leave that out:

var = 100*nnz(Img2)/nnz(Img1);

If you now want to turn var into a string value, you can use NUM2STR (since var is likely not going to be an integer value any more):

varString = num2str(var);
0

精彩评论

暂无评论...
验证码 换一张
取 消