如何在Matlab中设置检测树木的阈值?
我是 Matlab 新手。我有一张照片,其中包括一座建筑物、一个人、一条小河和一些树。我需要对绿色带进行阈值设置(我猜)来检测具有侵蚀膨胀等的树木。但是,我似乎甚至无法制作图像颜色的直方图。我认为图片中的所有其他对象也有一些绿色(我使用 myImage(:,:,2) < 130 ),不仅是绿色,而且几乎所有其他对象都在二进制图片中(该人的黑色外套、河流等)。你能告诉我一种方法吗?我想先得到一个直方图,但不知道如何使用它。
myImage = imread('myIm.JPG');
?? imhist(myImage);不起作用。
任何帮助将不胜感激。
如果我什至设法获得直方图,我如何使用它来检测树木?我可以同时设置绿色和其他颜色的阈值吗?
I am new in Matlab. I have a picture which includes a building,a person, a small river and some trees. I need to threshold the green band (I guess) to detect trees with erosion dilation etc. However, I can't seem to even make an histogram of the image's colors. All the other objects in the picture also have some green in it I think (i used myImage(:,:,2) < 130 ) and not only greens, but almost all the other objects were there in the binary picture (the person's black coat, river etc.). Can you tell me a way to do this? I want to get a histogram first, not sure how to use it though.
myImage = imread('myIm.JPG');
?? imhist(myImage); doesn't work.
Any help would be appreciated.
If I even manage to get an histogram, how can I use it to detect the trees? Can I both threshold green and other colors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可能想首先将图像转换为另一个颜色空间,例如 HSV。
你可以这样做:
然后你的直方图将指示所有不同的色调。
You probably want to first convert your image into another color space, like the HSV.
You could do something like:
Then your histogram will indicate all the different hues.
使用matlab中的hist()函数获取彩色图像
use the hist() function in matlab for color images