Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
E
Ear recognition
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
3
Issues
3
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Boston University
Ear recognition
Commits
77bd319a
Commit
77bd319a
authored
Oct 08, 2015
by
Josejulio Martínez Magaña
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added OpenCv Utility class, with a method for resizing a giving Mat.
parent
b02b610c
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
0 deletions
+34
-0
OpenCvUtils.java
...in/java/com/aluxoft/earrecognition/utils/OpenCvUtils.java
+34
-0
No files found.
app/src/main/java/com/aluxoft/earrecognition/utils/OpenCvUtils.java
0 → 100644
View file @
77bd319a
package
com
.
aluxoft
.
earrecognition
.
utils
;
import
org.opencv.core.Mat
;
import
org.opencv.core.Size
;
import
org.opencv.imgproc.Imgproc
;
/**
* Created by josejuliomartinez on 08/10/15.
*/
public
class
OpenCvUtils
{
public
static
void
resizeMat
(
Mat
image
,
double
maxWidth
,
double
maxHeight
)
{
if
(
image
.
width
()
<=
maxWidth
&&
image
.
height
()
<=
maxHeight
)
{
return
;
}
double
ratio
=
(
double
)
image
.
width
()
/
(
double
)
image
.
height
();
double
width
,
height
;
if
(
ratio
>
1
)
{
width
=
maxWidth
;
height
=
maxWidth
*
((
double
)
image
.
height
()/(
double
)
image
.
width
());
}
else
{
height
=
maxHeight
;
width
=
maxHeight
*
ratio
;
}
Imgproc
.
resize
(
image
,
image
,
new
Size
(
width
,
height
));
}
private
OpenCvUtils
()
{
}
}
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