[Git][debian-gis-team/jeolib-miallib][master] 8 commits: New upstream version 1.1.7
Bas Couwenberg (@sebastic)
gitlab at salsa.debian.org
Sat Oct 25 08:45:01 BST 2025
Bas Couwenberg pushed to branch master at Debian GIS Project / jeolib-miallib
Commits:
e0792e76 by Bas Couwenberg at 2025-10-25T09:07:59+02:00
New upstream version 1.1.7
- - - - -
ab0f9666 by Bas Couwenberg at 2025-10-25T09:08:01+02:00
Update upstream source from tag 'upstream/1.1.7'
Update to upstream version '1.1.7'
with Debian dir e03d47bf65a440404a88e7563bc71c66a599f8dc
- - - - -
4de9a0e6 by Bas Couwenberg at 2025-10-25T09:08:46+02:00
New upstream release.
- - - - -
aa7b333f by Bas Couwenberg at 2025-10-25T09:11:07+02:00
Update copyright file.
- - - - -
65d11f4f by Bas Couwenberg at 2025-10-25T09:12:19+02:00
Drop patches, applied upstream.
- - - - -
bb023741 by Bas Couwenberg at 2025-10-25T09:15:27+02:00
Update symbols for 1.1.7.
- - - - -
451b3473 by Bas Couwenberg at 2025-10-25T09:36:28+02:00
Simplify rules.
- - - - -
ffd105fc by Bas Couwenberg at 2025-10-25T09:36:28+02:00
Set distribution to unstable.
- - - - -
17 changed files:
- CMakeLists.txt
- core/c/convolve.c
- core/c/dcluster.c
- core/c/miallib.h
- + core/c/myhull.c
- − core/c/myhull.cc
- core/c/myhull.h
- core/c/registration.c
- core/c/setreg.c
- core/c/uswilk.c
- debian/changelog
- debian/copyright
- debian/libmiallib1.symbols
- − debian/patches/gcc-15.patch
- − debian/patches/series
- − debian/patches/spelling-errors.patch
- debian/rules
Changes:
=====================================
CMakeLists.txt
=====================================
@@ -32,7 +32,7 @@ set(MIALLIB_LIB_NAME miallib)
set (MIALLIB_VERSION_MAJOR 1)
set (MIALLIB_VERSION_MINOR 1)
-set (MIALLIB_VERSION_PATCH 6)
+set (MIALLIB_VERSION_PATCH 7)
set (MIALLIB_VERSION "${MIALLIB_VERSION_MAJOR}.${MIALLIB_VERSION_MINOR}.${MIALLIB_VERSION_PATCH}")
set (MIALLIB_SOVERSION "${MIALLIB_VERSION_MAJOR}")
@@ -198,7 +198,7 @@ set(SOURCES
${MIALLIB_SRC_DIR}/mslabel.h
${MIALLIB_SRC_DIR}/msmm.c
${MIALLIB_SRC_DIR}/mspa.c
- ${MIALLIB_SRC_DIR}/myhull.cc
+ ${MIALLIB_SRC_DIR}/myhull.c
${MIALLIB_SRC_DIR}/myhull.h
${MIALLIB_SRC_DIR}/natngbint.c
${MIALLIB_SRC_DIR}/newlabelcc.c
=====================================
core/c/convolve.c
=====================================
@@ -1014,7 +1014,7 @@ IMAGE *mean2dse(IMAGE *im, IMAGE *imse, int ox, int oy)
}
return NULL;
}
-extern ERROR_TYPE write_tiff();
+extern ERROR_TYPE write_tiff(IMAGE *im, char *fn);
#include "uc_def.h"
=====================================
core/c/dcluster.c
=====================================
@@ -26,7 +26,7 @@ along with miallib. If not, see <https://www.gnu.org/licenses/>.
-extern ERROR_TYPE us_plotline();
+extern ERROR_TYPE us_plotline(IMAGE *im, int x1, int y1, int x2, int y2, int val);
ERROR_TYPE agglo_cluster(int *x, int *y, int *pn, double maxdst)
=====================================
core/c/miallib.h
=====================================
@@ -355,8 +355,8 @@ extern void stdputstr(char *); /* print a message to the standard output */
extern void errputstr(char *); /* print a message to the standard error */
#else
static char buf[1024]; /* used by sprintf() and stdputstr() */
-extern void stdputstr(); /* print a message to the standard output */
-extern void errputstr(); /* print a message to the standard error */
+extern void stdputstr(char *); /* print a message to the standard output */
+extern void errputstr(char *); /* print a message to the standard error */
#endif /* #if (defined(XLISP)) */
#endif
=====================================
core/c/myhull.c
=====================================
@@ -0,0 +1,342 @@
+/***********************************************************************
+Author(s): Pierre Soille
+ Pieter Kempeneers
+Copyright (C) 2010-2025 European Union (Joint Research Centre)
+ 2025 Francesco Lovergine <francesco at lovergine.com>
+
+This file is part of miallib.
+
+miallib is free software: you can redistribute it and/or modify
+it under the terms of the GNU General Public License as published by
+the Free Software Foundation, either version 3 of the License, or
+(at your option) any later version.
+
+miallib is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with miallib. If not, see <https://www.gnu.org/licenses/>.
+***********************************************************************/
+
+/* first 20101004 for convex hull and enclosing rectangle for building detection */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <math.h>
+#include <string.h>
+
+#include "miallib.h"
+#include "fifo.h"
+#include "myhull.h"
+
+#ifdef OPENMP
+#include <omp.h>
+#endif
+
+/* Function to compare two points for sorting */
+int intpair_compare(const void *a, const void *b) {
+ const intpair_t *pa = (const intpair_t *)a;
+ const intpair_t *pb = (const intpair_t *)b;
+
+ if (pa->a < pb->a) return -1;
+ if (pa->a > pb->a) return 1;
+ if (pa->b < pb->b) return -1;
+ if (pa->b > pb->b) return 1;
+ return 0;
+}
+
+/* Calculate the orientation of three points (counterclockwise, collinear, or clockwise) */
+int orientation(intpair_t p, intpair_t q, intpair_t r) {
+ return (q.b - p.b) * (r.a - q.a) - (q.a - p.a) * (r.b - q.b);
+}
+
+/* Function to find the convex hull using Andrew's monotone chain algorithm */
+int chainHull_2D(intpair_t *points, int n, intpair_t *hull) {
+ /* Sort the points lexicographically (first by x, then by y) */
+ qsort(points, n, sizeof(intpair_t), intpair_compare);
+
+ int k = 0; /* Index for hull array */
+
+ /* Build lower hull */
+ for (int i = 0; i < n; i++) {
+ while (k >= 2 && orientation(hull[k-2], hull[k-1], points[i]) <= 0) {
+ k--;
+ }
+ hull[k++] = points[i];
+ }
+
+ /* Build upper hull */
+ int t = k + 1; /* t points to the start of upper hull in the output array */
+ for (int i = n - 2; i >= 0; i--) {
+ while (k >= t && orientation(hull[k-2], hull[k-1], points[i]) <= 0) {
+ k--;
+ }
+ hull[k++] = points[i];
+ }
+
+ /* Remove the last point which is a duplicate of the first point */
+ if (k > 1) k--;
+
+ return k; /* Return the number of points in the hull */
+}
+
+/* Sorting function for integers
+int intsort(const void *a, const void *b) {
+ int _a = *(int*)a;
+ int _b = *(int*)b;
+ return _a - _b;
+} */
+
+#include "u32_def.h"
+#define MY_LUT_TYPE UINT32
+#define t_MY_LUT_TYPE t_UINT32
+
+IMAGE *u32_chull(IMAGE *ilbl, int graph) {
+ /* Processing based on contour representation:
+ only points with change of direction are kept.
+ Use MSB for flagging.
+ assumes border is set to zero to avoid border overflow.
+ */
+ G_TYPE *pg;
+ IMAGE *lut;
+ MY_LUT_TYPE *plut;
+ PIX_TYPE *plbl, maxlbl, lbl;
+ IMAGE *imout;
+ UCHAR *pout;
+ int nx = GetImNx(ilbl);
+ long int i, npix, pos; // openMP requires signed loop index
+
+ // Defines the neighborhood offset position from current position and the neighborhood
+ // position we want to check next if we find a new border at checkLocationNr
+ // 1 2 3
+ // 0 x 4
+ // 7 6 5
+ int neighborhood[8][2] = {
+ {-1, 7}, // red
+ {-1-nx, 7}, // green
+ {-nx, 1}, // blue
+ {-nx+1, 1}, // yellow
+ {1, 3}, // magenta
+ {1+nx, 3}, // cyan
+ {nx, 5}, // white
+ {nx-1, 5} // grey
+ };
+
+ if (graph != 8)
+ graph = 4;
+ if (graph == 4) {
+ // - 1 -
+ // 0 x 2
+ // - 3 -
+ neighborhood[0][0] = -1; // red
+ neighborhood[0][1] = 4;
+ neighborhood[1][0] = -nx; // green
+ neighborhood[1][1] = 1;
+ neighborhood[2][0] = 1; // blue
+ neighborhood[2][1] = 2;
+ neighborhood[3][0] = nx; // yellow
+ neighborhood[3][1] = 3;
+ }
+
+ imout = (IMAGE *)create_image(t_UCHAR, GetImNx(ilbl), GetImNy(ilbl), 1);
+ if (imout == NULL)
+ return NULL;
+
+ /* get min & max values */
+ pg = min_max(ilbl);
+ if (pg == NULL)
+ return(NULL);
+ maxlbl = pg[1].u32_val;
+ free((char *)pg);
+
+ lut = (IMAGE *)create_image(t_MY_LUT_TYPE, maxlbl+1, 1, 1);
+ if (lut == NULL) {
+ free_image(imout);
+ return NULL;
+ }
+ plut = (MY_LUT_TYPE *)GetImPtr(lut);
+ plbl = (PIX_TYPE *)GetImPtr(ilbl);
+ pout = (UCHAR *)GetImPtr(imout);
+ npix = GetImNPix(ilbl);
+
+ plut[0] = 1; // dummy value to speed-up next loop
+ /* first collect first point of each CC in an array
+ for subsequent parallel processing */
+ for (i = 0; i < npix; i++) {
+ if (plut[plbl[i]] == 0) {
+ plut[plbl[i]] = i;
+ }
+ }
+
+ /* process one cc at a time */
+#ifdef OPENMP
+#pragma omp parallel for private(lbl, pos)
+#endif
+ for (i = 1; i <= maxlbl; i++) { // lbl==0 for background or border
+ int checkLocationNr = 1; // The neighbor number of the location we want to check for a
+ // new border point
+ int checkPosition; // The corresponding absolute array address of checkLocationNr
+ int newCheckLocationNr; // Variable that holds the neighborhood position we want to
+ // check if we find a new border at checkLocationNr
+ long int startPos = plut[i]; // Set start position
+ int counter = 0; // Counter is used for the jacobi stop criterion
+ int counter2 = 0; // Counter2 is used to determine if the point we have discovered
+ // is one single point
+ int prevCheckLocationNr = 9; // init with dummy direction
+ int n = 0; // number of points with change of direction
+ int nh = 0; // number of points in convex hull
+
+ intpair_t ip;
+ intpair_t *pairs = NULL;
+ int pairs_size = 0;
+ int pairs_capacity = 32; // Initial capacity of the dynamic array
+ int j;
+
+ // Allocate initial memory for the pairs array
+ pairs = (intpair_t *)malloc(pairs_capacity * sizeof(intpair_t));
+ if (pairs == NULL) {
+ continue; // Skip this label if memory allocation fails
+ }
+
+ if (startPos != 0) {
+ lbl = plbl[startPos];
+ pout[startPos] = 9; // mark pixel as border
+ pos = startPos;
+
+ // Trace around the neighborhood
+ while(1) {
+ checkPosition = pos + neighborhood[checkLocationNr-1][0];
+ newCheckLocationNr = neighborhood[checkLocationNr-1][1];
+
+ if (plbl[checkPosition] == lbl) { // Next border point found
+ if (checkPosition == startPos) {
+ pout[pos] = checkLocationNr; // direction of next border point
+
+ // set to 9 if point of change of direction
+ if (checkLocationNr != prevCheckLocationNr) {
+ pout[pos] = 9;
+ pout[checkPosition] = 9;
+ prevCheckLocationNr = checkLocationNr;
+ ip.a = pos % nx; // x coor
+ ip.b = pos / nx; // y coor
+
+ // Add point to the pairs array, resize if needed
+ if (n >= pairs_capacity) {
+ pairs_capacity *= 2;
+ intpair_t *temp = (intpair_t *)realloc(pairs, pairs_capacity * sizeof(intpair_t));
+ if (temp == NULL) {
+ free(pairs);
+ break; // Memory allocation failed
+ }
+ pairs = temp;
+ }
+ pairs[n++] = ip;
+ }
+
+ counter++;
+ // Stopping criterion (jacob)
+ if (newCheckLocationNr == 1 || counter >= 1) { // Close loop
+ break;
+ }
+ }
+ pout[pos] = checkLocationNr; // direction of next border point
+
+ // set to 9 if point of change of direction
+ if (checkLocationNr != prevCheckLocationNr) {
+ pout[pos] = 9;
+ pout[checkPosition] = 9;
+ prevCheckLocationNr = checkLocationNr;
+ ip.a = pos % nx; // x coor
+ ip.b = pos / nx; // y coor
+
+ // Add point to the pairs array, resize if needed
+ if (n >= pairs_capacity) {
+ pairs_capacity *= 2;
+ intpair_t *temp = (intpair_t *)realloc(pairs, pairs_capacity * sizeof(intpair_t));
+ if (temp == NULL) {
+ free(pairs);
+ break; // Memory allocation failed
+ }
+ pairs = temp;
+ }
+ pairs[n++] = ip;
+ }
+
+ checkLocationNr = newCheckLocationNr; // Update which neighborhood position we should check next
+ pos = checkPosition;
+ counter2 = 0; // Reset the counter that keeps track of how many neighbors we have visited
+ } else {
+ // Rotate clockwise in the neighborhood
+ checkLocationNr = 1 + (checkLocationNr % graph);
+ if (counter2 > graph) {
+ // If counter2 is above graph we have traced around the neighborhood and
+ // therefore the border is a single black pixel and we can exit
+ counter2 = 0;
+ ip.a = pos % nx; // x coor
+ ip.b = pos / nx; // y coor
+
+ // Add point to the pairs array, resize if needed
+ if (n >= pairs_capacity) {
+ pairs_capacity *= 2;
+ intpair_t *temp = (intpair_t *)realloc(pairs, pairs_capacity * sizeof(intpair_t));
+ if (temp == NULL) {
+ free(pairs);
+ break; // Memory allocation failed
+ }
+ pairs = temp;
+ }
+ pairs[n++] = ip;
+ break;
+ } else {
+ counter2++;
+ }
+ }
+ }
+
+ if (n > 0) {
+ // Allocate memory for the hull
+ intpair_t *hull = (intpair_t *)calloc((size_t)n+1, sizeof(intpair_t));
+ if (hull == NULL) {
+ fprintf(stderr, "Cannot allocate %lu bytes for point array in convex hull computation of lbl=%u\n",
+ (unsigned long)(n+1)*sizeof(intpair_t), lbl);
+ free(pairs);
+ continue;
+ }
+
+ // Compute the convex hull
+ nh = chainHull_2D(pairs, n, hull);
+
+ // Mark the hull points in the output image
+ for (j = 0; j < nh; j++) {
+ pout[hull[j].a + hull[j].b * nx] = 10;
+ }
+
+ free(hull);
+ }
+
+ free(pairs);
+ } // startPos != 0
+ } // for each label
+
+ free_image(lut);
+ return imout;
+}
+#undef MY_LUT_TYPE
+#undef t_MY_LUT_TYPE
+#include "u32_undef.h"
+
+// chull: use outercontour name for convenience in developing
+IMAGE *chull(IMAGE *ilbl, int graph) {
+ switch (GetImDataType(ilbl)) {
+
+ case t_UINT32:
+ return u32_chull(ilbl, graph);
+ break;
+
+ default:
+ fprintf(stderr, "ERROR in chull(IMAGE *ilbl, int graph): invalid ImDataType\n");
+ return(NULL);
+ }
+}
=====================================
core/c/myhull.cc deleted
=====================================
@@ -1,351 +0,0 @@
-/***********************************************************************
-Author(s): Pierre Soille
- Pieter Kempeneers (repaced ut_vector with std::vector and
- re-implemented chainHull_2D for license)
-Copyright (C) 2010-2024 European Union (Joint Research Centre)
-
-This file is part of miallib.
-
-miallib is free software: you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation, either version 3 of the License, or
-(at your option) any later version.
-
-miallib is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with miallib. If not, see <https://www.gnu.org/licenses/>.
-***********************************************************************/
-
-/* first 20101004 for convex hull and enclosing rectangle for building detection */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <math.h>
-#include <vector>
-#include <string>
-#include <algorithm>
-#include <iostream>
-
-#include "myhull.h"
-extern "C" {
-#include "miallib.h"
-#include "fifo.h"
-}
-#ifdef OPENMP
-#include <omp.h>
-#endif
-
-// Function to find the convex hull using Andrew's monotone chain algorithm
-std::vector<intpair_t> chainHull_2D(std::vector<intpair_t>& points){
- std::sort(points.begin(), points.end(), [](const intpair_t& a, const intpair_t& b) {
- return a.a < b.a || (a.a == b.a && a.b < b.b);
- });
-
- auto orientation = [](intpair_t p, intpair_t q, intpair_t r){
- return (q.b - p.b) * (r.a - q.a) - (q.a - p.a) * (r.b - q.b);
- };
-
- std::vector<intpair_t> hull;
-
- // Build lower hull
- for (const intpair_t& p : points){
- while (hull.size() >= 2 && orientation(hull[hull.size() - 2], hull[hull.size() - 1], p) <= 0){
- hull.pop_back();
- }
- hull.push_back(p);
- }
-
- // Build upper hull
- for (int i = points.size() - 2, t = hull.size() + 1; i >= 0; i--){
- const intpair_t& p = points[i];
- while (hull.size() >= t && orientation(hull[hull.size() - 2], hull[hull.size() - 1], p) <= 0){
- hull.pop_back();
- }
- hull.push_back(p);
- }
-
- // Remove duplicates from hull
- hull.pop_back();
-
- return hull;
-}
-
-
-// #include <utarray.h>
-
-int intsort(const void *a,const void*b) {
- int _a = *(int*)a;
- int _b = *(int*)b;
- return _a - _b;
-}
-
-// int intpairsort(const void *a,const void*b) {
-// intpair_t _a = *(intpair_t*)a;
-// intpair_t _b = *(intpair_t*)b;
-// return _a.a < _b.a || (_a.a == _b.a && _a.b < _b.b);
-// }
-
-// extern double polygonArea(intpair_t *P, int points);
-// extern int chainHull_2D( intpair_t * P, int n, intpair_t * H );
-
-
-/** \addtogroup group_opclo
- * @{
- */
-
-
-#include "u32_def.h"
-#define MY_LUT_TYPE UINT32
-#define t_MY_LUT_TYPE t_UINT32
-IMAGE *u32_chull(IMAGE *ilbl, int graph)
-{
-
- /* Processing based on contour representation:
- only points with change of direction are kept.
- Use MSB for flagging.
- assumes border is set to zero to avoid border overflow.
- Pierre Soille
- First 20100930 (for building footprint characterisation)
- Pieter Kempeneers 13/09/2024: replace utarray with c++ std::vector
- and reimplement hull for license issue
-
- based on Moore's contour tracing algorithm with Jacob's condition, see
- http://www.thebigblob.com/moore-neighbor-contour-tracing-algorithm-in-c/
- by Erik Smistad (see local file moore_tracing.c)
- extended for label images as well as omp speed-up and graph.
- Also, speed-up since I start always from ulcx!
- Additional image not actually necessary (coding in MSB is enough)
- but used to return an image with mask of outer edge pixels set to 1 (others to 0).
- */
- G_TYPE *pg;
- IMAGE *lut;
- MY_LUT_TYPE *plut;
- PIX_TYPE *plbl, maxlbl, lbl;
- IMAGE *imout;
- UCHAR *pout;
- int nx=GetImNx(ilbl);
- long int i, npix, pos; // openMP requires signed loop index
-
- // Defines the neighborhood offset position from current position and the neighborhood
- // position we want to check next if we find a new border at checkLocationNr
- // 1 2 3
- // 0 x 4
- // 7 6 5
- int neighborhood[8][2] = {
- {-1,7}, // red
- {-1-nx,7}, // green
- {-nx,1}, // blue
- {-nx+1,1}, // yellow
- {1,3}, // magenta
- {1+nx,3}, // cyan
- {nx,5}, // white
- {nx-1,5} // grey
- };
-
- if (graph!=8)
- graph=4;
- if (graph==4){
- // - 1 -
- // 0 x 2
- // - 3 -
- neighborhood[0][0] = -1; // red
- neighborhood[0][1] = 4;
- neighborhood[1][0] = -nx; // green
- neighborhood[1][1] = 1;
- neighborhood[2][0] = 1; // blue
- neighborhood[2][1] = 2;
- neighborhood[3][0] = nx; // yellow
- neighborhood[3][1] = 3;
- }
-
- imout=(IMAGE *)create_image(t_UCHAR, GetImNx(ilbl), GetImNy(ilbl), 1);
- if (imout==NULL)
- return NULL;
-
- /* get min & max values */
- pg = min_max(ilbl);
- if (pg == NULL)
- return(NULL);
- maxlbl = pg[1].u32_val;
- free((char *)pg);
-
- lut= (IMAGE *)create_image(t_MY_LUT_TYPE, maxlbl+1, 1, 1);
- if (lut==NULL){
- free_image(imout);
- return NULL;
- }
- plut =(MY_LUT_TYPE *)GetImPtr(lut);
- plbl =(PIX_TYPE *)GetImPtr(ilbl);
- pout =(UCHAR *)GetImPtr(imout);
- npix =GetImNPix(ilbl);
-
- plut[0]=1; // dummy value to speed-up next loop
- /* first collect first point of each CC in an array
- for subsequent parallel processing */
- for (i=0;i<npix;i++){
- if (plut[plbl[i]]==0){
- plut[plbl[i]]=i;
- }
- }
-
- /* process one cc at a time */
-#ifdef OPENMP
-#pragma omp parallel for private(lbl, pos)
-#endif
- for (i=1; i<=maxlbl; i++){ // lbl==0 for background or border
- int checkLocationNr = 1;// The neighbor number of the location we want to check for a
- // new border point
- int checkPosition; // The corresponding absolute array address of checkLocationNr
- int newCheckLocationNr; // Variable that holds the neighborhood position we want to
- // check if we find a new border at checkLocationNr
- long int startPos = plut[i]; // Set start position
- int counter = 0; // Counter is used for the jacobi stop criterion
- int counter2 = 0; // Counter2 is used to determine if the point we have discovered
- // is one single point
- int prevCheckLocationNr = 9; // init with dummy direction
- int n = 0; // number of points with change of direction
- int nh = 0; // number of points in convex hull
-
- // UT_array *pairs;
- // UT_icd intpair_icd = {sizeof(intpair_t), NULL, NULL, NULL};
- // intpair_t ip, *ph, *phori;
- intpair_t ip;
- std::vector<intpair_t> ph;
- int j;
-
- // utarray_new(pairs,&intpair_icd);
- std::vector<intpair_t> pairs;
- // utarray_new(pairs,&intpair_icd);
-
- if (startPos!=0){
- lbl=plbl[startPos];
- //IFMSB plbl[startPos]|=PIX_MSB; // mark pixel as border
- pout[startPos]=9; // mark pixel as border
- pos=startPos;
-
- // Trace around the neighborhood
- while(1){
- checkPosition = pos + neighborhood[checkLocationNr-1][0];
- newCheckLocationNr = neighborhood[checkLocationNr-1][1];
-
- if( plbl[checkPosition] == lbl) { // Next border point found
- if(checkPosition == startPos){
-
- pout[pos]=checkLocationNr; // direction of next border point
-
- // set to 9 if point of change of direction
- if (checkLocationNr!=prevCheckLocationNr){
- pout[pos]=9;
- pout[checkPosition]=9;
- prevCheckLocationNr=checkLocationNr;
- ip.a=pos%nx; // x coor
- ip.b=pos/nx; // y coor
- pairs.push_back(ip);
- // utarray_push_back(pairs, &ip);
- n++;
- }
-
- counter ++;
- // Stopping criterion (jacob)
- if(newCheckLocationNr == 1 || counter >= 1) { // Close loop
- break;
- }
- }
- pout[pos]=checkLocationNr; // direction of next border point
-
- // set to 9 if point of change of direction
- if (checkLocationNr!=prevCheckLocationNr){
- pout[pos]=9;
- pout[checkPosition]=9;
- prevCheckLocationNr=checkLocationNr;
- ip.a=pos%nx; // x coor
- ip.b=pos/nx; // y coor
- pairs.push_back(ip);
- // utarray_push_back(pairs, &ip);
- n++;
- }
-
- checkLocationNr = newCheckLocationNr;// Update which neighborhood position we should check next
- pos = checkPosition;
- counter2 = 0; // Reset the counter that keeps track of how many neighbors we have visited
- }
- else{
- // Rotate clockwise in the neighborhood
- checkLocationNr = 1 + (checkLocationNr % graph);
- if(counter2 > graph){
- // If counter2 is above 8 we have traced around the neighborhood and
- // therefore the border is a single black pixel and we can exit
- counter2 = 0;
- ip.a=pos%nx; // x coor
- ip.b=pos/nx; // y coor
- pairs.push_back(ip);
- // utarray_push_back(pairs, &ip);
- n++;
- break;
- }
- else{
- counter2 ++;
- }
- }
- }
- //printf("n=%d\n", n);
-
- // ph=phori=(intpair_t *)calloc((size_t) n+1, sizeof(intpair_t));
- ph.resize(n+1);
-
- // if (ph==NULL){
- // printf("cannot allocate %ld bytes for point array in convex hull computation of lbl=%ud\n", \
- // (n+1)*sizeof(intpair_t), lbl);
- // utarray_free(pairs);
- // continue;
- // }
- // utarray_sort(pairs, &intpairsort);
- // nh=chainHull_2D( (intpair_t *)utarray_eltptr(pairs, 0), n, ph );
-
- ph = chainHull_2D(pairs);
- //printf("nh=%d\n", nh);
-
- for (auto it = ph.begin(); it!=ph.end(); ++it)
- pout[it->a + it->b *nx] = 10;
-
- // for(j=0; j<nh; j++)
- // pout[ph[j].a + ph[j].b * nx]=10;
-
- // free(phori);
-
- // utarray_free(pairs);
- } // startPos != 0
- } // for each label
- free_image(lut);
-
- return imout;
-}
-#undef MY_LUT_TYPE
-#undef t_MY_LUT_TYPE
-#include "u32_undef.h"
-
-
-
-// chull: use outercontour name for convenience in developing
-IMAGE *chull(IMAGE *ilbl, int graph)
-{
- switch (GetImDataType(ilbl)){
-
- case t_UINT32:
- return u32_chull(ilbl, graph);
- break;
-
- default:
- std::cerr << "ERROR in chull chull(IMAGE *ilbl, int graph): invalid ImDataType" << std::endl;
- // (void)sprintf(buf, "ERROR in chull(IMAGE *ilbl, int graph): \
- // invalid ImDataType\n"); errputstr(buf);
- return(NULL);
- }
-}
-
-
-/*@}*/
=====================================
core/c/myhull.h
=====================================
@@ -1,5 +1,6 @@
/***********************************************************************
Author(s): Pieter Kempeneers
+ Francesco Lovergine <autobot at lovergine.com>
Copyright (C) 2000-2024 European Union (Joint Research Centre)
This file is part of miallib.
@@ -19,20 +20,31 @@ along with miallib. If not, see <https://www.gnu.org/licenses/>.
***********************************************************************/
/*
-** Header file for myhull.cc
+** Header file for myhull.c
*/
#ifndef _MYHULL_H
#define _MYHULL_H
-#include <vector>
-
/* for point with integer coordinates */
typedef struct {
int a;
int b;
} intpair_t;
-std::vector<intpair_t> chainHull_2D(std::vector<intpair_t>& points);
-
-#endif /* _MYHULL_H */
\ No newline at end of file
+/* Function to find the convex hull using Andrew's monotone chain algorithm
+ * points: array of input points
+ * n: number of input points
+ * hull: pre-allocated array to store the resulting hull points (should be at least n+1 in size)
+ * returns: number of points in the hull
+ */
+int chainHull_2D(intpair_t *points, int n, intpair_t *hull);
+
+/* Compute convex hull of an image with labels
+ * ilbl: input labeled image
+ * graph: connectivity (4 or 8)
+ * returns: image with hull points marked
+ */
+IMAGE *chull(IMAGE *ilbl, int graph);
+
+#endif /* _MYHULL_H */
=====================================
core/c/registration.c
=====================================
@@ -61,7 +61,7 @@ IMAGE *uc_ssda(IMAGE *imin, IMAGE *imt, int xi, int yi, int w)
/* check w leads to windows falling in imin */
if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
(yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
- (void)sprintf(buf,"*ssda(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
+ (void)sprintf(buf,"*ssda(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
return NULL;
}
@@ -141,7 +141,7 @@ IMAGE *us_ssda(IMAGE *imin, IMAGE *imt, int xi, int yi, int w)
/* check w leads to windows falling in imin */
if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
(yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
- (void)sprintf(buf,"*ssda(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
+ (void)sprintf(buf,"*ssda(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
return NULL;
}
@@ -248,7 +248,7 @@ IMAGE *uc_ncclewis(IMAGE *imin, IMAGE *imt, IMAGE *sim, IMAGE *ssqim, int xi, in
/* check w leads to windows falling in imin */
if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
(yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
return NULL;
}
@@ -386,7 +386,7 @@ IMAGE *uc_ncc(IMAGE *imin, IMAGE *imt, int xi, int yi, int w)
/* check w leads to windows falling in imin */
if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
(yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
return NULL;
}
@@ -482,7 +482,7 @@ IMAGE *us_ncc(IMAGE *imin, IMAGE *imt, int xi, int yi, int w)
/* check w leads to windows falling in imin */
if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
(yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
return NULL;
}
=====================================
core/c/setreg.c
=====================================
@@ -34,9 +34,9 @@ along with miallib. If not, see <https://www.gnu.org/licenses/>.
*/
extern int cluster();
-extern ERROR_TYPE agglo_cluster();
-extern ERROR_TYPE nearest_cluster();
-extern ERROR_TYPE knearest_cluster();
+extern ERROR_TYPE agglo_cluster(int *x, int *y, int *pn, double maxdst);
+extern ERROR_TYPE nearest_cluster(IMAGE *im, int *x, int *y, int *pn, double maxdst);
+extern ERROR_TYPE knearest_cluster(IMAGE *im, int *x, int *y, int *pn, int k, double maxdst);
#define set_mean_type(TYPE1, TYPE2, i1, i2) \
{\
@@ -162,7 +162,7 @@ extern ERROR_TYPE knearest_cluster();
} \
}
-extern IMBLOB *create_blob();
+extern IMBLOB *create_blob(LBL_TYPE n);
=====================================
core/c/uswilk.c
=====================================
@@ -1505,7 +1505,7 @@ int MAXROIVAL = 65534; /* pixels outside ROI should be at 255,
int OUTROI = 65535;
-extern ERROR_TYPE set_seq_shift();
+extern ERROR_TYPE set_seq_shift(long int , long int , long int , long int , long int *);
void GreyAttributeClosingROI ( double lambdaVal, /* threshold on attribute */
int width, /* image width */
=====================================
debian/changelog
=====================================
@@ -1,14 +1,19 @@
-jeolib-miallib (1.1.6-3) UNRELEASED; urgency=medium
+jeolib-miallib (1.1.7-1) unstable; urgency=medium
* Team upload.
+ * New upstream release.
* Don't include debian revision in symbols version.
* Update symbols for 32-bit architectures.
* Enable Salsa CI.
* Bump Standards-Version to 4.7.2, no changes.
* Update lintian overrides.
* Drop Rules-Requires-Root: no, default since dpkg 1.22.13.
+ * Update copyright file.
+ * Drop patches, applied upstream.
+ * Update symbols for 1.1.7.
+ * Simplify rules.
- -- Bas Couwenberg <sebastic at debian.org> Tue, 25 Feb 2025 05:23:10 +0100
+ -- Bas Couwenberg <sebastic at debian.org> Sat, 25 Oct 2025 09:15:55 +0200
jeolib-miallib (1.1.6-2) unstable; urgency=medium
=====================================
debian/copyright
=====================================
@@ -14,9 +14,10 @@ License: BSD-2-clause
Files: CMakeLists.txt
core/c/*
-Copyright: 2000-2023, European Union (Joint Research Centre).
- 2000, Michael Wilkinson, Arnold Meijster, and Jos Roerdink.
- 2000, Pierre Soille.
+Copyright: 2000, Michael Wilkinson, Arnold Meijster, and Jos Roerdink.
+ 2000, Pierre Soille.
+ 2000-2025, European Union (Joint Research Centre).
+ 2025, Francesco Lovergine <francesco at lovergine.com>
License: GPL-3+
Files: core/c/uswilk.c
=====================================
debian/libmiallib1.symbols
=====================================
@@ -67,14 +67,6 @@ libmiallib.so.1 #PACKAGE# #MINVER#
StackPush at Base 1.1.5
SurfaceAttribute at Base 1.1.5
WriteMialibIm at Base 1.1.5
- _Z12chainHull_2DRSt6vectorI9intpair_tSaIS0_EE at Base 1.1.6
- _Z5chullP5IMAGEi at Base 1.1.6
- _Z7intsortPKvS0_ at Base 1.1.6
- _Z9u32_chullP5IMAGEi at Base 1.1.6
- _ZNKSt5ctypeIcE8do_widenEc at Base 1.1.6
- (arch-bits=32)_ZNSt6vectorI9intpair_tSaIS0_EE17_M_default_appendEj at Base 1.1.6
- (arch-bits=64)_ZNSt6vectorI9intpair_tSaIS0_EE17_M_default_appendEm at Base 1.1.6
- _ZNSt6vectorI9intpair_tSaIS0_EE17_M_realloc_appendIJRKS0_EEEvDpOT_ at Base 1.1.6
addLineToLinePool at Base 1.1.5
addLineToRegion at Base 1.1.5
addPointToLine at Base 1.1.5
@@ -112,7 +104,9 @@ libmiallib.so.1 #PACKAGE# #MINVER#
cda at Base 1.1.5
cdainf at Base 1.1.5
ced at Base 1.1.5
+ chainHull_2D at Base 1.1.7
chamfer2d at Base 1.1.5
+ chull at Base 1.1.7
class2d at Base 1.1.5
classstatsinfo at Base 1.1.5
clearRegionMean at Base 1.1.5
@@ -456,6 +450,7 @@ libmiallib.so.1 #PACKAGE# #MINVER#
initLinePool at Base 1.1.5
initRegion at Base 1.1.5
inmaskp at Base 1.1.5
+ intpair_compare at Base 1.1.7
invcovmat at Base 1.1.5
invmat at Base 1.1.5
isLineSegmentClosed at Base 1.1.5
@@ -527,6 +522,7 @@ libmiallib.so.1 #PACKAGE# #MINVER#
oiws at Base 1.1.5
oldindependent at Base 1.1.5
openingext at Base 1.1.5
+ orientation at Base 1.1.7
outercontour at Base 1.1.5
outeredge at Base 1.1.5
outeredgelut at Base 1.1.5
@@ -690,6 +686,7 @@ libmiallib.so.1 #PACKAGE# #MINVER#
u32_arith at Base 1.1.5
u32_arithcst at Base 1.1.5
u32_blank at Base 1.1.5
+ u32_chull at Base 1.1.7
u32_complete at Base 1.1.5
u32_compose at Base 1.1.5
u32_contortion_lut at Base 1.1.5
=====================================
debian/patches/gcc-15.patch deleted
=====================================
@@ -1,77 +0,0 @@
-Description: Fix FBTFS with GCC 15.
- https://gcc.gnu.org/gcc-15/porting_to.html#c23-fn-decls-without-parameters
-Author: Bas Couwenberg <sebastic at debian.org>
-Bug-Debian: https://bugs.debian.org/1096871
-Forwarded: https://github.com/ec-jrc/jeolib-miallib/pull/3
-Applied-Upstream: https://github.com/ec-jrc/jeolib-miallib/commit/234d3aeb4d8a191cd85991674c7609ec23012c16
-
---- a/core/c/miallib.h
-+++ b/core/c/miallib.h
-@@ -355,8 +355,8 @@ extern void stdputstr(char *); /* print
- extern void errputstr(char *); /* print a message to the standard error */
- #else
- static char buf[1024]; /* used by sprintf() and stdputstr() */
--extern void stdputstr(); /* print a message to the standard output */
--extern void errputstr(); /* print a message to the standard error */
-+extern void stdputstr(char *); /* print a message to the standard output */
-+extern void errputstr(char *); /* print a message to the standard error */
- #endif /* #if (defined(XLISP)) */
- #endif
-
---- a/core/c/convolve.c
-+++ b/core/c/convolve.c
-@@ -1014,7 +1014,7 @@ IMAGE *mean2dse(IMAGE *im, IMAGE *imse,
- }
- return NULL;
- }
--extern ERROR_TYPE write_tiff();
-+extern ERROR_TYPE write_tiff(IMAGE *im, char *fn);
-
-
- #include "uc_def.h"
---- a/core/c/dcluster.c
-+++ b/core/c/dcluster.c
-@@ -26,7 +26,7 @@ along with miallib. If not, see <https:
-
-
-
--extern ERROR_TYPE us_plotline();
-+extern ERROR_TYPE us_plotline(IMAGE *im, int x1, int y1, int x2, int y2, int val);
-
-
- ERROR_TYPE agglo_cluster(int *x, int *y, int *pn, double maxdst)
---- a/core/c/setreg.c
-+++ b/core/c/setreg.c
-@@ -34,9 +34,9 @@ along with miallib. If not, see <https:
- */
-
- extern int cluster();
--extern ERROR_TYPE agglo_cluster();
--extern ERROR_TYPE nearest_cluster();
--extern ERROR_TYPE knearest_cluster();
-+extern ERROR_TYPE agglo_cluster(int *x, int *y, int *pn, double maxdst);
-+extern ERROR_TYPE nearest_cluster(IMAGE *im, int *x, int *y, int *pn, double maxdst);
-+extern ERROR_TYPE knearest_cluster(IMAGE *im, int *x, int *y, int *pn, int k, double maxdst);
-
- #define set_mean_type(TYPE1, TYPE2, i1, i2) \
- {\
-@@ -162,7 +162,7 @@ extern ERROR_TYPE knearest_cluster();
- } \
- }
-
--extern IMBLOB *create_blob();
-+extern IMBLOB *create_blob(LBL_TYPE n);
-
-
-
---- a/core/c/uswilk.c
-+++ b/core/c/uswilk.c
-@@ -1505,7 +1505,7 @@ int MAXROIVAL = 65534; /* pixels out
- int OUTROI = 65535;
-
-
--extern ERROR_TYPE set_seq_shift();
-+extern ERROR_TYPE set_seq_shift(long int , long int , long int , long int , long int *);
-
- void GreyAttributeClosingROI ( double lambdaVal, /* threshold on attribute */
- int width, /* image width */
=====================================
debian/patches/series deleted
=====================================
@@ -1,2 +0,0 @@
-gcc-15.patch
-spelling-errors.patch
=====================================
debian/patches/spelling-errors.patch deleted
=====================================
@@ -1,53 +0,0 @@
-Description: Fix spelling errors.
- * defintion -> definition
-Author: Bas Couwenberg <sebastic at debian.org>
-Forwarded: https://github.com/ec-jrc/jeolib-miallib/pull/4
-Applied-Upstream: https://github.com/ec-jrc/jeolib-miallib/commit/3a0bd6d277fac5f171cafb75602b6000683e4a00
-
---- a/core/c/registration.c
-+++ b/core/c/registration.c
-@@ -61,7 +61,7 @@ IMAGE *uc_ssda(IMAGE *imin, IMAGE *imt,
- /* check w leads to windows falling in imin */
- if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
- (yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
-- (void)sprintf(buf,"*ssda(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
-+ (void)sprintf(buf,"*ssda(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
- return NULL;
- }
-
-@@ -141,7 +141,7 @@ IMAGE *us_ssda(IMAGE *imin, IMAGE *imt,
- /* check w leads to windows falling in imin */
- if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
- (yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
-- (void)sprintf(buf,"*ssda(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
-+ (void)sprintf(buf,"*ssda(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
- return NULL;
- }
-
-@@ -248,7 +248,7 @@ IMAGE *uc_ncclewis(IMAGE *imin, IMAGE *i
- /* check w leads to windows falling in imin */
- if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
- (yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
-- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
-+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
- return NULL;
- }
-
-@@ -386,7 +386,7 @@ IMAGE *uc_ncc(IMAGE *imin, IMAGE *imt, i
- /* check w leads to windows falling in imin */
- if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
- (yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
-- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
-+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
- return NULL;
- }
-
-@@ -482,7 +482,7 @@ IMAGE *us_ncc(IMAGE *imin, IMAGE *imt, i
- /* check w leads to windows falling in imin */
- if( (xi-(wd2+nxtd2)<0) || (xi+(wd2+nxtd2)>=nxi) || \
- (yi-(wd2+nytd2)<0) || (yi+(wd2+nytd2)>=nyi) ){
-- (void)sprintf(buf,"*ncc(): lead to a window falling outside imin defintion domain\n"); errputstr(buf);
-+ (void)sprintf(buf,"*ncc(): lead to a window falling outside imin definition domain\n"); errputstr(buf);
- return NULL;
- }
-
=====================================
debian/rules
=====================================
@@ -1,14 +1,10 @@
#!/usr/bin/make -f
-export DH_VERBOSE = 1
-# See FEATURE AREAS in dpkg-buildflags(1).
-export DEB_BUILD_MAINT_OPTIONS = hardening=+all
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
-# See ENVIRONMENT in dpkg-buildflags(1).
-# Package maintainers to append CFLAGS.
-#export DEB_CFLAGS_MAINT_APPEND = -Wno-deprecated-declarations
-# Package maintainers to append LDFLAGS.
-#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
+# Enable hardening build flags
+export DEB_BUILD_MAINT_OPTIONS=hardening=+all
include /usr/share/dpkg/pkg-info.mk
@@ -19,11 +15,7 @@ UPSTREAM_VERSION = $(shell echo $(DEB_VERSION_UPSTREAM) | sed -e 's/\+.*//')
override_dh_auto_configure:
dh_auto_configure -- \
- -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH) \
- -DCMAKE_INSTALL_PREFIX=/usr \
- -DINCLUDE_INSTALL_DIR=include/miallib \
- -DLIBRARY_INSTALL_DIR=usr/lib/$(DEB_BUILD_MULTIARCH) \
- -DCMAKE_BUILD_TYPE=RelWithDebInfo
+ -DCMAKE_BUILD_TYPE=RelWithDebInfo
execute_after_dh_auto_install:
sed -i -e "s|$(CURDIR)/build||g" -e "s|/include|/usr/include|" debian/tmp/usr/lib/*/cmake/miallib/miallib-config.cmake
View it on GitLab: https://salsa.debian.org/debian-gis-team/jeolib-miallib/-/compare/821e586cd6434eaefc8a297931ce74fc9acb71b3...ffd105fcb10b2630f84253eed8912597f45bb596
--
View it on GitLab: https://salsa.debian.org/debian-gis-team/jeolib-miallib/-/compare/821e586cd6434eaefc8a297931ce74fc9acb71b3...ffd105fcb10b2630f84253eed8912597f45bb596
You're receiving this email because of your account on salsa.debian.org.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20251025/b5e71084/attachment-0001.htm>
More information about the Pkg-grass-devel
mailing list