Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
I
ImageINSA_Tanguy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Tanguy.Raufflet
ImageINSA_Tanguy
Commits
8f9093c5
Commit
8f9093c5
authored
6 years ago
by
ariotte
Browse files
Options
Downloads
Patches
Plain Diff
rotation are made around the center fixed rotation op
parent
62e6dcdb
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/Operations/DoubleEntropyOp.cpp
+1
-1
1 addition, 1 deletion
app/Operations/DoubleEntropyOp.cpp
app/Operations/RotateOp.cpp
+17
-25
17 additions, 25 deletions
app/Operations/RotateOp.cpp
with
18 additions
and
26 deletions
app/Operations/DoubleEntropyOp.cpp
+
1
−
1
View file @
8f9093c5
...
...
@@ -40,7 +40,7 @@ void DoubleEntropyOp::operator()(const Image_t<double>* image, const std::map<co
double
entropy
=
image
->
getEntropy
();
outText
(
qApp
->
translate
(
"Operations"
,
"Entropy of the image (sum of channels entropy) = %1
\n
"
).
arg
(
entropy
).
toStdString
());
outText
(
qApp
->
translate
(
"Pas d'échantillonnage choisi : 1
\n
"
));
outText
(
qApp
->
translate
(
"Operations"
,
"Pas d'échantillonnage choisi : 1
\n
"
)
.
toStdString
()
);
}
bool
DoubleEntropyOp
::
needCurrentImg
()
const
{
...
...
This diff is collapsed.
Click to expand it.
app/Operations/RotateOp.cpp
+
17
−
25
View file @
8f9093c5
...
...
@@ -45,11 +45,11 @@ struct Point {
Point
(
int
x_
=
0
,
int
y_
=
0
)
:
x
(
x_
),
y
(
y_
)
{}
};
inline
Point
rotatePoint
(
Point
toRotate
,
double
sin
,
double
cos
)
inline
Point
rotatePoint
(
Point
toRotate
,
Point
rotatePoint
,
double
sin
,
double
cos
)
{
Point
returnval
;
returnval
.
x
=
((
double
)
toRotate
.
x
)
*
cos
+
((
double
)
toRotate
.
y
)
*
sin
;
returnval
.
y
=
((
double
)
toRotate
.
y
)
*
cos
-
((
double
)
toRotate
.
x
)
*
sin
;
returnval
.
x
=
((
double
)
(
toRotate
.
x
-
rotatePoint
.
x
)
)
*
cos
+
((
double
)
(
toRotate
.
y
-
rotatePoint
.
y
))
*
sin
+
rotatePoint
.
x
;
returnval
.
y
=
((
double
)
(
toRotate
.
y
-
rotatePoint
.
y
)
)
*
cos
-
((
double
)
(
toRotate
.
x
-
rotatePoint
.
x
))
*
sin
+
rotatePoint
.
y
;
return
returnval
;
}
...
...
@@ -107,13 +107,13 @@ void RotateOp::operator()(const Image* img, const map<const Image*, string>& img
// Calculate the size of the new bitmap
Point
rotation_point
;
rotation_point
.
x
=
0
;
rotation_point
.
y
=
0
;
rotation_point
.
x
=
img
->
getWidth
()
/
2
;
rotation_point
.
y
=
img
->
getHeight
()
/
2
;
Point
p1
=
rotatePoint
(
Point
(
0
,
0
),
sin_angle
,
cos_angle
);
Point
p2
=
rotatePoint
(
Point
(
img
->
getWidth
()
-
1
,
0
),
sin_angle
,
cos_angle
);
Point
p3
=
rotatePoint
(
Point
(
0
,
img
->
getHeight
()
-
1
),
sin_angle
,
cos_angle
);
Point
p4
=
rotatePoint
(
Point
(
img
->
getWidth
()
-
1
,
img
->
getHeight
()
-
1
),
sin_angle
,
cos_angle
);
Point
p1
=
rotatePoint
(
Point
(
0
,
0
),
rotation_point
,
sin_angle
,
cos_angle
);
Point
p2
=
rotatePoint
(
Point
(
img
->
getWidth
()
-
1
,
0
),
rotation_point
,
sin_angle
,
cos_angle
);
Point
p3
=
rotatePoint
(
Point
(
0
,
img
->
getHeight
()
-
1
),
rotation_point
,
sin_angle
,
cos_angle
);
Point
p4
=
rotatePoint
(
Point
(
img
->
getWidth
()
-
1
,
img
->
getHeight
()
-
1
),
rotation_point
,
sin_angle
,
cos_angle
);
int
min_x
=
min
(
min
(
p1
.
x
,
p2
.
x
),
min
(
p3
.
x
,
p4
.
x
));
int
max_x
=
max
(
max
(
p1
.
x
,
p2
.
x
),
max
(
p3
.
x
,
p4
.
x
));
...
...
@@ -128,23 +128,15 @@ void RotateOp::operator()(const Image* img, const map<const Image*, string>& img
Image
*
resImg
=
new
Image
(
nWidth
,
nHeight
,
img
->
getNbChannels
(),
fillValue
);
Point
source_point
;
for
(
unsigned
int
c
=
0
;
c
<
resImg
->
getNbChannels
();
++
c
)
{
for
(
unsigned
int
hcounter
=
0
;
hcounter
<
nHeight
;
hcounter
++
)
{
for
(
unsigned
int
wcounter
=
0
;
wcounter
<
nWidth
;
wcounter
++
)
{
source_point
.
x
=
wcounter
+
min_x
;
source_point
.
y
=
hcounter
+
min_y
;
source_point
=
rotatePoint
(
source_point
,
sin_neg_ang
,
cos_neg_ang
);
source_point
.
x
=
source_point
.
x
+
rotation_point
.
x
;
source_point
.
y
=
source_point
.
y
+
rotation_point
.
y
;
if
(
(
source_point
.
x
>=
0
)
&&
(
source_point
.
x
<
Width
)
&&
(
source_point
.
y
>=
0
)
&&
(
source_point
.
y
<
Height
))
{
resImg
->
setPixel
(
wcounter
,
hcounter
,
c
,
img
->
getPixel
(
source_point
.
x
,
source_point
.
y
,
c
));
for
(
unsigned
int
c
=
0
;
c
<
resImg
->
getNbChannels
();
++
c
){
for
(
unsigned
int
i
=
0
;
i
<
resImg
->
getWidth
();
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
resImg
->
getHeight
();
j
++
){
source_point
=
rotatePoint
(
Point
(
i
,
j
),
rotation_point
,
sin_neg_ang
,
cos_neg_ang
);
try
{
resImg
->
setPixel
(
i
,
j
,
c
,
img
->
getPixel
(
source_point
.
x
,
source_point
.
y
,
c
));
}
catch
(
std
::
out_of_range
){}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment