Skip to content

Commit 2438843

Browse files
committed
style(note): 注释纹理特征度量
1 parent b89eff3 commit 2438843

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

cplusplus/src/selective_search_segmentation_strategy_texture_impl.cpp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
#include "../include/selectivesearch/selective_search_segmentation_strategy_texture_impl.h"
66

77
namespace segmentation {
8+
9+
/*
10+
* 计算纹理特征的方向导数直方图
11+
* 1. 分离图像各通道
12+
* 2. 使用scharr + thresh进行求导操作
13+
* 3. 分别计算左/右、上/下、左上/右下、左下/右上的方向导数
14+
* 4. 转换求导结果的取值到[0, 255]
15+
* 5. 手动计算直方图(不再利用OpenCV进行多个直方图计算再进行连接)并进行标准化
16+
*/
817
void SelectiveSearchSegmentationStrategyTextureImpl::setImage(
918
cv::InputArray img_, cv::InputArray regions_, cv::InputArray sizes_, int image_id) {
1019

@@ -25,13 +34,16 @@ namespace segmentation {
2534
minMaxLoc(regions, &min, &max);
2635
int nb_segs = (int) max + 1;
2736

37+
// 计算每个区域不同通道的方向导数直方图
2838
histogram_size = histogram_bins_size * img.channels() * 8;
2939

3040
histograms = cv::Mat_<float>(nb_segs, histogram_size);
3141

3242
// Compute, for each channels, the 8 gaussians
3343
std::vector<cv::Mat> img_gaussians;
3444

45+
// 通过Schaar方法进行高斯平滑和差分
46+
// 计算上/下/左/右以及右上角/右下角/左上角/左下角的方向导数直方图
3547
for (int p = 0; p < img.channels(); p++) {
3648

3749
cv::Mat tmp_gradiant;

0 commit comments

Comments
 (0)