Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
nptool
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
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
np
nptool
Commits
ad905466
Commit
ad905466
authored
7 years ago
by
moukaddam
Browse files
Options
Downloads
Patches
Plain Diff
fixing the return values in Get<Color>AtCoordinate functions
parent
57080ce8
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
NPLib/Core/NPImage.cxx
+5
-5
5 additions, 5 deletions
NPLib/Core/NPImage.cxx
with
5 additions
and
5 deletions
NPLib/Core/NPImage.cxx
+
5
−
5
View file @
ad905466
...
...
@@ -70,7 +70,7 @@ void NPL::Image::Print(double scale){
m_Height
=
m_Image
->
GetHeight
();
for
(
unsigned
int
i
=
0
;
i
<
m_Width
;
i
++
){
for
(
unsigned
int
j
=
0
;
j
<
m_Height
;
j
++
){
unsigned
int
index
=
i
*
m_Width
+
j
;
unsigned
int
index
=
i
*
m_Width
+
j
;
// unsigned int index = i*m_Width+j;
unsigned
int
b
=
GetBlueAtPixel
(
i
,
j
);
unsigned
int
g
=
GetGreenAtPixel
(
i
,
j
);
unsigned
int
r
=
GetRedAtPixel
(
i
,
j
);
...
...
@@ -106,19 +106,19 @@ unsigned int NPL::Image::GetRedAtCoordinate(double x, double y){
unsigned
int
NPL
::
Image
::
GetGreenAtCoordinate
(
double
x
,
double
y
){
unsigned
int
xp
=
x
/
m_Xscaling
+
m_Width
/
2
;
unsigned
int
yp
=
y
/
m_Yscaling
+
m_Height
/
2
;
return
Get
Red
AtPixel
(
xp
,
yp
);
return
Get
Green
AtPixel
(
xp
,
yp
);
}
////////////////////////////////////////////////////////////////////////////////
unsigned
int
NPL
::
Image
::
GetBlueAtCoordinate
(
double
x
,
double
y
){
unsigned
int
xp
=
x
/
m_Xscaling
+
m_Width
/
2
;
unsigned
int
yp
=
y
/
m_Yscaling
+
m_Height
/
2
;
return
Get
Red
AtPixel
(
xp
,
yp
);
return
Get
Blue
AtPixel
(
xp
,
yp
);
}
////////////////////////////////////////////////////////////////////////////////
unsigned
int
NPL
::
Image
::
GetAlphaAtCoordinate
(
double
x
,
double
y
){
unsigned
int
xp
=
x
/
m_Xscaling
+
m_Width
/
2
;
unsigned
int
yp
=
y
/
m_Yscaling
+
m_Height
/
2
;
return
Get
Red
AtPixel
(
xp
,
yp
);
return
Get
Alpha
AtPixel
(
xp
,
yp
);
}
////////////////////////////////////////////////////////////////////////////////
unsigned
int
NPL
::
Image
::
GetPixelAtCoordinate
(
double
x
,
double
y
){
...
...
@@ -130,7 +130,7 @@ unsigned int NPL::Image::GetPixelAtCoordinate(double x, double y){
////////////////////////////////////////////////////////////////////////////////
unsigned
int
NPL
::
Image
::
PixelToIndex
(
unsigned
int
x
,
unsigned
int
y
){
unsigned
int
index
=
x
*
m_Width
+
y
;
unsigned
int
index
=
x
*
m_Width
+
y
;
//unsigned int index = x*m_Width+y;
if
(
index
>
m_Width
*
m_Height
)
// possible because of rounding
index
=
m_Width
*
m_Height
-
1
;
return
index
;
...
...
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