Skip to content
This repository was archived by the owner on Nov 5, 2022. It is now read-only.
This repository was archived by the owner on Nov 5, 2022. It is now read-only.

How to understand the meaning of the conv operations in the function "RenderHistorgramGaussian"? #14

@lixiaohui2020

Description

@lixiaohui2020

hi,
@jonbarron, thanks for sharing the codes of the ffcc. I can't understand the meaning of the conv operations in the function "RenderHistorgramGaussian". The code is as follow,

% Threshold the mahalanobis distance at 3 to make a binary mask, which is
% dilated to produce an ellipse with a dot in the center.
mask = mahal_dist <= 3;
prediction = (conv2(double(mask), ones(3,3), 'same') > 0) & ~mask;
prediction = prediction | (conv2(double(mahal_dist == min(mahal_dist(:))), [0, 1, 0; 1, 1, 1; 0, 1, 0], 'same') > 0);

% Optionally create a mask with the ground-truth white point rendered as a dot.
if ~isempty(mu_true)
  D = (us - mu_true(1)).^2 + (vs - mu_true(2)).^2;
  truth = D == min(D(:));
  truth = (conv2(double(truth), [0, 1, 0; 1, 1, 1; 0, 1, 0], 'same') > 0);
  truth = (conv2(double(truth), [0, 1, 0; 1, 1, 1; 0, 1, 0], 'same') > 0);

I want to ask the questions,

  1. What's the meaning of the function conv2(double(mask), ones(3,3), 'same') > 0) ?
  2. I can understand the formula about mahal_dist == min(mahal_dist(:) to get the ellipse of the minmum distance. However, i can't understand why to run the conv operation of the formula conv2(double(mahal_dist == min(mahal_dist(:))), [0, 1, 0; 1, 1, 1; 0, 1, 0], 'same') and why to chose the matrix [0, 1, 0; 1, 1, 1; 0, 1, 0] .
  3. Why are the two same conv operations with conv2(double(truth), [0, 1, 0; 1, 1, 1; 0, 1, 0], 'same') ?

Look forward to your favourable reply !
@jonbarron

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions