Commit Graph

2642 Commits

Author SHA1 Message Date
Lawrence Lee
9a594474d9 Add auto focal length for perspective in editor
If the focal length and/or crop factor for the camera-based perspective
correction tool are not edited, they will be set using the focal length
information found in the image metadata. This only applies to the editor
(batch editor and CLI still default to 24 for the focal length and 1 for
the crop factor).
2020-02-23 21:21:36 -08:00
Lawrence
65e76df279 Fix LGTM multiplication alerts 2020-01-20 22:06:27 -08:00
Lawrence
f16773eb3f Merge branch 'dev' into perspective
Resolve minor conflict in ImProcFunctions::transformGeneral and add new
arguments for use of ImProcFunctions::needsTransform in
PerspectiveCorrection::autocompute.
2020-01-18 18:41:26 -08:00
Lawrence
7395b26db4 Add rotation to camera-based perspective tool
This rotation is different from the Rotate tool and the post-correction
adjustment rotation because it is applied between camera shift and
camera angle. It is equivalent to correcting the camera's roll and is
the same as the rotation calculated by automatic perspective correction.
2020-01-18 17:13:24 -08:00
Lawrence
025d11bb22 Make auto perspective centered at 0
darktable/ART searches for the optimal value of a parameter starting
with the currently set value. They scan within a range of that value.
This commit changes the starting value to 0 for rotation, pitch, and
yaw. It makes the search range balanced.
2020-01-18 15:26:52 -08:00
Lawrence
6ab92eb1f5 Adapt auto perspective for camera-based correction
Comment out parameters that darktable/ART use in case we decide to use
them later. Add yaw and pitch parameters used by the camera-based
perspective correction. Modify homography matrix calculation to use the
camera-based perspective model.
2020-01-18 12:31:04 -08:00
Lawrence
b2a5c6a0f3 Fix a homogeneous function parameter type
The rotation matrix function signature used a generic type for the
rotation angle. Change it to double.
2020-01-18 10:59:57 -08:00
Ingo Weyrich
906347ab2d Capture sharpening: some cleanups 2020-01-15 22:15:31 +01:00
Lawrence
d9886d58f9 Take auto perspective correction files from ART 2020-01-13 19:51:38 -08:00
Ingo Weyrich
88808d1364 Merge pull request #5585 from Beep6581/lab2monitorRgb-review
Simplify copyAndClampLine, make in place transformations when gamutwa…
2020-01-13 13:57:26 +01:00
Ingo Weyrich
4ee4888d5b Capture sharpening: Disable benchmark 2020-01-12 19:38:37 +01:00
Ingo Weyrich
54bce4af64 Capture sharpening: minor speedups 2020-01-12 19:36:37 +01:00
Desmis
01fbc2eddf Suppress interaction between wavelet and tone-mapping 2020-01-12 08:03:52 +01:00
Ingo Weyrich
1a02f16c35 crash in Tab: transform, fixes #5604 2020-01-11 11:20:41 +01:00
Ingo Weyrich
09b1a5fada Capture sharpening: add vectorization hints for gcc 2020-01-10 19:45:59 +01:00
Ingo Weyrich
355fd5a44a Capture sharpening: add vectorization hints for clang 2020-01-10 14:25:51 +01:00
Ingo Weyrich
c6f021dcc9 Merge pull request #5589 from Beep6581/logtransform
Applying geometric transformations leads to dark artifacts in combina…
2020-01-06 20:52:22 +01:00
Ingo Weyrich
0edac2dac7 Speedup for scalar xlog functions 2020-01-06 19:01:30 +01:00
Ingo Weyrich
cabbf8c229 guidedfilter: direct copy when no rescaling is needed, copied from ART 2020-01-03 20:23:34 +01:00
Ingo Weyrich
e07ff4032b log transform: Fix segfault 2020-01-03 11:35:20 +01:00
Ingo Weyrich
49d594f67a Log transform: add method combobox 2020-01-02 19:28:57 +01:00
Ingo Weyrich
2ce6e6d1d3 skip unnecessary transform 2020-01-02 14:35:27 +01:00
Ingo Weyrich
085c68fc29 Log tranform: fix bug in preview mode 2020-01-01 19:06:02 +01:00
Ingo Weyrich
52f7c2c531 Log transform: further speedup 2020-01-01 15:18:47 +01:00
Ingo Weyrich
6302084804 sleef: use our own replacement of rint. Based on code from Alberto Griggio, but further optimized for SSE 2020-01-01 14:52:15 +01:00
Ingo Weyrich
399a0055c6 Log transform: Fix broken build 2019-12-31 20:07:39 +01:00
Ingo Weyrich
58d8e66b72 Log transform: speedup, #5588 2019-12-31 19:09:06 +01:00
Ingo Weyrich
bcb7df44df Log transform: fix segfault 2019-12-31 15:23:24 +01:00
Ingo Weyrich
d17f71eb72 Applying geometric transformations leads to dark artifacts in combination with capture sharpening, fixes #5588 2019-12-30 15:27:17 +01:00
Lawrence
f83a62be5b Add back the old perspective tool
Add perspective correction method chooser to allow choice between the
original perspective tool (simple) and the new one (camera-based).
2019-12-28 17:18:59 -08:00
Ingo Weyrich
f501ec6398 Simplify copyAndClampLine, make in place transformations when gamutwarning is disabled 2019-12-28 13:19:45 +01:00
Lawrence
f9a8875bb5 Add more perspective correction adjusters
Add camera lens/sensor shift support with horizontal/vertical shift
adjusters.

Add shifting and rotation of corrected image. This allows
post-correction adjustments to be made more easily given the fixed image
canvas size.

Add scaling of final result. This also helps reduce frustrations with
the fixed image canvas size.

Replace field of view with focal length and crop factor. Use of focal
length and crop factor is more common than diagonal angular field of
view. The new adjusters should be more intuitive for most photographers.
The implementation of perspective correction uses a focal length
relative to the image dimensions. The existing code calculates that
focal length with trigonometry. The new code does it by multiplying
by a ratio.

Replace vertical bias with horizontal and vertical perspective
distortion recovery. Vertical bias is not intuitive as it causes
vertical lines to converge off-center if horizontal correction is
applied. The new adjusters perform perspective distortion on the
projection of the corrected image, allowing vertical/horizontal lines to
converge towards the center lines of the image.

Refactor perspective transformation math to use dynamically computed
homogeneous coordinate matrices instead of pre-calculated formulas. This
should add some overhead, but results in more maintainable code and
possible improved performance due to the reduced number of arithmetic
and assignments needed for each pixel.

Integrate new adjusters in the GUI. This includes fine granularity for
batch processing add/set modes and history.
2019-12-27 16:40:41 -08:00
Lawrence
253da17bc7 Add homogeneous scale transformation
Add function to generate homogeneous 3 dimensional scale transformation
matrices.
2019-12-25 14:45:47 -08:00
Lawrence
1c6a635497 Add homogeneous coordinate functions
Add functions for transformations in 3 dimensional homogeneous space.
These include functions that generate transformation matrices and
perform matrix multiplication.
2019-12-24 15:18:15 -08:00
Ingo Weyrich
b2cfb457cc multithread darkframe subtraction, #5582 2019-12-24 19:07:32 +01:00
Ingo Weyrich
c4cf68c6b5 Speedup for darkframe subtraction 2019-12-24 19:01:36 +01:00
Ingo Weyrich
5face2e449 buildBlendMask: remove multiplication by amount as amount always was 1 2019-12-20 17:44:51 +01:00
Floessie
f8f100262f Merge pull request #5573 from luzpaz/typos
Fix doxygen typo and other various typos
2019-12-20 13:39:27 +01:00
Flössie
bd6088837c Fix crash on DCraw::data_error (fixes #5571) 2019-12-20 13:34:37 +01:00
luz.paz
c5d2e00ba3 Fixed previous commit per review feedback 2019-12-20 06:06:52 -05:00
luz.paz
765499bf55 Fix doxygen typo and other various typos 2019-12-19 20:46:35 -05:00
Lawrence
f4c37598ee Generalize perspective correction
Revise perspective transformation to remove hard-coded angular field of
view and horizontal perspective axis of rotation. Add vertical bias
parameter to retain ability to perform vertical perspective
transformation independent of the horizontal perspective axis of
rotation. Add field of view parameter as a tentative method for
specifying angular field of view.

The current implementation of perspective transformation applies
horizontal perspective transformation in such a way that preserves the
orientation of a horizontal line going through the center of the image.
In common use cases, horizontal lines such as the horizon do not go
through the center of the image. In such cases, the horizontal
perspective axis of rotation should not be parallel to the image's
y-axis. This commit makes the axis of rotation dependent on the vertical
parameter.

The two axes of rotation should be placed at the appropriate distance
from the image in order to prevent stretched or compressed proportions.
In the current implementation, the axes are at a fixed relative distance
from the image. This commit adds the ability to specify the distance in
the form of the diagonal angular field of view.
2019-12-18 10:22:05 -08:00
Ingo Weyrich
3a207dace7 Some optimizations for capture sharpening 2019-12-18 17:33:41 +01:00
Ingo Weyrich
5e0ad767ad Capture sharpening: fix wrong calculation for radius > 0.84 2019-12-18 13:16:37 +01:00
Ingo Weyrich
6b22101500 better white level for FUJIFILM X-A7 2019-12-15 17:00:50 +01:00
Ingo Weyrich
eb4fe6a7c6 Merge pull request #5562 from Beep6581/review_demosaicers
Clip negative values to zero in raw processing, #5561
2019-12-13 16:54:51 +01:00
Ingo Weyrich
0c10b1466e raw crop for Leica SL2 2019-12-13 14:39:05 +01:00
Ingo Weyrich
92c29bcd65 Skip capture sharpening for predemosaiced raw files, fixes #5563 2019-12-13 13:50:00 +01:00
Ingo Weyrich
4d72fc0b5b Do not generate negative values if raw values are less than black level, #5562 2019-12-12 20:05:43 +01:00
Ingo Weyrich
637e8454ef Do not generate negative values in output of raw ca-correction, #5562 2019-12-12 19:59:27 +01:00