Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
69e62948
Commit
69e62948
authored
Aug 20, 2010
by
Yannick Verdie
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Qt ticket #537
Forgot to update so code after previous fix
parent
6cafec88
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
7 deletions
+23
-7
window_QT.cpp
modules/highgui/src/window_QT.cpp
+23
-7
No files found.
modules/highgui/src/window_QT.cpp
View file @
69e62948
...
...
@@ -2342,6 +2342,11 @@ void ViewPort::updateImage(const CvArr *arr)
cvReleaseMat
(
&
image2Draw_mat
);
//the image in ipl (to do a deep copy with cvCvtColor)
image2Draw_mat
=
cvCreateMat
(
mat
->
rows
,
mat
->
cols
,
CV_8UC3
);
image2Draw_qt
=
QImage
((
uchar
*
)
image2Draw_mat
->
data
.
ptr
,
image2Draw_mat
->
cols
,
image2Draw_mat
->
rows
,
QImage
::
Format_RGB888
);
//use to compute mouse coordinate, I need to update the ratio here and in resizeEvent
ratioX
=
width
()
/
float
(
image2Draw_mat
->
cols
);
ratioY
=
height
()
/
float
(
image2Draw_mat
->
rows
);
updateGeometry
();
}
...
...
@@ -2618,6 +2623,8 @@ void ViewPort::resizeEvent ( QResizeEvent *event)
{
controlImagePosition
();
//use to compute mouse coordinate, I need to update the ratio here and in resizeEvent
ratioX
=
width
()
/
float
(
image2Draw_mat
->
cols
);
ratioY
=
height
()
/
float
(
image2Draw_mat
->
rows
);
...
...
@@ -2713,10 +2720,14 @@ void ViewPort::draw2D(QPainter *painter)
//only if CV_8UC1 or CV_8UC3
void
ViewPort
::
drawStatusBar
()
{
if
(
mouseCoordinate
.
x
()
>=
0
&&
mouseCoordinate
.
y
()
>=
0
&&
mouseCoordinate
.
x
()
<
image2Draw_mat
->
cols
&&
mouseCoordinate
.
y
()
<
image2Draw_mat
->
rows
)
if
(
nbChannelOriginImage
!=
CV_8UC1
&&
nbChannelOriginImage
!=
CV_8UC3
)
return
;
//if (mouseCoordinate.x()>=0 &&
// mouseCoordinate.y()>=0 &&
// mouseCoordinate.x()<image2Draw_qt.width() &&
// mouseCoordinate.y()<image2Draw_qt.height())
if
(
mouseCoordinate
.
x
()
>=
0
&&
mouseCoordinate
.
y
()
>=
0
)
{
QRgb
rgbValue
=
image2Draw_qt
.
pixel
(
mouseCoordinate
);
...
...
@@ -2743,9 +2754,13 @@ void ViewPort::drawStatusBar()
}
}
//accept only CV_8UC1 and CV_8UC8 image for now
void
ViewPort
::
drawImgRegion
(
QPainter
*
painter
)
{
if
(
nbChannelOriginImage
!=
CV_8UC1
&&
nbChannelOriginImage
!=
CV_8UC3
)
return
;
qreal
offsetX
=
param_matrixWorld
.
dx
()
/
param_matrixWorld
.
m11
();
offsetX
=
offsetX
-
floor
(
offsetX
);
qreal
offsetY
=
param_matrixWorld
.
dy
()
/
param_matrixWorld
.
m11
();
...
...
@@ -2789,7 +2804,7 @@ void ViewPort::drawImgRegion(QPainter *painter)
else
rgbValue
=
qRgb
(
0
,
0
,
0
);
if
(
nbChannelOriginImage
==
3
)
if
(
nbChannelOriginImage
==
CV_8UC
3
)
{
//for debug
/*
...
...
@@ -2815,7 +2830,8 @@ void ViewPort::drawImgRegion(QPainter *painter)
Qt
::
AlignCenter
,
val
);
}
else
if
(
nbChannelOriginImage
==
CV_8UC1
)
{
val
=
tr
(
"%1"
).
arg
(
qRed
(
rgbValue
));
...
...
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