void MultiMatch_LoadKeysets(MultiMatch* self, ArrayList* filenames) { self->imageCount = ArrayList_Count(filenames); self->keySets = ArrayList_new(self->imageCount, KeypointXMLList_delete); int n; for ( n = 0 ; n < self->imageCount ; ++n) { char* fn = (char *) ArrayList_GetItem(filenames, n); KeypointXMLList* keys = KeypointXMLReader_ReadComplete (fn); if (!keys) FatalError("Failed to load keypoints from %s", fn); WriteLine ("Loaded %d keypoints from %s for image \"%s\" (%dx%d)", ArrayList_Count(keys->array), fn, keys->imageFile, keys->xDim, keys->yDim); ArrayList_SetItem(self->keySets, n, keys); } }
int AreaFilter_CreateHull (AreaFilter* self, ArrayList* points) { int u = AreaFilter_MakeChain (self, points, AreaFilter_CompareLow); if (ArrayList_Count(points) == 0) return (0); /* int k; for (k = 0 ; k < u ; ++k) WriteLine ("point %d: %f %f", k, ((FilterPoint*)ArrayList_GetItem(points, k)[k])->x, ((FilterPoint*)ArrayList_GetItem(points, k)[k])->y); */ ArrayList* pointsHigh = ArrayList_new(ArrayList_Count(points)+1-u, NULL); //WriteLine ("points.Length = %d, u = %d", ArrayList_Count(points), u); ArrayList_Copy (points, u, pointsHigh, 0, ArrayList_Count(points) - u); ArrayList_SetItem(pointsHigh, ArrayList_Count(pointsHigh) - 1, ArrayList_GetItem(points, 0)); int h = AreaFilter_MakeChain (self, pointsHigh, AreaFilter_CompareHigh); int p; for ( p = u ; p < ArrayList_Count(points) ; ++p) { ArrayList_SetItem(points, p, ArrayList_GetItem(pointsHigh, p-u)); } /* WriteLine ("h = %d, u = %d", h, u); int k; for (k = 0 ; k < (h + u) ; ++k) WriteLine ("point %d: %f %f", k, ((FilterPoint*)ArrayList_GetItem(points, k)[k])->x, ((FilterPoint*)ArrayList_GetItem(points, k)[k])->y); */ return (h + u); }
_List *_List_new(int size) { _List *list = malloc(sizeof(_List)); list->obj.toString = &_Object_toString; //todo: proper toString list->data = ArrayList_new(size); return list; }