Hi Jeff,
eljef... schrieb am Mittwoch, 22. Dezember 2021 um 15:50:10 UTC+1:
> I made the changes to address your compile errors. It compiles and runs
> for me. Let me know how it goes. New code on github now.
>
with some minor changes it compiles here now. I'm attaching a patch with
all changes.
I'm also attaching a first draft for building with CMake. Place the
CMakeLists.txt file beside the source file.
Then
>mkdir build
>cd build
>cmake /path/to/skyfill_source
>make
>make install
should build and install skyfill.
Enough for today. Will do more tests in the next days.
Thomas
--
A list of frequently asked questions is available at:
http://wiki.panotools.org/Hugin_FAQ
---
You received this message because you are subscribed to the Google Groups
"hugin and other free panoramic software" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/hugin-ptx/74b7ba60-9cfe-4dbf-869f-17df4981078bn%40googlegroups.com.
# minimum cmake version
cmake_minimum_required(VERSION 3.10)
cmake_policy(SET CMP0074 NEW)
# now start with skyfill
project(skyfill)
# tweak install path for Windows
IF(WIN32)
# install into place in build-dir
SET( CMAKE_INSTALL_PREFIX ${CMAKE_CURRENT_BINARY_DIR}/INSTALL/ CACHE
FILEPATH "install prefix" FORCE)
ENDIF()
# find all required packages
# currently only libtiff is required
FIND_PACKAGE(TIFF REQUIRED)
INCLUDE_DIRECTORIES(${TIFF_INCLUDE_DIR})
# file list
SET(SKYFILL_HEADER
mstat.h
amoeba_06.h
)
SET(SKYFILL_SOURCE
amoeba_06.c
mstat.c
skyfill_tif.c
)
# now create the executable
add_executable(skyfill ${SKYFILL_HEADER} ${SKYFILL_SOURCE})
target_link_libraries(skyfill ${TIFF_LIBRARIES})
install(TARGETS skyfill)
diff --git a/skyfill_tif.c b/skyfill_tif.c
index 19d573f..7a786af 100644
--- a/skyfill_tif.c
+++ b/skyfill_tif.c
@@ -56,7 +56,7 @@ int fill_top_of_sky=0 ; // by default, don't make start of the sky values equal
float final_saturation_factor=1.0 ;
// global arrays, will indicate what was detected for each column (x) for these values
-int16 *start_of_sky, *end_of_sky, *final_end_of_sky, *raw_start_of_sky ; // raw start of sky is as detected before any repairs on image
+int16_t *start_of_sky, *end_of_sky, *final_end_of_sky, *raw_start_of_sky ; // raw start of sky is as detected before any repairs on image
#define MIN(a,b) ( (a) < (b) ? (a) : (b) )
#define MAX(a,b) ( (a) > (b) ? (a) : (b) )
@@ -96,8 +96,8 @@ float exposure_factor=1. ; // exposure factor
int have_pto_fov=0 ;
int n_strips ;
-int32 IMAGE_HEIGHT ;
-int32 IMAGE_WIDTH ;
+int32_t IMAGE_HEIGHT ;
+int32_t IMAGE_WIDTH ;
uint16_t IMAGE_NSAMPLES ; // must be 16 bit, needed by call to tif library
int IMAGE_HAS_ALPHA=0 ;
@@ -365,7 +365,7 @@ void hsv2rgb16(float h, float s, float v, uint16_t *dst_r, uint16_t *dst_g, uint
void read_tif_image(tdata_t *image,TIFF *tif,int h,uint16_t spp, uint16_t tif_config)
{
- int32 y ;
+ int32_t y ;
/* read a row */
for(y = 0 ; y < h ; y++) {
if(tif_config == PLANARCONFIG_CONTIG) {
@@ -383,7 +383,7 @@ void read_tif_image(tdata_t *image,TIFF *tif,int h,uint16_t spp, uint16_t tif_co
}
}
-void copy_pixel(tdata_t *image, int32 xsrc, int32 ysrc, int32 xdest, int32 ydest)
+void copy_pixel(tdata_t *image, int32_t xsrc, int32_t ysrc, int32_t xdest, int32_t ydest)
{
((uint16_t *)(image[ydest]))[IMAGE_NSAMPLES*xdest+0] = ((uint16_t *)(image[ysrc]))[IMAGE_NSAMPLES*xsrc+0] ;
((uint16_t *)(image[ydest]))[IMAGE_NSAMPLES*xdest+1] = ((uint16_t *)(image[ysrc]))[IMAGE_NSAMPLES*xsrc+1] ;
@@ -394,7 +394,7 @@ void copy_pixel(tdata_t *image, int32 xsrc, int32 ysrc, int32 xdest, int32 ydest
}
}
-int xy_is_opaque_pixel(tdata_t *image, int32 x, int32 y)
+int xy_is_opaque_pixel(tdata_t *image, int32_t x, int32_t y)
{
/* if alpha channel is nonzero then hugin has placed image data here */
if(((uint16_t *)(image[y]))[IMAGE_NSAMPLES*x+3] < HALF16)
@@ -403,7 +403,7 @@ int xy_is_opaque_pixel(tdata_t *image, int32 x, int32 y)
return 1 ;
}
-int xy_has_nonblack_pixel(tdata_t *image, int32 x, int32 y)
+int xy_has_nonblack_pixel(tdata_t *image, int32_t x, int32_t y)
{
/* if alpha channel is nonzero then hugin has placed image data here */
if(IMAGE_HAS_ALPHA) {
@@ -421,9 +421,9 @@ int xy_has_nonblack_pixel(tdata_t *image, int32 x, int32 y)
return 0 ;
}
-void simple_find_start_of_sky(int16 *start_of_sky,uint16_t w,uint16_t h,tdata_t *image)
+void simple_find_start_of_sky(int16_t *start_of_sky,uint16_t w,uint16_t h,tdata_t *image)
{
- int32 x, y ;
+ int32_t x, y ;
for(x = 0 ; x < w ; x++) {
start_of_sky[x] = 0 ;
@@ -446,9 +446,9 @@ void simple_find_start_of_sky(int16 *start_of_sky,uint16_t w,uint16_t h,tdata_t
fprintf(stderr, "Finished simple find start of sky\n") ;
}
-void find_start_of_sky(int16 *start_of_sky,uint16_t w,uint16_t h,tdata_t *image,int fix_SOS_edges)
+void find_start_of_sky(int16_t *start_of_sky,uint16_t w,uint16_t h,tdata_t *image,int fix_SOS_edges)
{
- int32 x, y ;
+ int32_t x, y ;
simple_find_start_of_sky(start_of_sky,w,h,image) ;
return ;
@@ -456,7 +456,7 @@ void find_start_of_sky(int16 *start_of_sky,uint16_t w,uint16_t h,tdata_t *image,
/* look for vertical gaps in sky (alpha=0), which can happen after lens correction */
for(x = 0 ; x < w ; x++) {
- int32 gap_start=-1, gap_end=-1 ;
+ int32_t gap_start=-1, gap_end=-1 ;
for(y = start_of_sky[x] ; y < h ; y++) {
if(xy_has_nonblack_pixel(image, x, y) == 0) {
@@ -667,7 +667,7 @@ float sobel(tdata_t *image, int xc, int yc)
void print_sobel(tdata_t *image, int x)
{
- int16 y ;
+ int16_t y ;
for(y = end_of_sky[x]-5 ; y < end_of_sky[x]+5 ; y++) {
if( y == end_of_sky[x]) {
@@ -769,9 +769,9 @@ int get_sobel_eos(tdata_t *image, int x)
-void find_end_of_sky(int16 *end_of_sky,int16 *start_of_sky,int w,int h,tdata_t *image,int fix_edges,int fix_slivers)
+void find_end_of_sky(int16_t *end_of_sky,int16_t *start_of_sky,int w,int h,tdata_t *image,int fix_edges,int fix_slivers)
{
- int16 x, y ;
+ int16_t x, y ;
is_clear_sky = (uint8_t *)calloc(IMAGE_HEIGHT, sizeof(uint8_t)) ;
sky_hue = (float *)calloc(IMAGE_HEIGHT, sizeof(float)) ;
@@ -1103,7 +1103,7 @@ float get_xy_L(tdata_t *image, int x, int y)
return 0.21126*fr + 0.7152*fg + 0.0722*fb ;
}
-void repair_sky_hue(tdata_t *image,int16 *start_of_sky,int16 *end_of_sky)
+void repair_sky_hue(tdata_t *image,int16_t *start_of_sky,int16_t *end_of_sky)
{
int x, y ;
@@ -1302,7 +1302,7 @@ int sat_prediction_method = 1 ; // 1 means predict as function of (val,val*va),
float S_from_V_coefs[3] = {0.5,0.,0.} ; // coefs to predict sat from value
float H_from_V_coefs[4] = {212,0.,0.,0.} ; // coefs to predict hue from value
-int sample_sky_points(int n_per_column, int n_columns,tdata_t *image,int16 *start_of_sky,int16 *end_of_sky)
+int sample_sky_points(int n_per_column, int n_columns,tdata_t *image,int16_t *start_of_sky,int16_t *end_of_sky)
{
int x, y ;
float mean_column_length ;
@@ -2344,7 +2344,7 @@ int compute_feather_length(int x, int *pFeather_end_y, float depth_of_fill, floa
return *pFeather_end_y - start_of_sky[x] ;
}
-int wrong_hue_or_black(tdata_t *image, int32 x, int32 y)
+int wrong_hue_or_black(tdata_t *image, int32_t x, int32_t y)
{
uint16_t r,g,b,a ;
tif_get4c(image,x,y,r,g,b,a) ;
@@ -2366,7 +2366,7 @@ int wrong_hue_or_black(tdata_t *image, int32 x, int32 y)
}
-int xy_is_transparent(tdata_t *image, int32 x, int32 y)
+int xy_is_transparent(tdata_t *image, int32_t x, int32_t y)
{
/* if alpha channel is nonzero then hugin has placed image data here */
if(IMAGE_HAS_ALPHA) {
@@ -2378,7 +2378,7 @@ int xy_is_transparent(tdata_t *image, int32 x, int32 y)
}
-int xy_is_black_pixel(tdata_t *image, int32 x, int32 y)
+int xy_is_black_pixel(tdata_t *image, int32_t x, int32_t y)
{
/* if alpha channel is nonzero then hugin has placed image data here */
if(IMAGE_HAS_ALPHA) {
@@ -2412,9 +2412,9 @@ void repair_alpha(tdata_t *image)
tif_get3c(image,x,y,r,g,b) ;
// nearest neighbor search +/- 2 pixels to find max r,g,b in area
- uint max_r=0 ;
- uint max_g=0 ;
- uint max_b=0 ;
+ uint16_t max_r=0 ;
+ uint16_t max_g=0 ;
+ uint16_t max_b=0 ;
int x0 = x-2 ; if(x0 < 0) x0 = 0 ;
int y0 = y-2 ; if(y0 < 0) y0 = 0 ;
int x1 = x+2 ; if(x1 > IMAGE_WIDTH-1) x1 = IMAGE_WIDTH-1 ;
@@ -3304,7 +3304,7 @@ void repair_top_of_sky(tdata_t *image, int end_of_sky_is_known_flag, int phase)
}
-void estimate_sky(int x0,int x1,tdata_t *image,int16 *start_of_sky,int16 *end_of_sky,int16 *final_end_of_sky,
+void estimate_sky(int x0,int x1,tdata_t *image,int16_t *start_of_sky,int16_t *end_of_sky,int16_t *final_end_of_sky,
float depth_of_sample, int h, int w, float feather_factor, int debug, float depth_of_fill, int extra_feather_length)
{
int x, y ;
@@ -4432,7 +4432,7 @@ int main(int argc, char* argv[])
TIFF* tifout = TIFFOpen(outfilename, "w");
tsize_t ROWSIZE ;
- int32 x, y, w, h ;
+ int32_t x, y, w, h ;
// prepare output image to have same tags as input image
uint16_t alltags[] = {
@@ -4496,8 +4496,8 @@ int main(int argc, char* argv[])
// make signed int values for width and height
- h = (int32)input_H ;
- w = (int32)input_W ;
+ h = (int32_t)input_H ;
+ w = (int32_t)input_W ;
if(quick_test) {
h /= 2 ;
@@ -4507,8 +4507,8 @@ int main(int argc, char* argv[])
min_sky_hue_mask = fmin_sky_hue_mask*w ;
max_sky_hue_mask = fmax_sky_hue_mask*w ;
- IMAGE_HEIGHT = (int32)h ; // set global variable
- IMAGE_WIDTH = (int32)w ; // set global variable
+ IMAGE_HEIGHT = (int32_t)h ; // set global variable
+ IMAGE_WIDTH = (int32_t)w ; // set global variable
p_half_image_width = 0.5 ;
V_zenith= P3toV3(0., 1., 0.) ;
@@ -4617,7 +4617,7 @@ int main(int argc, char* argv[])
exit(1) ;
}
/* fprintf(stderr, "y:%d * 2 (%d) > input height %d\n", y, y*2, input_H) ; */
- uint r,g,b,a ;
+ uint16_t r,g,b,a ;
tif_get4c(image,x2,y2,r,g,b,a) ;
tif_set4c(image,x,y,r,g,b,a) ;
}
@@ -4632,10 +4632,10 @@ int main(int argc, char* argv[])
repair_alpha(image) ;
/* find start of real image data */
- raw_start_of_sky = (int16 *)calloc(w, sizeof(int16 *)) ;
- start_of_sky = (int16 *)calloc(w, sizeof(int16 *)) ;
- end_of_sky = (int16 *)calloc(w, sizeof(int16 *)) ;
- final_end_of_sky = (int16 *)calloc(w, sizeof(int16 *)) ;
+ raw_start_of_sky = (int16_t *)calloc(w, sizeof(int16_t *)) ;
+ start_of_sky = (int16_t *)calloc(w, sizeof(int16_t *)) ;
+ end_of_sky = (int16_t *)calloc(w, sizeof(int16_t *)) ;
+ final_end_of_sky = (int16_t *)calloc(w, sizeof(int16_t *)) ;
simple_find_start_of_sky(start_of_sky,w,h,image) ;
@@ -4717,8 +4717,8 @@ estimate_sky:
fprintf(stderr, "main:interpolate masked columns\n") ;
for(int m = 0 ; m < n_masks ; m++) {
if(mask_l[m] > 0 && mask_r[m] < w-1) {
- int32 x0 = mask_l[m]-1 ;
- int32 x1 = mask_r[m]+1 ;
+ int32_t x0 = mask_l[m]-1 ;
+ int32_t x1 = mask_r[m]+1 ;
int max_y = start_of_sky[x0] ;
@@ -4912,7 +4912,7 @@ estimate_sky:
for(x = 0 ; x < IMAGE_WIDTH ; x++) {
if(column_mask[x] == 1) continue ;
for(y = 0 ; y < raw_start_of_sky[x] ; y++) {
- int16 dither = ((rand()%128) - 64)*8 ;
+ int16_t dither = ((rand()%128) - 64)*8 ;
((uint16_t *)(image[y]))[IMAGE_NSAMPLES*x+0] += dither ;
dither = ((rand()%128) - 64)*8 ;
((uint16_t *)(image[y]))[IMAGE_NSAMPLES*x+1] += dither ;