Skip to content

Commit

Permalink
Using the dIxy mean instead of Canny mean --> NOK.
Browse files Browse the repository at this point in the history
  • Loading branch information
s-trinh committed Nov 9, 2024
1 parent 3e4ca97 commit 5cd7d64
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions tutorial/imgproc/brightness/tutorial-compare-auto-gamma.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,12 +209,16 @@ double getGammaCorrectionBST(const vpImage<unsigned char> &I_ori, vpCannyEdgeDet
double gamma_left = (gamma_min + gamma_current) / 2;
double mean_left = 0;
process(I, I_gamma, gamma_left, cannyDetector, gaussianKernelSize, gaussianStdev, apertureSize, filteringType, dIxy_uchar, I_canny_visp);
mean_left = I_canny_visp.getMeanValue();
// TODO:
// mean_left = I_canny_visp.getMeanValue();
mean_left = dIxy_uchar.getMeanValue();

double gamma_right = (gamma_current + gamma_max) / 2;
double mean_right = 0;
process(I, I_gamma, gamma_right, cannyDetector, gaussianKernelSize, gaussianStdev, apertureSize, filteringType, dIxy_uchar, I_canny_visp);
mean_right = I_canny_visp.getMeanValue();
// TODO:
// mean_right = I_canny_visp.getMeanValue();
mean_right = dIxy_uchar.getMeanValue();

if (mean_left > mean_right) {
gamma_current = gamma_left;
Expand Down Expand Up @@ -558,7 +562,7 @@ int main(int argc, const char **argv)
snprintf(buffer, FILENAME_MAX, "gamma_BST (%.2f) (%.2f ms)", gamma_BST, (end_time-start_time));
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y, offset_text2*I_res_stack.getWidth()), vpColor::red);
// Canny
snprintf(buffer, FILENAME_MAX, "Canny mean: (%.2f)", I_canny_visp.getMeanValue());
snprintf(buffer, FILENAME_MAX, "Mean Canny / dIxy: (%.2f) / (%.2f)", I_canny_visp.getMeanValue(), dIxy_uchar.getMeanValue());
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y+text_h, offset_text2*I_res_stack.getWidth()), vpColor::red);
// Entropy
snprintf(buffer, FILENAME_MAX, "Entropy: %.3f", img_corrected_entropy);
Expand Down Expand Up @@ -591,7 +595,7 @@ int main(int argc, const char **argv)
snprintf(buffer, FILENAME_MAX, "gamma_BST_entropy (%.2f) (%.2f ms)", gamma_BST_entropy, (end_time-start_time));
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y, offset_text2*I_res_stack.getWidth()), vpColor::red);
// Canny
snprintf(buffer, FILENAME_MAX, "Canny mean: (%.2f)", I_canny_visp.getMeanValue());
snprintf(buffer, FILENAME_MAX, "Mean Canny / dIxy: (%.2f) / (%.2f)", I_canny_visp.getMeanValue(), dIxy_uchar.getMeanValue());
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y+text_h, offset_text2*I_res_stack.getWidth()), vpColor::red);
// Entropy
snprintf(buffer, FILENAME_MAX, "Entropy: %.3f", img_corrected_entropy);
Expand Down Expand Up @@ -634,7 +638,7 @@ int main(int argc, const char **argv)
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y,
offset_text2*I_res_stack.getWidth()), vpColor::red);
// Canny
snprintf(buffer, FILENAME_MAX, "Canny mean: (%.2f)", I_canny_visp.getMeanValue());
snprintf(buffer, FILENAME_MAX, "Mean Canny / dIxy: (%.2f) / (%.2f)", I_canny_visp.getMeanValue(), dIxy_uchar.getMeanValue());
font.drawText(I_res_stack, buffer, vpImagePoint(offset_idx*I_color.getHeight() + offset_text_start_y+text_h,
offset_text2*I_res_stack.getWidth()), vpColor::red);
// Entropy
Expand Down

0 comments on commit 5cd7d64

Please sign in to comment.