Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
9ff14bc4
Commit
9ff14bc4
authored
Oct 31, 2015
by
edgarriba
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for float32 and float 64
parent
1e9bd59f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
0 deletions
+21
-0
grfmt_gdal.cpp
modules/imgcodecs/src/grfmt_gdal.cpp
+21
-0
No files found.
modules/imgcodecs/src/grfmt_gdal.cpp
View file @
9ff14bc4
...
...
@@ -135,6 +135,20 @@ int gdal2opencv( const GDALDataType& gdalType, const int& channels ){
else
{
return
CV_32SC
(
channels
);
}
return
-
1
;
case
GDT_Float32
:
if
(
channels
==
1
){
return
CV_32FC1
;
}
if
(
channels
==
3
){
return
CV_32FC3
;
}
if
(
channels
==
4
){
return
CV_32FC4
;
}
else
{
return
CV_32FC
(
channels
);
}
return
-
1
;
case
GDT_Float64
:
if
(
channels
==
1
){
return
CV_64FC1
;
}
if
(
channels
==
3
){
return
CV_64FC3
;
}
if
(
channels
==
4
){
return
CV_64FC4
;
}
else
{
return
CV_64FC
(
channels
);
}
return
-
1
;
default
:
std
::
cout
<<
"Unknown GDAL Data Type"
<<
std
::
endl
;
std
::
cout
<<
"Type: "
<<
GDALGetDataTypeName
(
gdalType
)
<<
std
::
endl
;
...
...
@@ -207,6 +221,13 @@ double range_cast( const GDALDataType& gdalType,
return
value
;
}
// float32 -> float32
// float64 -> float64
if
(
(
gdalType
==
GDT_Float32
||
gdalType
==
GDT_Float64
)
&&
(
cvDepth
==
CV_32F
||
cvDepth
==
CV_64F
)){
return
value
;
}
std
::
cout
<<
GDALGetDataTypeName
(
gdalType
)
<<
std
::
endl
;
std
::
cout
<<
"warning: unknown range cast requested."
<<
std
::
endl
;
return
(
value
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment