Skip to content

Commit

Permalink
style(note): 注释纹理特征度量
Browse files Browse the repository at this point in the history
  • Loading branch information
zjZSTU committed Feb 21, 2020
1 parent b89eff3 commit 2438843
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,15 @@
#include "../include/selectivesearch/selective_search_segmentation_strategy_texture_impl.h"

namespace segmentation {

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

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

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

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

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

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

cv::Mat tmp_gradiant;
Expand Down

0 comments on commit 2438843

Please sign in to comment.