Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ofxaddons
ofxRGBVHistogram
Commits
a7301480
Commit
a7301480
authored
Oct 30, 2019
by
artificiel
Browse files
async thread for CPU openCV processing
parent
ebd20270
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/ofxRGBVHistogram.hpp
View file @
a7301480
...
...
@@ -3,6 +3,7 @@
#include <algorithm>
#include <functional>
#include <future>
#include "ofxFastFboReader.h"
#include "ofxHistogram.h"
...
...
@@ -45,6 +46,13 @@ public:
{
ofPixels
pixels
;
reader_
.
readToPixels
(
fbo
,
pixels
);
histo_stuff_
=
async
(
launch
::
async
,
&
ofxRGBVHistogram
::
perform_in_bg
,
this
,
pixels
);
}
std
::
pair
<
bool
,
std
::
string
>
perform_in_bg
(
ofPixels
pixels
)
{
pthread_setname_np
(
pthread_self
(),
"histogram"
);
rgb_
.
setFromPixels
(
pixels
);
cvCvtColor
(
rgb_
.
getCvImage
(),
hsv_
.
getCvImage
(),
CV_BGR2HSV
);
...
...
@@ -58,8 +66,11 @@ public:
// the hsv conversion is not cheap; this is a faster way to get a sense of the V
histogramV
=
histogramR
+
histogramG
+
histogramB
;
return
std
::
make_pair
(
true
,
"allo"
);
}
future
<
std
::
pair
<
bool
,
std
::
string
>>
histo_stuff_
;
void
draw
(
int
x
,
int
y
,
int
w
,
int
h
)
{
ofPushMatrix
();
...
...
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