@@ -117,15 +117,15 @@ void non_max_supression(struct ggml_tensor* result, struct ggml_tensor* G, struc
117117 }
118118}
119119
120- void threshold_hystersis (struct ggml_tensor * img, float highThreshold , float lowThreshold , float weak, float strong) {
120+ void threshold_hystersis (struct ggml_tensor * img, float high_threshold , float low_threshold , float weak, float strong) {
121121 int n_elements = ggml_nelements (img);
122122 float * imd = (float *)img->data ;
123123 float max = -INFINITY;
124124 for (int i = 0 ; i < n_elements; i++) {
125125 max = imd[i] > max ? imd[i] : max;
126126 }
127- float ht = max * highThreshold ;
128- float lt = ht * lowThreshold ;
127+ float ht = max * high_threshold ;
128+ float lt = ht * low_threshold ;
129129 for (int i = 0 ; i < n_elements; i++) {
130130 float img_v = imd[i];
131131 if (img_v >= ht) { // strong pixel
@@ -162,7 +162,7 @@ void threshold_hystersis(struct ggml_tensor* img, float highThreshold, float low
162162 }
163163}
164164
165- uint8_t * preprocess_canny (uint8_t * img, int width, int height, float highThreshold = 0 . 08f , float lowThreshold = 0 . 08f , float weak = 0 . 8f , float strong = 1 . 0f , bool inverse = false ) {
165+ uint8_t * preprocess_canny (uint8_t * img, int width, int height, float high_threshold , float low_threshold , float weak, float strong, bool inverse) {
166166 struct ggml_init_params params;
167167 params.mem_size = static_cast <size_t >(10 * 1024 * 1024 ); // 10
168168 params.mem_buffer = NULL ;
@@ -207,7 +207,7 @@ uint8_t* preprocess_canny(uint8_t* img, int width, int height, float highThresho
207207 normalize_tensor (G);
208208 prop_arctan2 (iX, iY, tetha);
209209 non_max_supression (image_gray, G, tetha);
210- threshold_hystersis (image_gray, highThreshold, lowThreshold , weak, strong);
210+ threshold_hystersis (image_gray, high_threshold, low_threshold , weak, strong);
211211 // to RGB channels
212212 for (int iy = 0 ; iy < height; iy++) {
213213 for (int ix = 0 ; ix < width; ix++) {
0 commit comments