How can I detect if the backgroud is brighter than the coins or it's darker?
1 次查看(过去 30 天)
显示 更早的评论
For example:
It is important because when I make a binary image out of them, than I have to invert the image to be able to count it. (I have to invert the one with a brighter background) What is the best solution for this problem?
0 个评论
回答(1 个)
Walter Roberson
2016-2-28
Examine the 4 corners. rgb2gray them, find out how many are > 128. If at least 3 are > 128 then you have a bright background.
This is not fool-proof. A solid bright red or bright blue background would have a brightness less than 128 after conversion to grayscale, but a solid bright green background would, so that tells you that you need to pin down more closely what you mean by "bright background"
0 个评论
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Histograms 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!