好吧,所以我有一个直方图(由一组整数表示),我正在寻找找到局部最大值和最小值的最佳方法.每个直方图应该有3个峰值,其中一个(第一个)可能比其他峰值高得多.
我想做几件事:
在第一个峰值之后找到第一个"山谷"(为了完全消除图中的第一个峰值)
找到剩余两个峰之间的最佳"谷值"以分离图片
我已经知道如何通过实现Otsu的变体来执行第2步.但我正在努力迈出第1步
如果两个剩余峰值之间的山谷不够低,我想发出警告.
此外,图像非常干净,几乎没有噪音
执行步骤1和3的蛮力算法是什么?我可以找到一种方法来实现Otsu,但是数学方面的蛮力正在逃避我.事实证明,有更多关于像otsu这样的方法的文档,而不是简单地找到峰值和谷值.我不是在寻找任何比完成工作更多的东西(即它是一个临时解决方案,只需要在合理的时间范围内实施,直到我可以花更多的时间在它上面)
我在c#中做这一切
任何有关采取哪些步骤的帮助将不胜感激!非常感谢!
编辑:更多数据:
大多数直方图可能与第一个直方图相似,第一个峰值代表背景.
image-processing mathematical-optimization histogram image-segmentation c#-4.0
即使我认为有限的集合有数据(我在调试中检查过),我当前的实现也没有在表单上显示任何内容.
这是一些代码:
public event PropertyChangedEventHandler PropertyChanged;
PointCollection imagePoints;
public PointCollection ImagePoints
{
get
{
return this.imagePoints;
}
set
{
if (this.imagePoints != value)
{
this.imagePoints = value;
if (this.PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs("ImagePoints"));
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
和相应的xaml:
<Polygon x:Name="imagePolygon" Points="{Binding ImagePoints}" Stretch="Fill" Fill="Black" Opacity="0.8" />
Run Code Online (Sandbox Code Playgroud)
现在,我通过编写代码完成了所有绑定.在这个例子中,它工作正常,但在我的情况下,点不会出现在多边形上.
有智慧的珍珠吗?
编辑:这是完整的xaml代码
<Window
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d" x:Class="WpfApplication2.HistogramWindow"
Title="HistogramWindow" Height="436" Width="604">
<Grid>
<TabControl HorizontalAlignment="Left" Height="406" VerticalAlignment="Top" Width="596" >
<TabItem x:Name="imageTab" Header="Full Image" Height="23" VerticalAlignment="Top">
<Border BorderBrush="Black" BorderThickness="1" Margin="10"> …
Run Code Online (Sandbox Code Playgroud)