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
22dfc1da
Commit
22dfc1da
authored
Nov 08, 2017
by
Alexander Alekhin
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #10051 from sturkmen72:upd_grfmt_gdal_cpp
parents
0a7c60b4
e51a8e04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
41 deletions
+7
-41
grfmt_gdal.cpp
modules/imgcodecs/src/grfmt_gdal.cpp
+7
-41
No files found.
modules/imgcodecs/src/grfmt_gdal.cpp
View file @
22dfc1da
...
...
@@ -104,58 +104,32 @@ int gdal2opencv( const GDALDataType& gdalType, const int& channels ){
/// UInt8
case
GDT_Byte
:
if
(
channels
==
1
){
return
CV_8UC1
;
}
if
(
channels
==
3
){
return
CV_8UC3
;
}
if
(
channels
==
4
){
return
CV_8UC4
;
}
else
{
return
CV_8UC
(
channels
);
}
return
-
1
;
return
CV_8UC
(
channels
);
/// UInt16
case
GDT_UInt16
:
if
(
channels
==
1
){
return
CV_16UC1
;
}
if
(
channels
==
3
){
return
CV_16UC3
;
}
if
(
channels
==
4
){
return
CV_16UC4
;
}
else
{
return
CV_16UC
(
channels
);
}
return
-
1
;
return
CV_16UC
(
channels
);
/// Int16
case
GDT_Int16
:
if
(
channels
==
1
){
return
CV_16SC1
;
}
if
(
channels
==
3
){
return
CV_16SC3
;
}
if
(
channels
==
4
){
return
CV_16SC4
;
}
else
{
return
CV_16SC
(
channels
);
}
return
-
1
;
return
CV_16SC
(
channels
);
/// UInt32
case
GDT_UInt32
:
case
GDT_Int32
:
if
(
channels
==
1
){
return
CV_32SC1
;
}
if
(
channels
==
3
){
return
CV_32SC3
;
}
if
(
channels
==
4
){
return
CV_32SC4
;
}
else
{
return
CV_32SC
(
channels
);
}
return
-
1
;
return
CV_32SC
(
channels
);
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
;
return
CV_32FC
(
channels
);
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
;
return
CV_64FC
(
channels
);
default
:
std
::
cout
<<
"Unknown GDAL Data Type"
<<
std
::
endl
;
std
::
cout
<<
"Type: "
<<
GDALGetDataTypeName
(
gdalType
)
<<
std
::
endl
;
return
-
1
;
}
return
-
1
;
}
/**
...
...
@@ -163,7 +137,6 @@ int gdal2opencv( const GDALDataType& gdalType, const int& channels ){
*/
GdalDecoder
::
GdalDecoder
(){
// set a dummy signature
m_signature
=
"0"
;
for
(
size_t
i
=
0
;
i
<
160
;
i
++
){
...
...
@@ -182,7 +155,6 @@ GdalDecoder::GdalDecoder(){
*/
GdalDecoder
::~
GdalDecoder
(){
if
(
m_dataset
!=
NULL
){
close
();
}
...
...
@@ -383,10 +355,7 @@ bool GdalDecoder::readData( Mat& img ){
// make sure the image is the proper size
if
(
img
.
size
().
height
!=
m_height
){
return
false
;
}
if
(
img
.
size
().
width
!=
m_width
){
if
(
img
.
size
()
!=
Size
(
m_width
,
m_height
)
){
return
false
;
}
...
...
@@ -398,7 +367,6 @@ bool GdalDecoder::readData( Mat& img ){
// set the image to zero
img
=
0
;
// iterate over each raster band
// note that OpenCV does bgr rather than rgb
int
nChannels
=
m_dataset
->
GetRasterCount
();
...
...
@@ -452,8 +420,6 @@ bool GdalDecoder::readData( Mat& img ){
// delete our temp pointer
delete
[]
scanline
;
}
return
true
;
...
...
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