View | Details | Raw Unified | Return to bug 191183
Collapse All | Expand All

(-)graphics/pfscalibration/Makefile (-12 / +10 lines)
Lines 2-11 Link Here
2
# $FreeBSD: head/graphics/pfscalibration/Makefile 327733 2013-09-20 18:35:44Z bapt $
2
# $FreeBSD: head/graphics/pfscalibration/Makefile 327733 2013-09-20 18:35:44Z bapt $
3
3
4
PORTNAME=	pfscalibration
4
PORTNAME=	pfscalibration
5
PORTVERSION=	1.3
5
PORTVERSION=	1.4
6
PORTREVISION=	4
7
CATEGORIES=	graphics
6
CATEGORIES=	graphics
8
MASTER_SITES=	SF/pfstools/${PORTNAME}/${PORTVERSION}
7
MASTER_SITES=	SF
8
MASTER_SITE_SUBDIR=	pfstools/${PORTNAME}/${PORTVERSION}
9
9
10
MAINTAINER=	ii@any.com.ru
10
MAINTAINER=	ii@any.com.ru
11
COMMENT=	Photometric calibration of cameras and recovery HDR images from the set of LDR exposures
11
COMMENT=	Photometric calibration of cameras and recovery HDR images from the set of LDR exposures
Lines 15-32 Link Here
15
15
16
USES=		gmake pkgconfig shebangfix perl5
16
USES=		gmake pkgconfig shebangfix perl5
17
GNU_CONFIGURE=	yes
17
GNU_CONFIGURE=	yes
18
CPPFLAGS+=	${PFS_CPPFLAGS}
18
CONFIGURE_TARGET=	--build=${MACHINE_ARCH}-portbld-freebsd${OSREL}
19
LDFLAGS+=	${PFS_LDFLAGS}
19
CONFIGURE_ENV=	CPPFLAGS="${PFS_CPPFLAGS}" \
20
		LDFLAGS="${PFS_LDFLAGS}"
20
21
21
LIB_DEPENDS=	pfs-1.2:${PORTSDIR}/graphics/pfstools
22
USE_PERL5=	run
22
23
MAN1=		jpeg2hdrgen.1 \
24
		dcraw2hdrgen.1 \
25
		pfsinhdrgen.1 \
26
		pfshdrcalibrate.1
27
23
28
SHEBANG_FILES=	src/dcraw2hdrgen src/jpeg2hdrgen
24
SHEBANG_FILES=	src/dcraw2hdrgen src/jpeg2hdrgen
29
bash_CMD=	${SH}
25
bash_CMD=	${SH}
30
26
31
NO_STAGE=	yes
27
LIB_DEPENDS=	libpfs-1.2.so:${PORTSDIR}/graphics/pfstools
28
32
.include <bsd.port.mk>
29
.include <bsd.port.mk>
30
(-)graphics/pfscalibration/distinfo (-2 / +2 lines)
Lines 1-2 Link Here
1
SHA256 (pfscalibration-1.3.tar.gz) = 4ced5e1ff45a9e3a02592b002c008c2c974b9d80762198e71e678e4c16e1b754
1
SHA256 (pfscalibration-1.4.tar.gz) = 81982620c6dfd1d790e83f083e8740bfe1f34d25508054b931353d5de671db9e
2
SIZE (pfscalibration-1.3.tar.gz) = 306650
2
SIZE (pfscalibration-1.4.tar.gz) = 338786
(-)graphics/pfscalibration/files/patch-configure (+11 lines)
Line 0 Link Here
1
--- configure.orig	2008-08-21 22:57:21.000000000 +0000
2
+++ configure	2014-06-18 15:27:53.728960364 +0000
3
@@ -19337,7 +19337,7 @@
4
 
5
 
6
 
7
-CXXFLAGS="-O3 -funroll-loops -fstrength-reduce -fschedule-insns2 -felide-constructors -frerun-loop-opt -fexceptions -fno-strict-aliasing -fexpensive-optimizations -ffast-math -pipe"
8
+CXXFLAGS="-O3 -funroll-loops -fstrength-reduce -felide-constructors -fexceptions -fno-strict-aliasing -fexpensive-optimizations -ffast-math -pipe"
9
 
10
 
11
 
(-)graphics/pfscalibration/files/patch-src-jpeg2hdrgen (-46 / +85 lines)
Lines 1-6 Link Here
1
--- src/jpeg2hdrgen.orig	Wed Aug 23 07:25:58 2006
1
--- src/jpeg2hdrgen.orig	2006-08-22 18:34:04.000000000 +0000
2
+++ src/jpeg2hdrgen	Thu Jun 21 14:34:33 2007
2
+++ src/jpeg2hdrgen	2014-06-18 15:27:14.288956550 +0000
3
@@ -28,18 +28,25 @@
3
@@ -28,53 +28,105 @@
4
 export LC_ALL
4
 export LC_ALL
5
 
5
 
6
 
6
 
Lines 11-96 Link Here
11
-    echo "Program 'jhead' is required to run this script."
11
-    echo "Program 'jhead' is required to run this script."
12
-    echo "Install appropriate software, for example from:"
12
-    echo "Install appropriate software, for example from:"
13
-    echo "http://www.sentex.net/~mwandel/jhead/"
13
-    echo "http://www.sentex.net/~mwandel/jhead/"
14
+JHEAD='jhead'                   # program for extracting exif info from jpegs
14
-    exit 1;
15
+EXIF='exif'                     # another one
15
-fi
16
+EXIV2='exiv2'                   # and one more
16
-
17
+
18
+CMD=`which ${JHEAD}`
19
+[ -n "${CMD}" ] || CMD=`which ${EXIF}`
20
+[ -n "${CMD}" ] || CMD=`which ${EXIV2}`
21
+if [ -z "${CMD}" ]
22
+then
23
+    cat <<MSG
24
+One of the following commands are required to run this script:
25
+ '${JHEAD}' - stand-alone program (http://www.sentex.net/~mwandel/jhead/)
26
+ '${EXIF}'  - part of libexif project (http://sf.net/projects/libexif/)
27
+ '${EXIV2}' - part of exiv2 project (http://www.exiv2.org/)
28
+MSG
29
     exit 1;
30
 fi
31
 
32
-#Note: Double backslash MUST be put in front of each $ sign
17
-#Note: Double backslash MUST be put in front of each $ sign
33
-AWK_PROGRAM=`cat <<EOF
18
-AWK_PROGRAM=`cat <<EOF
34
+AWK_PROGRAM='
19
+AWK_PROGRAM_COMMON='
35
 BEGIN {
20
 BEGIN {
36
   exposure="";
21
   exposure="";
37
   aperture="";
22
   aperture="";
38
@@ -58,23 +65,49 @@
23
 }
24
 
25
 END {
26
-  if( aperture=="" )
27
+  if (aperture=="")
28
     aperture=1;
29
 
30
-  if( iso_speed=="" )
31
+  if (iso_speed=="")
32
     iso_speed=100;
33
     
34
-  if( exposure=="" )
35
+  if (exposure=="")
36
     printf("not recognized exif header!\n");
37
   else
39
     print exposure " " aperture " " iso_speed " 0";
38
     print exposure " " aperture " " iso_speed " 0";
40
 }
39
 }
41
 
40
 
41
+'
42
+## jhead output
42
+## jhead output
43
+AWK_PROGRAM_JHEAD='
43
 /^Exposure time: ([0-9]*\.[0-9]) */ {
44
 /^Exposure time: ([0-9]*\.[0-9]) */ {
44
-  exposure = 1/\\$3;
45
-  exposure = 1/\\$3;
45
+  exposure = 1/$3;
46
+  exposure = 1/$3;
47
+  next;
46
 }
48
 }
47
-
49
-
48
 /^Aperture *: f\/([0-9]*\.[0-9]*)/ {
50
 /^Aperture *: f\/([0-9]*\.[0-9]*)/ {
49
-  aperture = substr(\\$3,3);
51
-  aperture = substr(\\$3,3);
50
+  aperture = substr($3,3);
52
+  aperture = substr($3,3);
53
+  next;
51
 }
54
 }
52
-
55
-
53
 /^ISO equiv. *: ([0-9]*\.?[0-9]*)/ {
56
 /^ISO equiv. *: ([0-9]*\.?[0-9]*)/ {
54
-  iso_speed = \\$4;
57
-  iso_speed = \\$4;
55
+  iso_speed = $4;
58
+  iso_speed = $4;
56
 }
59
+  next;
57
 
60
+}'
58
-EOF`
61
+
59
+## exif output
62
+## exif output
63
+AWK_PROGRAM_EXIF='
60
+/^Exposure Time *\|.+ sec\./ {
64
+/^Exposure Time *\|.+ sec\./ {
61
+  if (split(substr($3,2),a,"/") == 2)
65
+  if (split(substr($3,2),a,"/") == 2)
62
+    exposure = a[2];
66
+    exposure = a[2];
63
+  else
67
+  else
64
+    exposure = 1/a[1];
68
+    exposure = 1/a[1];
65
+}
69
+  next;
70
 }
66
+/^FNumber *\|f\/.+/ {
71
+/^FNumber *\|f\/.+/ {
67
+    aperture = substr($2,4);
72
+  aperture = substr($2,4);
73
+  next;
68
+}
74
+}
69
+/^ISO Speed Ratings *\|.+/ {
75
+/^ISO Speed Ratings *\|.+/ {
70
+    iso_speed = substr($4,2);
76
+  iso_speed = substr($4,2);
71
+}
77
+  next;
78
+}'
79
+
80
+## exiv2 output
81
+AWK_PROGRAM_EXIV2='
82
+/^ExposureTime *.+/ {
83
+  if (split($2,a,"/") == 2)
84
+    exposure = a[2]/a[1];
85
+  next;
86
+}
87
+/^FNumber *.+/ {
88
+  if (split($2,a,"/") == 2)
89
+    aperture = a[1]/a[2];
90
+  next;
91
+}
92
+/^ISOSpeedRatings *.+/ {
93
+  iso_speed = $2;
94
+  next;
95
+}'
96
+
97
+JHEAD='jhead'                   # program for extracting exif info from jpegs
98
+EXIV2='exiv2'                   # another one
99
+EXIF='exif'                     # and one more
100
+
101
+if which ${JHEAD} >/dev/null
102
+then
103
+    CMD="$(which ${JHEAD})"
104
+    AWK_PROGRAM="${AWK_PROGRAM_COMMON}${AWK_PROGRAM_JHEAD}"
105
+elif which ${EXIV2} >/dev/null
106
+then
107
+    CMD="$(which ${EXIV2}) -P nv pr"
108
+    AWK_PROGRAM="${AWK_PROGRAM_COMMON}${AWK_PROGRAM_EXIV2}"
109
+elif which ${EXIF} >/dev/null
110
+then
111
+    CMD="$(which ${EXIF})"
112
+    AWK_PROGRAM="${AWK_PROGRAM_COMMON}${AWK_PROGRAM_EXIF}"
113
+else
114
+    cat <<MSG
115
+One of the following commands are required to run this script:
116
+ '${JHEAD}' - stand-alone program (http://www.sentex.net/~mwandel/jhead/)
117
+ '${EXIV2}' - part of exiv2 project (http://www.exiv2.org/)
118
+ '${EXIF}'  - part of libexif project (http://sf.net/projects/libexif/)
119
+MSG
120
+    exit 1;
121
+fi
72
 
122
 
123
-EOF`
124
-
73
-while [ "$1" != "" ]; do
125
-while [ "$1" != "" ]; do
74
-    EXPOSURE_INFO=`$JHEAD $1 | awk "$AWK_PROGRAM"`
126
-    EXPOSURE_INFO=`$JHEAD $1 | awk "$AWK_PROGRAM"`
75
-    echo $1 $EXPOSURE_INFO
127
-    echo $1 $EXPOSURE_INFO
76
+## exiv2 output
128
-
77
+/^Exposure time *: .+ s/ {
78
+  if (split($4,a,"/") == 2)
79
+    exposure = a[2];
80
+  else
81
+    exposure = 1/a[1];
82
+}
83
+/^Aperture *: F.+/ {
84
+    aperture = substr($3,2);
85
+}
86
+/^ISO speed *: .+/ {
87
+    iso_speed = $4;
88
+}
89
+'
90
 
91
+while [ ${#} -ne 0 ]
129
+while [ ${#} -ne 0 ]
92
+do
130
+do
93
+    printf "${1} "
131
+    printf "${1} "
94
+    ${CMD} "${1}" | awk "${AWK_PROGRAM}"
132
+    ${CMD} "${1}" | awk "${AWK_PROGRAM}"
95
     shift
133
     shift
96
 done 
134
-done 
135
+done
(-)graphics/pfscalibration/files/patch-src-pfshdrcalibrate.cpp (-93 / +16 lines)
Lines 1-99 Link Here
1
--- src/pfshdrcalibrate.cpp.orig	Wed Aug 23 14:49:59 2006
1
--- src/pfshdrcalibrate.cpp.orig	2007-03-28 13:29:43.000000000 +0000
2
+++ src/pfshdrcalibrate.cpp	Thu Jun 21 14:40:28 2007
2
+++ src/pfshdrcalibrate.cpp	2014-06-18 15:27:14.288956550 +0000
3
@@ -108,7 +108,7 @@
3
@@ -126,7 +126,7 @@
4
     { "help", no_argument, NULL, 'h' },
5
     { "verbose", no_argument, NULL, 'v' },
6
     { "luminance", no_argument, NULL, 'Y' },
7
-    { "fillin-response", no_argument, NULL, 'F' },
8
+//    { "fillin-response", no_argument, NULL, 'F' },
9
     { "calibration", required_argument, NULL, 'c' },
10
     { "gauss", required_argument, NULL, 'g' },
11
     { "max-response", required_argument, NULL, 'A' },
12
@@ -123,7 +123,7 @@
13
 
4
 
14
   int optionIndex = 0;
5
   int optionIndex = 0;
15
   while( 1 ) {
6
   while( 1 ) {
16
-    int c = getopt_long (argc, argv, "hvYFc:g:r:f:s:m:b:", cmdLineOptions, &optionIndex);
7
-    int c = getopt_long (argc, argv, "hvYFc:g:r:f:s:m:b:p:x", cmdLineOptions, &optionIndex);
17
+    int c = getopt_long (argc, argv, "hvYFc:g:r:f:s:m:b:S:A:", cmdLineOptions, &optionIndex);
8
+    int c = getopt_long (argc, argv, "hvYFc:g:r:f:s:m:b:p:xS:A:", cmdLineOptions, &optionIndex);
18
     if( c == -1 ) break;
9
     if( c == -1 ) break;
19
     switch( c ) {
10
     switch( c ) {
20
     case 'h':
11
     case 'h':
21
@@ -246,8 +246,8 @@
12
@@ -192,7 +192,9 @@
22
     throw pfs::Exception("calibration method not set or not supported");
13
       break;
23
   }
14
     case 'p':
24
 
15
       mitsunaga_sample_no = (unsigned long)atoll(optarg);
25
-  VERBOSE_STR << "interpolate missing parts of response: "
16
-      if( opt_bpp<10 || opt_bpp>=(1 << 31))
26
-              << (opt_fillgaps ? "yes" : "no") << endl;
17
+      if( mitsunaga_sample_no<10 )
27
+//   VERBOSE_STR << "interpolate missing parts of response: "
18
+        throw pfs::Exception("too few samples");
28
+//               << (opt_fillgaps ? "yes" : "no") << endl;
19
+      if( mitsunaga_sample_no>=(1 << 31) )
29
   
20
         throw pfs::Exception("too many samples");
30
   if( responseSaveFile!=NULL )
21
       break;	  
31
     VERBOSE_STR << "save response curve to a file (do not generate HDR image)" << endl;
22
     case 'A':                   // max response
32
@@ -434,6 +434,8 @@
33
   pfs::Channel *Xj, *Yj, *Zj;
34
   frame->createXYZChannels( Xj, Yj, Zj );
35
 
36
+  // !!! this currently does more bad than good, relevant command line
37
+  // option is disabled
38
   if( opt_fillgaps )
39
   {
40
     if( opt_luminance )
41
@@ -453,42 +455,50 @@
42
   }
43
 
44
   // calibration
45
+  long sp = 0;                  // saturated pixels
46
   switch( opt_calibration )
47
   {
48
   case NONE:
49
     if( opt_luminance )
50
     {
51
       VERBOSE_STR << "applying response to Y channel..." << endl;
52
-      robertson02_applyResponse( Yj, imgsY, Iy, w, M);
53
+      sp = robertson02_applyResponse( Yj, imgsY, Iy, w, M);
54
     }
55
     else
56
     {
57
       VERBOSE_STR << "applying response to R channel..." << endl;
58
-      robertson02_applyResponse( Xj, imgsR, Ir, w, M);
59
+      sp = robertson02_applyResponse( Xj, imgsR, Ir, w, M);
60
       VERBOSE_STR << "applying response to G channel..." << endl;
61
-      robertson02_applyResponse( Yj, imgsG, Ig, w, M);
62
+      sp += robertson02_applyResponse( Yj, imgsG, Ig, w, M);
63
       VERBOSE_STR << "applying response to B channel..." << endl;
64
-      robertson02_applyResponse( Zj, imgsB, Ib, w, M);
65
+      sp += robertson02_applyResponse( Zj, imgsB, Ib, w, M);
66
+      sp /= 3;
67
     }
68
     break;
69
   case ROBERTSON:
70
     if( opt_luminance )
71
     {
72
       VERBOSE_STR << "recovering Y channel..." << endl;
73
-      robertson02_getResponse( Yj, imgsY, Iy, w, M);
74
+      sp = robertson02_getResponse( Yj, imgsY, Iy, w, M);
75
     }
76
     else
77
     {
78
       VERBOSE_STR << "recovering R channel..." << endl;
79
-      robertson02_getResponse( Xj, imgsR, Ir, w, M);
80
+      sp = robertson02_getResponse( Xj, imgsR, Ir, w, M);
81
       VERBOSE_STR << "recovering G channel..." << endl;
82
-      robertson02_getResponse( Yj, imgsG, Ig, w, M);
83
+      sp += robertson02_getResponse( Yj, imgsG, Ig, w, M);
84
       VERBOSE_STR << "recovering B channel..." << endl;
85
-      robertson02_getResponse( Zj, imgsB, Ib, w, M);
86
+      sp += robertson02_getResponse( Zj, imgsB, Ib, w, M);
87
+      sp /= 3;
88
     }
89
     break;
90
   case DEBEVEC:
91
     break;
92
+  }
93
+  if( sp>0 )
94
+  {
95
+    float perc = ceilf(100.0f*sp/size);
96
+    VERBOSE_STR << "saturated pixels found in " << perc << "% of the image!" << endl;
97
   }
98
 
99
   // save response curve to a given file
(-)graphics/pfscalibration/files/patch-src-responses.cpp (+10 lines)
Line 0 Link Here
1
--- src/responses.cpp.orig	2006-09-13 14:27:06.000000000 +0000
2
+++ src/responses.cpp	2014-06-18 15:27:14.298952630 +0000
3
@@ -63,6 +63,7 @@
4
 {
5
   float mid = Mmin + (Mmax-Mmin)/2.0f - 0.5f;
6
   float mid2 = (mid-Mmin) * (mid-Mmin);
7
+  std::cerr << "Mmin: " << Mmin << "; mid: " << mid << "; Mmax: " << Mmax << "; M: " << M << "; sigma: " << sigma << std::endl;
8
   for( int m=0 ; m<M ; m++ )
9
     if( m<Mmin || m>Mmax )
10
       w[m] = 0.0f;
(-)graphics/pfscalibration/files/patch-src-robertson02.cpp (-177 lines)
Lines 1-177 Link Here
1
--- src/robertson02.cpp.orig	Thu Mar 16 12:22:46 2006
2
+++ src/robertson02.cpp	Thu Jun 21 14:34:34 2007
3
@@ -50,7 +50,7 @@
4
 float normalizeI( float* I, int M );
5
 
6
 
7
-void robertson02_applyResponse( pfs::Array2D* xj, const ExposureList &imgs, 
8
+int robertson02_applyResponse( pfs::Array2D* xj, const ExposureList &imgs, 
9
   const float* I, const float* w, int M )
10
 {
11
   // number of exposures
12
@@ -59,6 +59,58 @@
13
   // frame size
14
   int width = xj->getCols();
15
   int height = xj->getRows();
16
+
17
+  // number of saturated pixels
18
+  int saturated_pixels = 0;
19
+
20
+  // --- anti saturation: calculate trusted camera output range
21
+  int minM = 0;
22
+  for( int m=0 ; m<M ; m++ )
23
+    if( w[m]>0 )
24
+    {
25
+      minM = m;
26
+      break;
27
+    }
28
+  int maxM = M-1;
29
+  for( int m=M-1 ; m>=0 ; m-- )
30
+    if( w[m]>0 )
31
+    {
32
+      maxM = m;
33
+      break;
34
+    }
35
+  
36
+  // --- anti ghosting: for each image i, find images with
37
+  // the immediately higher and lower exposure times
38
+  int* i_lower = new int[N];
39
+  int* i_upper = new int[N];
40
+  for( int i=0 ; i<N ; i++ )
41
+  {
42
+    i_lower[i]=-1;
43
+    i_upper[i]=-1;
44
+    float ti = imgs[i].ti;
45
+    float ti_upper = imgs[0].ti;
46
+    float ti_lower = imgs[0].ti;
47
+
48
+    for( int j=0 ; j<N ; j++ )
49
+      if( i!=j )
50
+      {
51
+        if( imgs[j].ti>ti && imgs[j].ti<ti_upper )
52
+        {
53
+          ti_upper=imgs[j].ti;
54
+          i_upper[i]=j;
55
+        }
56
+        if( imgs[j].ti<ti && imgs[j].ti>ti_lower )
57
+        {
58
+          ti_lower=imgs[j].ti;
59
+          i_lower[i]=j;
60
+        }
61
+      }
62
+    if( i_lower[i]==-1 )
63
+      i_lower[i]=i;
64
+    if( i_upper[i]==-1 )
65
+      i_upper[i]=i;
66
+  }
67
+  
68
   
69
   // all pixels
70
   for( int j=0 ; j<width*height ; j++ )
71
@@ -66,36 +118,64 @@
72
     // all exposures for each pixel
73
     float sum = 0.0f;
74
     float div = 0.0f;
75
+
76
+    float maxti = -1e6f;
77
+    float minti = +1e6f;
78
+    
79
     for( int i=0 ; i<N ; i++ )
80
     {
81
       int m = (int) (*imgs[i].yi)(j);
82
       float ti = imgs[i].ti;
83
+
84
+      // --- anti saturation: observe minimum exposure time at which
85
+      // saturated value is present, and maximum exp time at which
86
+      // black value is present
87
+      if( m>maxM )
88
+        minti = fminf(minti,ti);
89
+      if( m<minM )
90
+        maxti = fmaxf(maxti,ti);
91
+      
92
+      // --- anti ghosting: monotonous increase in time should result
93
+      // in monotonous increase in intensity; make forward and
94
+      // backward check, ignore value if condition not satisfied
95
+      int m_lower = (int) (*imgs[i_lower[i]].yi)(j);
96
+      int m_upper = (int) (*imgs[i_upper[i]].yi)(j);
97
+      if( m_lower>m || m_upper<m)
98
+        continue;
99
+      
100
       sum += w[m] * ti * I[m];
101
       div += w[m] * ti * ti;
102
     }
103
 
104
-    // This part does not work so well
105
-//     if( sum < 1e-4 ) {
106
-//       // If there is not enough information to restore luminance
107
-//       // (saturated pixels), do not use weighting function
108
-//       for( int i=0 ; i<N ; i++ )
109
-//       {
110
-//         int m = (int) (*imgs[i].yi)(j);
111
-//         float ti = imgs[i].ti;
112
-//         sum += ti * I[m];
113
-//         div += ti * ti;
114
-//       }
115
-//     }
116
-    
117
+    // --- anti saturation: if a meaningful representation of pixel
118
+    // was not found, replace it with information from observed data
119
+    if( div==0.0f )
120
+      saturated_pixels++;
121
+    if( div==0.0f && maxti>-1e6f )
122
+    {
123
+      sum = I[minM];
124
+      div = maxti;
125
+    }
126
+    if( div==0.0f && minti<+1e6f )
127
+    {
128
+      sum = I[maxM];
129
+      div = minti;
130
+    }
131
+      
132
     if( div!=0.0f )
133
       (*xj)(j) = sum/div;
134
     else
135
       (*xj)(j) = 0.0f;
136
   }
137
+
138
+  delete[] i_lower;
139
+  delete[] i_upper;
140
+  
141
+  return saturated_pixels;
142
 }
143
 
144
 
145
-void robertson02_getResponse( pfs::Array2D* xj, const ExposureList &imgs,
146
+int robertson02_getResponse( pfs::Array2D* xj, const ExposureList &imgs,
147
   float* I, const float* w, int M )
148
 {
149
   // number of exposures
150
@@ -105,6 +185,9 @@
151
   int width = imgs[0].yi->getCols();
152
   int height = imgs[0].yi->getRows();
153
 
154
+  // number of saturated pixels
155
+  int saturated_pixels = 0;
156
+
157
   // indexes
158
   int i,j,m;
159
   
160
@@ -160,7 +243,7 @@
161
     float middle_response = normalizeI( I, M );
162
 
163
     // 3. Apply new response
164
-    robertson02_applyResponse( xj, imgs, I, w, M );
165
+    saturated_pixels = robertson02_applyResponse( xj, imgs, I, w, M );
166
 
167
     // 4. Check stopping condition
168
     float delta = 0.0f;
169
@@ -198,6 +281,8 @@
170
   delete[] Ip;
171
   delete[] cardEm;
172
   delete[] sum;
173
+  
174
+  return saturated_pixels;
175
 }
176
 
177
 
(-)graphics/pfscalibration/files/patch-src-robertson02.h (-24 lines)
Lines 1-24 Link Here
1
--- src/robertson02.h.orig	Thu Mar 16 12:22:46 2006
2
+++ src/robertson02.h	Thu Jun 21 14:34:34 2007
3
@@ -39,8 +39,9 @@
4
  * @param I [out] array to put response function
5
  * @param w weights
6
  * @param M max camera output (no of discrete steps)
7
+ * @return number of saturated pixels in the HDR image (0: all OK)
8
  */
9
-void robertson02_getResponse( pfs::Array2D* xj, const ExposureList &imgs,
10
+int robertson02_getResponse( pfs::Array2D* xj, const ExposureList &imgs,
11
   float* I, const float* w, int M );
12
 
13
 
14
@@ -53,8 +54,9 @@
15
  * @param I camera response function (array size of M)
16
  * @param w weighting function for camera output values (array size of M)
17
  * @param M number of camera output levels
18
+ * @return number of saturated pixels in the HDR image (0: all OK)
19
  */
20
-void robertson02_applyResponse( pfs::Array2D* xj, const ExposureList &imgs, 
21
+int robertson02_applyResponse( pfs::Array2D* xj, const ExposureList &imgs, 
22
   const float* I, const float* w, int M );
23
 
24
 
(-)graphics/pfscalibration/pkg-plist (-2 / +7 lines)
Lines 1-4 Link Here
1
bin/pfshdrcalibrate
2
bin/jpeg2hdrgen
3
bin/dcraw2hdrgen
1
bin/dcraw2hdrgen
2
bin/jpeg2hdrgen
3
bin/pfshdrcalibrate
4
bin/pfsinhdrgen
4
bin/pfsinhdrgen
5
bin/pfsmergehdr
6
man/man1/jpeg2hdrgen.1.gz
7
man/man1/dcraw2hdrgen.1.gz
8
man/man1/pfsinhdrgen.1.gz
9
man/man1/pfshdrcalibrate.1.gz

Return to bug 191183