Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
I
imgproc
Overview
Overview
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
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈皓
imgproc
Commits
ee256af6
Commit
ee256af6
authored
Sep 15, 2023
by
陈皓
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
d3813c70
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
15 additions
and
16 deletions
+15
-16
imgproc-server/src/main/java/com/zq/imgproc/utils/DemoUtil.java
+3
-7
imgproc-server/src/main/java/com/zq/imgproc/utils/Deskew.java
+10
-7
imgproc-server/src/main/resources/application.yml
+2
-2
No files found.
imgproc-server/src/main/java/com/zq/imgproc/utils/DemoUtil.java
View file @
ee256af6
...
@@ -16,11 +16,7 @@ public class DemoUtil {
...
@@ -16,11 +16,7 @@ public class DemoUtil {
final
static
String
URL
=
"localhost:8900/imgproc/v1/"
;
final
static
String
URL
=
"localhost:8900/imgproc/v1/"
;
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
detection
();
imageOptimization
();
// String testImg = "C:/Users/11419/Desktop/Deskew/TestImages/4.png";
// String resImg = "C:/Users/11419/Desktop/Deskew/TestImages/res4.jpg";
// System.out.println(Convert.toInt(-6.25));
// ImgUtil.rotate(FileUtil.file(testImg), Convert.toInt(-6.25), FileUtil.file(resImg));
}
}
public
static
void
detection
()
{
public
static
void
detection
()
{
...
@@ -44,8 +40,8 @@ public class DemoUtil {
...
@@ -44,8 +40,8 @@ public class DemoUtil {
}
}
public
static
void
imageOptimization
()
{
public
static
void
imageOptimization
()
{
String
testImg
=
"C:/Users/11419/Desktop/Deskew/TestImages/
F1550.jp
g"
;
String
testImg
=
"C:/Users/11419/Desktop/Deskew/TestImages/
6.pn
g"
;
String
resImg
=
"C:/Users/11419/Desktop/Deskew/TestImages/
res.jp
g"
;
String
resImg
=
"C:/Users/11419/Desktop/Deskew/TestImages/
6res.pn
g"
;
String
url
=
URL
+
"imageOptimization"
;
String
url
=
URL
+
"imageOptimization"
;
OptimizationReq
req
=
new
OptimizationReq
();
OptimizationReq
req
=
new
OptimizationReq
();
...
...
imgproc-server/src/main/java/com/zq/imgproc/utils/Deskew.java
View file @
ee256af6
...
@@ -10,10 +10,13 @@ import java.util.HashMap;
...
@@ -10,10 +10,13 @@ import java.util.HashMap;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
import
static
org
.
opencv
.
highgui
.
HighGui
.
imshow
;
import
static
org
.
opencv
.
highgui
.
HighGui
.
waitKey
;
public
class
Deskew
{
public
class
Deskew
{
public
static
void
main
(
String
[]
args
)
{
public
static
void
main
(
String
[]
args
)
{
System
.
load
(
"
C:/Users/11419/Desktop
/lib/opencv_java460.dll"
);
System
.
load
(
"
D:/project/imgproc
/lib/opencv_java460.dll"
);
Mat
image
=
Imgcodecs
.
imread
(
"C:/Users/11419/Desktop/Deskew/TestImages/4.png"
);
Mat
image
=
Imgcodecs
.
imread
(
"C:/Users/11419/Desktop/Deskew/TestImages/4.png"
);
int
angle
=
getDeskewAngle
(
image
);
int
angle
=
getDeskewAngle
(
image
);
System
.
out
.
println
(
angle
);
System
.
out
.
println
(
angle
);
...
@@ -133,18 +136,18 @@ public class Deskew {
...
@@ -133,18 +136,18 @@ public class Deskew {
int
w
=
image
.
cols
();
int
w
=
image
.
cols
();
int
h
=
image
.
rows
();
int
h
=
image
.
rows
();
// 定义参数
double
scale
=
1.0
;
Point
center
=
new
Point
((
double
)
w
/
2
,
(
double
)
h
/
2
);
Point
center
=
new
Point
((
double
)
w
/
2
,
(
double
)
h
/
2
);
double
scale
=
1.0
;
// 定义旋转矩阵
Mat
rotationMatrix
=
Imgproc
.
getRotationMatrix2D
(
center
,
angle
,
scale
);
Mat
rotationMatrix
=
Imgproc
.
getRotationMatrix2D
(
center
,
-
angle
,
scale
);
// 旋转矩阵
// 设置填充颜色为白色
Mat
rotatedImage
=
new
Mat
();
Scalar
backgroundColor
=
new
Scalar
(
255
,
255
,
255
);
Scalar
backgroundColor
=
new
Scalar
(
255
,
255
,
255
);
Mat
rotatedImage
=
new
Mat
();
Imgproc
.
warpAffine
(
image
,
rotatedImage
,
rotationMatrix
,
new
Size
(
w
,
h
),
Imgproc
.
INTER_LINEAR
,
Core
.
BORDER_CONSTANT
,
backgroundColor
);
Imgproc
.
warpAffine
(
image
,
rotatedImage
,
rotationMatrix
,
new
Size
(
w
,
h
),
Imgproc
.
INTER_LINEAR
,
Core
.
BORDER_CONSTANT
,
backgroundColor
);
rotationMatrix
.
release
();
return
rotatedImage
;
return
rotatedImage
;
}
}
...
...
imgproc-server/src/main/resources/application.yml
View file @
ee256af6
...
@@ -24,6 +24,6 @@ imgconfig:
...
@@ -24,6 +24,6 @@ imgconfig:
deskewpy
:
/opt/tianjin/lib/correct.py
deskewpy
:
/opt/tianjin/lib/correct.py
#imgconfig:
#imgconfig:
# opencv:
C:/Users/11419/Desktop
/lib/opencv_java460.dll
# opencv:
D:/project/imgproc
/lib/opencv_java460.dll
# deskew: C:/Users/11419/Desktop/Deskew/Bin/deskew.exe
# deskew: C:/Users/11419/Desktop/Deskew/Bin/deskew.exe
# deskewpy:
C:/Users/11419/Desktop
/lib/correct.py
# deskewpy:
D:/project/imgproc
/lib/correct.py
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