1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
| #include "ImageDrawElement.h"
|
|
| ImageDrawElement::ImageDrawElement()
| {
| }
|
| void ImageDrawElement::setRects(const std::vector<cv::Rect2f> &value)
| {
| rectsMtx.lock();
| rectsBuffer = value;
| rectsUpdated = true;
| rectsMtx.unlock();
| }
|
| void ImageDrawElement::processImage(cv::Mat &image)
| {
| if(rectsUpdated){
| rectsMtx.lock();
| rects = rectsBuffer;
| rectsUpdated = false;
| rectsMtx.unlock();
| }
| for(size_t i = 0;i<rects.size();i++){
| cv::Rect2f& rectf = rects[i];
| cv::Rect rect(rectf.x*image.cols,rectf.y*image.rows,rectf.width*image.cols,rectf.height*image.rows);
| cv::rectangle(image, rect,cv::Scalar(0,0,255),4);
| }
| fireConnectors();
| }
|
|