Skip to content

Commit 2f7b34f

Browse files
Merge pull request #2066 from alicevision/dev/imageProcessing
Rewrite imageProcessing app and adding parallelization
2 parents 1882c40 + 8b0656a commit 2f7b34f

File tree

10 files changed

+1505
-1054
lines changed

10 files changed

+1505
-1054
lines changed

meshroom/aliceVision/ImageProcessing.py

Lines changed: 9 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,24 @@
1-
__version__ = "3.3"
1+
__version__ = "4.0"
22

33
from meshroom.core import desc
44
from meshroom.core.utils import COLORSPACES, EXR_STORAGE_DATA_TYPE, RAW_COLOR_INTERPRETATION, VERBOSE_LEVEL
55

66
import os.path
7+
from pyalicevision import parallelization as avpar
78

89

910
def outputImagesValueFunct(attr):
10-
basename = os.path.basename(attr.node.input.value)
11-
fileStem = os.path.splitext(basename)[0]
12-
inputExt = os.path.splitext(basename)[1]
1311
outputExt = ('.' + attr.node.extension.value) if attr.node.extension.value else None
14-
15-
if inputExt in ['.abc', '.sfm']:
16-
fileStem = '<FILESTEM>' if attr.node.keepImageFilename.value else '<VIEW_ID>'
17-
# If we have an SfM in input
18-
return "{nodeCacheFolder}/" + fileStem + (outputExt or '.*')
19-
20-
if inputExt:
21-
# If we have one or multiple files in input
22-
return "{nodeCacheFolder}/" + fileStem + (outputExt or inputExt)
23-
24-
if '*' in fileStem:
25-
# The fileStem of the input param is a regular expression,
26-
# so even if there is no file extension,
27-
# we consider that the expression represents files.
28-
return "{nodeCacheFolder}/" + fileStem + (outputExt or '.*')
29-
30-
# No extension and no expression means that the input param is a folder path
31-
return "{nodeCacheFolder}/" + '*' + (outputExt or '.*')
12+
fileStem = '<FILESTEM>' if attr.node.keepImageFilename.value else '<VIEW_ID>'
13+
return "{nodeCacheFolder}/" + fileStem + (outputExt or '.*')
3214

3315

3416
class ImageProcessing(desc.AVCommandLineNode):
3517
commandLine = "aliceVision_imageProcessing {allParams}"
36-
size = desc.DynamicNodeSize("input")
37-
# parallelization = desc.Parallelization(blockSize=40)
38-
# commandLineRange = '--rangeStart {rangeStart} --rangeSize {rangeBlockSize}'
18+
size = avpar.DynamicViewsSize("input")
19+
20+
parallelization = desc.Parallelization(blockSize=30)
21+
commandLineRange = '--rangeIteration {rangeIteration} --rangeBlocksCount {rangeBlocksCount}'
3922

4023
category = "Utils"
4124
documentation = """Convert or apply filtering to the input images."""
@@ -44,25 +27,9 @@ class ImageProcessing(desc.AVCommandLineNode):
4427
desc.File(
4528
name="input",
4629
label="Input",
47-
description="SfMData file input, image filenames or regex(es) on the image file path.\n"
48-
"Supported regex:\n"
49-
" - '#' matches a single digit.\n"
50-
" - '@' matches one or more digits.\n"
51-
" - '?' matches one character.\n"
52-
" - '*' matches zero character or more.",
30+
description="SfMData file input",
5331
value="",
5432
),
55-
desc.ListAttribute(
56-
elementDesc=desc.File(
57-
name="inputFolder",
58-
label="Input Folder",
59-
description="Folder containing images.",
60-
value="",
61-
),
62-
name="inputFolders",
63-
label="Input Images Folders",
64-
description="Use images from specific folder(s).",
65-
),
6633
desc.ListAttribute(
6734
elementDesc=desc.StringParam(
6835
name="metadataFolder",

meshroom/rawImageConversion.mg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"nodesVersions": {
66
"CameraInit": "12.0",
77
"CopyFiles": "1.3",
8-
"ImageProcessing": "3.3"
8+
"ImageProcessing": "4.0"
99
},
1010
"template": true
1111
},

src/aliceVision/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ if (ALICEVISION_BUILD_SFM)
1919
add_subdirectory(geometry)
2020
add_subdirectory(graph)
2121
add_subdirectory(imageMatching)
22+
add_subdirectory(imageProcessing)
2223
add_subdirectory(linearProgramming)
2324
add_subdirectory(lensCorrectionProfile)
2425
add_subdirectory(matching)
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# Headers
3+
set(image_processing_file_headers
4+
imageProcessing.hpp
5+
)
6+
7+
# Sources
8+
set(image_processing_file_sources
9+
imageProcessing.cpp
10+
)
11+
12+
if (ALICEVISION_HAVE_OPENCV)
13+
list(APPEND image_processing_file_headers imageProcessing_OpenCV.hpp)
14+
list(APPEND image_processing_file_sources imageProcessing_OpenCV.cpp)
15+
endif()
16+
17+
alicevision_add_library(aliceVision_imageProcessing
18+
SOURCES ${image_processing_file_headers} ${image_processing_file_sources}
19+
PUBLIC_LINKS
20+
aliceVision_numeric
21+
aliceVision_image
22+
aliceVision_sfmData
23+
aliceVision_camera
24+
aliceVision_lensCorrectionProfile
25+
PRIVATE_LINKS
26+
aliceVision_system
27+
)
28+
29+
if (ALICEVISION_HAVE_OPENCV)
30+
target_link_libraries(aliceVision_imageProcessing PUBLIC ${OpenCV_LIBS})
31+
endif()

0 commit comments

Comments
 (0)