Skip to content

Commit 0d51172

Browse files
committed
normalize to screen size
1 parent 86041d1 commit 0d51172

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

SerialPrograms/Source/ML/Programs/ML_LabelImages.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -452,6 +452,7 @@ void LabelImages::change_annotation_selection_by_mouse(double x, double y){
452452
if (source_image_width == 0 || source_image_height == 0 || m_annotations.size() == 0){
453453
return;
454454
}
455+
const size_t screen_normalize_factor = (source_image_height/1080);
455456

456457
std::pair<size_t, size_t> p = float_to_pixel(x, y);
457458

@@ -468,7 +469,7 @@ void LabelImages::change_annotation_selection_by_mouse(double x, double y){
468469
}
469470
if (d2 < closest_distance){
470471
closest_distance = d2;
471-
if (d2 < 500){
472+
if (d2 < (500 * screen_normalize_factor * screen_normalize_factor)){
472473
m_selected_obj_idx = i; // only select the object if the mouse click is very close to the object box, or within it.
473474
}
474475

0 commit comments

Comments
 (0)