forked from DLR-RM/BlenderProc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'origin/develop' into iss_686_nocs
# Conflicts: # blenderproc/python/renderer/RendererUtility.py
- Loading branch information
Showing
30 changed files
with
16,062 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
from blenderproc.python.postprocessing.PostProcessingUtility import dist2depth, oil_paint_filter, remove_segmap_noise, trim_redundant_channels | ||
from blenderproc.python.postprocessing.StereoGlobalMatching import stereo_global_matching | ||
from blenderproc.python.postprocessing.StereoGlobalMatching import stereo_global_matching | ||
from blenderproc.python.camera.LensDistortionUtility import apply_lens_distortion | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
blenderproc/python/modules/postprocessing/LensDistortion.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
from blenderproc.python.modules.main.Module import Module | ||
from blenderproc.python.camera.LensDistortionUtility import apply_lens_distortion | ||
|
||
|
||
class LensDistortion(Module): | ||
""" This module can be used to postprocess images to apply a certain lens distortion, we rely here on the values: | ||
k1, k2, k3 and p1, p2 | ||
Here k_n are the radial distortion parameters (of 3rd, 5th, and 7th degree in radial distance) as defined | ||
by the undistorted-to-distorted Brown-Conrady lens distortion model, which is conform to the current | ||
DLR CalLab/OpenCV/Bouguet/Kalibr implementations. The use of k_3 is discouraged unless the angular | ||
field of view is too high, rendering it necessary, and the parameter allows for a distorted projection in | ||
the whole sensor size (which isn't always given by features-driven camera calibration). | ||
Note that undistorted-to-distorted means that the distortion parameters are multiplied by undistorted, | ||
normalized camera projections to yield distorted projections, that are in turn digitized by the intrinsic | ||
camera matrix. | ||
p_n are the first and second decentering distortion parameters as proposed in (Conrady, 1919) and | ||
defended by Brown since 1965, and are comform to the current DLR CalLab/OpenCV/Bouguet/Kalibr | ||
implementations. This parameters share one degree of freedom (j1) with each other; as a | ||
consequence, either both parameters are given or none. The use of these parameters is discouraged, | ||
since either current cameras do not need them or their potential accuracy gain is negligible w.r.t. | ||
image processing. | ||
For more information see: https://en.wikipedia.org/wiki/Distortion_(optics) | ||
Note that, unlike in that wikipedia entry as of early 2021, we're here using the undistorted-to-distorted | ||
formulation. | ||
""" | ||
|
||
def __init__(self, config): | ||
Module.__init__(self, config) | ||
|
||
def run(self, image, key, version): | ||
""" | ||
:param image: The image data. | ||
:return: The lens distorted image data. | ||
""" | ||
return apply_lens_distortion(image), key, version |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
from typing import Union | ||
|
||
import numpy as np | ||
|
||
import bpy | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,3 @@ | ||
|
||
import cv2 | ||
import numpy as np | ||
from PIL import Image | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.