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
97ec6695
Commit
97ec6695
authored
4 years ago
by
yliu2
Browse files
Options
Downloads
Patches
Plain Diff
Pixel operations upgraded
parent
57882ca5
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/Operations/PointOp.cpp
+24
-5
24 additions, 5 deletions
app/Operations/PointOp.cpp
app/Operations/PointOp.h
+29
-1
29 additions, 1 deletion
app/Operations/PointOp.h
lib/detiq-t
+1
-1
1 addition, 1 deletion
lib/detiq-t
with
54 additions
and
7 deletions
app/Operations/PointOp.cpp
+
24
−
5
View file @
97ec6695
...
@@ -64,6 +64,9 @@ PointOp::DoublePixelOp* PointOp::DoublePixelOp::fromString(QString op, QString e
...
@@ -64,6 +64,9 @@ PointOp::DoublePixelOp* PointOp::DoublePixelOp::fromString(QString op, QString e
if
(
op
==
"-"
)
return
new
DoublePixAdd
(
-
expr
.
toDouble
());
if
(
op
==
"-"
)
return
new
DoublePixAdd
(
-
expr
.
toDouble
());
if
(
op
==
"*"
)
return
new
DoublePixMul
(
expr
.
toDouble
());
if
(
op
==
"*"
)
return
new
DoublePixMul
(
expr
.
toDouble
());
if
(
op
==
"/"
)
return
new
DoublePixMul
(
1
/
expr
.
toDouble
());
if
(
op
==
"/"
)
return
new
DoublePixMul
(
1
/
expr
.
toDouble
());
if
(
op
==
"&"
)
return
new
DoublePixAnd
(
expr
.
toDouble
());
if
(
op
==
"|"
)
return
new
DoublePixOr
(
expr
.
toDouble
());
if
(
op
==
"^"
)
return
new
DoublePixXor
(
expr
.
toDouble
());
if
(
op
==
""
)
return
new
DoublePixIdent
();
if
(
op
==
""
)
return
new
DoublePixIdent
();
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
return
new
DoublePixIdent
();
return
new
DoublePixIdent
();
...
@@ -81,11 +84,15 @@ PointOp::ImageOp* PointOp::ImageOp::fromString(QString op) {
...
@@ -81,11 +84,15 @@ PointOp::ImageOp* PointOp::ImageOp::fromString(QString op) {
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
return
new
ImgIdent
();
return
new
ImgIdent
();
}
}
PointOp
::
DoubleImageOp
*
PointOp
::
DoubleImageOp
::
fromString
(
QString
op
)
{
PointOp
::
DoubleImageOp
*
PointOp
::
DoubleImageOp
::
fromString
(
QString
op
)
{
if
(
op
==
"+"
)
return
new
DoubleImgAdd
();
if
(
op
==
"+"
)
return
new
DoubleImgAdd
();
if
(
op
==
"-"
)
return
new
DoubleImgSub
();
if
(
op
==
"-"
)
return
new
DoubleImgSub
();
if
(
op
==
"*"
)
return
new
DoubleImgMul
();
if
(
op
==
"*"
)
return
new
DoubleImgMul
();
if
(
op
==
"/"
)
return
new
DoubleImgDiv
();
if
(
op
==
"/"
)
return
new
DoubleImgDiv
();
if
(
op
==
"&"
)
return
new
DoubleImgAnd
();
if
(
op
==
"|"
)
return
new
DoubleImgOr
();
if
(
op
==
"^"
)
return
new
DoubleImgXor
();
if
(
op
==
""
)
return
new
DoubleImgIdent
();
if
(
op
==
""
)
return
new
DoubleImgIdent
();
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
std
::
cout
<<
"Unknown operator '"
<<
op
.
toStdString
()
<<
"' !"
<<
std
::
endl
;
return
new
DoubleImgIdent
();
return
new
DoubleImgIdent
();
...
@@ -118,14 +125,18 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
...
@@ -118,14 +125,18 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
QVBoxLayout
*
layout
=
new
QVBoxLayout
();
dialog
->
setLayout
(
layout
);
dialog
->
setLayout
(
layout
);
/*The generation order of the widgets does not match the layout, exchange their positions*/
QGroupBox
*
radioGroup
=
new
QGroupBox
(
qApp
->
translate
(
"PointOp"
,
"Second operand"
),
dialog
);
QGroupBox
*
radioGroup
=
new
QGroupBox
(
qApp
->
translate
(
"PointOp"
,
"Second operand"
),
dialog
);
QRadioButton
*
uCharButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"UChar"
));
// QRadioButton* uCharButton = new QRadioButton(qApp->translate("PointOp", "UChar"));
QRadioButton
*
doubleButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Double"
));
// QRadioButton* doubleButton = new QRadioButton(qApp->translate("PointOp", "Double"));
QGroupBox
*
radioGroup2
=
new
QGroupBox
(
qApp
->
translate
(
"PointOp"
,
"Output image"
),
dialog
);
QRadioButton
*
valueButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Value"
));
QRadioButton
*
valueButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Value"
));
QRadioButton
*
imageButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Image"
));
QRadioButton
*
imageButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Image"
));
QGroupBox
*
radioGroup2
=
new
QGroupBox
(
qApp
->
translate
(
"PointOp"
,
"Output image"
),
dialog
);
// QRadioButton* valueButton = new QRadioButton(qApp->translate("PointOp", "Value"));
// QRadioButton* imageButton = new QRadioButton(qApp->translate("PointOp", "Image"));
QRadioButton
*
uCharButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"UChar"
));
QRadioButton
*
doubleButton
=
new
QRadioButton
(
qApp
->
translate
(
"PointOp"
,
"Double"
));
QHBoxLayout
*
radioLayout
=
new
QHBoxLayout
(
radioGroup
);
QHBoxLayout
*
radioLayout
=
new
QHBoxLayout
(
radioGroup
);
...
@@ -294,6 +305,8 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
...
@@ -294,6 +305,8 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
}
}
else
{
else
{
DoubleImageOp
**
imageOps
=
new
DoubleImageOp
*
[
nChannel
];
DoubleImageOp
**
imageOps
=
new
DoubleImageOp
*
[
nChannel
];
/*The double image process exist already, but cases of standard images is ignored*/
ImageOp
**
imageOpsStd
=
new
ImageOp
*
[
nChannel
];
bool
isDblImg
[
nChannel
];
bool
isDblImg
[
nChannel
];
const
Image_t
<
double
>*
dblImageImgs
[
nChannel
];
const
Image_t
<
double
>*
dblImageImgs
[
nChannel
];
const
Image
*
stdImageImgs
[
nChannel
];
const
Image
*
stdImageImgs
[
nChannel
];
...
@@ -311,7 +324,9 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
...
@@ -311,7 +324,9 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
}
}
else
{
else
{
const
Image
*
imageImg
=
imageBoxes
[
0
]
->
getStdImage
(
imageBoxes
[
0
]
->
currentText
().
toStdString
());
const
Image
*
imageImg
=
imageBoxes
[
0
]
->
getStdImage
(
imageBoxes
[
0
]
->
currentText
().
toStdString
());
ImageOp
*
imageOpStd
=
ImageOp
::
fromString
(
imgOperatorBoxes
[
0
]
->
currentText
());
for
(
int
i
=
0
;
i
<
nChannel
;
++
i
)
{
for
(
int
i
=
0
;
i
<
nChannel
;
++
i
)
{
imageOpsStd
[
i
]
=
imageOpStd
;
stdImageImgs
[
i
]
=
imageImg
;
stdImageImgs
[
i
]
=
imageImg
;
isDblImg
[
i
]
=
false
;
isDblImg
[
i
]
=
false
;
}
}
...
@@ -357,7 +372,11 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
...
@@ -357,7 +372,11 @@ void PointOp::operator()(const ImageWindow* currentWnd, const vector<const Image
const
unsigned
int
channel
=
(
c
<
stdImageImgs
[
c
]
->
getNbChannels
()
?
c
:
0
);
const
unsigned
int
channel
=
(
c
<
stdImageImgs
[
c
]
->
getNbChannels
()
?
c
:
0
);
value2
=
stdImageImgs
[
c
]
->
getPixel
(
i
,
j
,
channel
);
value2
=
stdImageImgs
[
c
]
->
getPixel
(
i
,
j
,
channel
);
}
}
value1
=
imageOps
[
c
]
->
operator
()(
value1
,
value2
);
if
(
isDblImg
[
c
]){
value1
=
imageOps
[
c
]
->
operator
()(
value1
,
value2
);
}
else
{
value1
=
imageOpsStd
[
c
]
->
operator
()(
value1
,
value2
);
}
resImg
->
setPixel
(
i
,
j
,
c
,
value1
);
resImg
->
setPixel
(
i
,
j
,
c
,
value1
);
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
app/Operations/PointOp.h
+
29
−
1
View file @
97ec6695
...
@@ -106,16 +106,34 @@ class PointOp : public GenericOperation {
...
@@ -106,16 +106,34 @@ class PointOp : public GenericOperation {
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
&
value
;
}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
&
value
;
}
};
};
/*Return zero if the operands have zero*/
struct
DoublePixAnd
:
DoublePixelOp
{
DoublePixAnd
(
double
value_
)
:
DoublePixelOp
(
value_
)
{}
double
op
(
double
pixel
)
{
return
(
pixel
==
0
or
value
==
0
)
?
0
:
pixel
;
}
};
struct
PixOr
:
PixOp_t
<
depth_t
>
{
struct
PixOr
:
PixOp_t
<
depth_t
>
{
PixOr
(
depth_t
value_
)
:
PixOp_t
<
depth_t
>
(
value_
)
{}
PixOr
(
depth_t
value_
)
:
PixOp_t
<
depth_t
>
(
value_
)
{}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
|
value
;
}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
|
value
;
}
};
};
/*Return zero only if the operands are both zero*/
struct
DoublePixOr
:
DoublePixelOp
{
DoublePixOr
(
double
value_
)
:
DoublePixelOp
(
value_
)
{}
double
op
(
double
pixel
)
{
return
(
pixel
==
0
and
value
==
0
)
?
0
:
pixel
;
}
};
struct
PixXor
:
PixOp_t
<
depth_t
>
{
struct
PixXor
:
PixOp_t
<
depth_t
>
{
PixXor
(
depth_t
value_
)
:
PixOp_t
<
depth_t
>
(
value_
)
{}
PixXor
(
depth_t
value_
)
:
PixOp_t
<
depth_t
>
(
value_
)
{}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
^
value
;
}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
^
value
;
}
};
};
/*Return zero only if the operands have the same value*/
struct
DoublePixXor
:
DoublePixelOp
{
DoublePixXor
(
double
value_
)
:
DoublePixelOp
(
value_
)
{}
double
op
(
double
pixel
)
{
return
(
pixel
==
value
)
?
0
:
pixel
;
}
};
struct
PixLshift
:
PixOp_t
<
unsigned
int
>
{
struct
PixLshift
:
PixOp_t
<
unsigned
int
>
{
PixLshift
(
unsigned
int
value_
)
:
PixOp_t
<
unsigned
int
>
(
value_
)
{}
PixLshift
(
unsigned
int
value_
)
:
PixOp_t
<
unsigned
int
>
(
value_
)
{}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
<<
value
;
}
intmax_t
op
(
depth_t
pixel
)
{
return
pixel
<<
value
;
}
...
@@ -181,16 +199,26 @@ class PointOp : public GenericOperation {
...
@@ -181,16 +199,26 @@ class PointOp : public GenericOperation {
struct
ImgAnd
:
ImageOp
{
struct
ImgAnd
:
ImageOp
{
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
&
pix2
;
}
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
&
pix2
;
}
};
};
struct
DoubleImgAnd
:
DoubleImageOp
{
double
op
(
double
pix1
,
double
pix2
)
{
return
(
pix1
==
0
or
pix2
==
0
)
?
0
:
pix1
;}
};
struct
ImgOr
:
ImageOp
{
struct
ImgOr
:
ImageOp
{
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
|
pix2
;
}
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
|
pix2
;
}
};
};
struct
DoubleImgOr
:
DoubleImageOp
{
double
op
(
double
pix1
,
double
pix2
)
{
return
(
pix1
==
0
and
pix2
==
0
)
?
0
:
pix1
;}
};
struct
ImgXor
:
ImageOp
{
struct
ImgXor
:
ImageOp
{
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
^
pix2
;
}
intmax_t
op
(
depth_t
pix1
,
depth_t
pix2
)
{
return
pix1
^
pix2
;
}
};
};
struct
DoubleImgXor
:
DoubleImageOp
{
double
op
(
double
pix1
,
double
pix2
)
{
return
(
pix1
==
pix2
)
?
0
:
pix1
;
}
};
};
};
...
...
This diff is collapsed.
Click to expand it.
detiq-t
@
3a99904c
Compare
3f970a07
...
3a99904c
Subproject commit 3
f970a071b367a8ea462f4fa2db7f96fd5148119
Subproject commit 3
a99904c0770a286941c6158e2a44cf1e1ceceb6
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