I've gotten this to build in Windows and threw together a simple app using the example code as a guide. When I call lqr_carver_resize I get the error, Access violation reading location, from line 967 in lqr_carver.c.
if (!r->preserve_in_buffer) {
g_free(r->rgb); // << This line
}
I am using the latest build of glib (2.26.1) for windows. If I comment out the line everything continues on fine, however when I scan the pixel data it has not been resized. The image is the size I have requested, but it has been cropped if I resize to a smaller resolution. If I go larger it seems to work fine. Any help would be appreciated.
LqrCarver *carver = lqr_carver_new(pixs, 32, 32);
lqr_carver_init(carver, 4, 0); // max_step, rigidity
lqr_carver_set_energy_function_builtin(carver, LQR_EF_GRAD_XABS);
lqr_carver_set_side_switch_frequency(carver, 4);
lqr_carver_set_enl_step(carver, 1.0f);
lqr_carver_set_resize_order(carver, LQR_RES_ORDER_HOR);
lqr_carver_resize(carver, 16, 16);
lqr_carver_scan_reset(carver);
gint x, y;
gint w, h;
guchar *rgb;
w = lqr_carver_get_width(carver);
h = lqr_carver_get_height(carver);
int p = 0;
while (lqr_carver_scan(carver, &x, &y, &rgb)) {
/* convert the output into doubles */
p=(x*bitSize)+((y*bitSize)*w);
newpixs[p] = rgb[0];
newpixs[p+1] = rgb[1];
newpixs[p+2] = rgb[2];
}