57 Commits

Author SHA1 Message Date
Alexander Brock
2e66dc11a2 Style changes as requested 2023-02-22 10:52:42 +01:00
Alexander Brock
2a92257438 Add HISTORY_MSG_PERSP_CAM_SCALE to default language file 2023-02-19 23:40:58 +01:00
Alexander Brock
66698d515c Change detection of scale factor 2023-02-19 20:11:34 +01:00
Alexander Brock
f023a90170 Add camera_defish to PerspCorrection::read/write 2023-02-11 23:51:32 +01:00
Alexander Brock
fb90908cbd Add GUI elements for defish and scale in perspective tool. Doesn't work very good yet. 2023-02-11 20:31:08 +01:00
Lawrence37
0a55428205
Clean up missing language keys (#6556)
* Clean up some unused code

* Use grid for abstract profile primaries

* Remove blank line from default
2022-08-24 20:23:09 +02:00
Lawrence Lee
9c5ce0d9bb Fix focal len autofill after browser adjustments
Don't update the camera-based perspective focal length and crop factor
parameters when making other adjustments using the file browser or batch
editor.

Closes #6402
2022-01-08 12:02:25 -08:00
Lawrence Lee
f17eb2b504 Merge branch 'dev' into perspective-ux 2021-05-31 11:53:50 -07:00
Lawrence Lee
e7e6dd1cb5 Clean up rtgui perspective.* and controllines.*
Change size_t to std::size_t, remove void from function parameters, use
constants to represent the minimum required number of control lines, and
change const auto & to const auto.
2021-05-31 11:20:01 -07:00
Lawrence Lee
2c1e6a8ca1 Make control lines buttons react to line counts
Set the "apply" and "delete all" button sensitivity based on the number
of control lines. Add extra tooltip text to the apply button when
editing and there is not enough lines. The text explains there must be
enough vertical or horizontal control lines.
2021-05-30 18:02:29 -07:00
Lawrence Lee
3ade11c970 Leave control lines in good state on commit
When exiting perspective control line editing mode while dragging a
control line, set the geometry and control line state to the appropriate
state corresponding to when lines are not being dragged.
2021-05-22 18:17:30 -07:00
Lawrence Lee
36f1300a6b Fix control line edit crash when undoing history
When perspective control line editing is active and the history entry is
changed such that edit mode is automatically disabled, there is a crash.
The history change triggers a processing parameters update and disables
editing. When editing is disabled, the perspective tool also tries to
update the processing parameters, causing a double mutex lock attempt.

This commit avoids updating parameters from the perspective tool and
uses the tweak operator (introduced with the spot removal tool) to achieve
the same effect.

Closes #6251.
2021-05-22 15:50:35 -07:00
Thanatomanic
fc031ccb5a
Remove deprecated GTK3 code, fixes #6103 (#6113)
Replaces the following deprecated Gtk classes throughout the codebase by their non-deprecated counterparts. Style, HBox, VBox, HPaned, VPaned, HScrollbar, VScrollbar, VSeparator, HSeparator, Stock, Table, VScale and HScale.
2021-02-17 11:44:25 +01:00
Lawrence Lee
1e73135d51 Add perspective edit button to toolbar
The perspective control lines edit mode no longer piggybacks on the hand
tool button on the toolbar.
2020-07-31 21:58:00 -07:00
Lawrence Lee
a56c1fbb07 Add tooltips to control lines buttons 2020-07-20 15:30:01 -07:00
Lawrence Lee
06caf40598 Move control lines code to new files 2020-07-12 15:19:10 -07:00
Lawrence Lee
cef97eefea Simplify tooltip for perspective control lines
Only show how to draw new lines and delete a single line. Move the
tooltip activation area to the label.
2020-07-12 11:36:14 -07:00
Lawrence Lee
4f8aa2db2b Add perspective control lines to history
Allows undoing and redoing of changes to the control lines.
2020-07-11 13:34:05 -07:00
Lawrence Lee
eb548f1aff Make control lines part of processing parameters 2020-07-09 11:43:23 -07:00
Lawrence Lee
7f647d188c Fix cppcheck warnings 2020-07-08 11:57:04 -07:00
Lawrence Lee
a7f397541a Make control line type automatically set
Perspective control line type is automatically set when first drawn. The
type is determined by the line's angle. Buttons for specifying which
line type to draw are removed.
2020-07-08 11:46:28 -07:00
Lawrence Lee
98678c1f48 Use smart pointers 2020-07-05 16:37:49 -07:00
Lawrence Lee
c2ea6b2ebc Merge from 'dev' 2020-06-25 21:58:02 -07:00
Lawrence Lee
1b06cb9999 Limit preview refreshing in control line edit mode
Previously, changing values in the camera-based perspective correction
tool while in control line edit mode resulted in the preview being
refreshed. This is unnecessary because all perspective transformations
are disabled in edit mode. This commit disables preview refreshing for
camera-based perspective adjustments in edit mode.
2020-06-24 17:06:21 -07:00
Lawrence Lee
d76cf5cdae Make control lines hidden when switching mode
The program now exits control line editing mode when the perspective
correction method is switched out of camera-based mode.
2020-06-24 16:20:03 -07:00
Lawrence Lee
8d7a5546e1 Add separators in camera-based persp correction
Horizontal lines to separate the sliders, control lines buttons, and
automatic buttons.
2020-06-23 22:33:08 -07:00
Lawrence Lee
afc3edae26 Make control line correction keep old values
Perspective correction through control lines will no longer modify any
parameters if there are not enough lines to do any correction.
2020-06-23 22:24:27 -07:00
Lawrence Lee
7b4504e34f Add pointer initializer to avoid segfaults
PerspCorrection::metadata was not initialized, which could cause a
segfault.
2020-06-12 10:49:11 -07:00
Lawrence Lee
6c59f0586f Fix minor memory leaks 2020-06-11 12:41:43 -07:00
Lawrence Lee
24681f324c Remove unneeded code 2020-06-10 16:53:33 -07:00
Lawrence Lee
72d390e99a Add button for deleting all control lines 2020-06-10 16:16:40 -07:00
Lawrence Lee
a120b304f1 Add tooltip for control lines 2020-06-10 13:13:18 -07:00
Lawrence Lee
976cf4c103 Make control lines buttons disabled in batch mode 2020-06-10 12:57:08 -07:00
Lawrence Lee
11459a8bb1 Add label for control lines buttons 2020-06-10 12:50:14 -07:00
Lawrence Lee
72b69b3249 Fix a few small control lines bugs 2020-06-10 12:35:53 -07:00
Lawrence Lee
dd4364fab3 Add buttons for switching control line type 2020-06-10 11:41:15 -07:00
Lawrence Lee
5e5a86f513 Add icons for perspective control line buttons 2020-06-09 16:29:57 -07:00
Lawrence Lee
6b7c1871b9 Implement basic perspective control lines (WIP) 2020-06-08 18:21:12 -07:00
Lawrence Lee
852b3270e1 Make history message key names more descriptive
Use keys that are more descriptive than "HISTORY_MSG_###".
2020-05-04 18:15:27 -07:00
Lawrence Lee
357cf5b96a Remove scaling from perspective correction
Scaling is applied at the end of all geometric transformations, so it
would be more appropriate outside of the perspective correction tool.
Such an implementation would also work better with the auto-fit feature.
2020-02-26 22:52:55 -08:00
Lawrence Lee
90d7b391ba Change perspective correction adjuster limits
Reduce the limits to more sensible values for now. They can be safely
increased later without impacting backward-compatibility.
2020-02-26 12:16:16 -08:00
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
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
72dfa1b242 Add auto perspective correction to GUI
Add three buttons for correcting pitch, yaw, or both. Horizontal and/or
vertical tilt adjusters are updated with the automatically computed
values.
2020-01-18 14:32:03 -08: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
Lawrence
f514a69104 Group perspective adjusters in frames
Divide perspective correction adjusters into three groups: camera
attributes, post-correction adjustments, and perspective distortion
recovery.
2019-12-27 20:50:18 -08: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
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
Morgan Hardwood
60b2196bce Updated gnu.org links to use HTTPS 2019-09-10 12:34:57 +02:00
Ingo Weyrich
0493e67474 nuke empty adjusterAutoToggled functions 2019-07-20 11:44:38 +02:00