-
Notifications
You must be signed in to change notification settings - Fork 3
/
bmpfromocvpanel.h
47 lines (35 loc) · 1.45 KB
/
bmpfromocvpanel.h
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
///////////////////////////////////////////////////////////////////////////////
// Name: bmpfromocvpanel.h
// Purpose: Displays a wxBitmap originated from OpenCV
// Author: PB
// Created: 2020-09-16
// Copyright: (c) 2020 PB
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
#ifndef BMPFROMOCVPANEL_H
#define BMPFROMOCVPANEL_H
#include <wx/wx.h>
#include <wx/scrolwin.h>
// This class displays a wxBitmap originated from OpenCV
// and also the time it took to obtain, convert, and display the bitmap.
//
// The color or font of the overlay text can be changed by left (color)
// or right (font) doubleclick on the panel.
class wxBitmapFromOpenCVPanel : public wxScrolledCanvas
{
public:
wxBitmapFromOpenCVPanel(wxWindow* parent);
bool SetBitmap(const wxBitmap& bitmap, const long timeGet, const long timeConvert);
const wxBitmap& GetBitmap() { return m_bitmap; }
private:
wxBitmap m_bitmap;
wxColour m_overlayTextColour;
wxFont m_overlayFont;
long m_timeGetCVBitmap{0}; // time to obtain bitmap from OpenCV in ms
long m_timeConvertBitmap{0}; // time to convert Mat to wxBitmap in ms
wxSize DoGetBestClientSize() const override;
void OnPaint(wxPaintEvent&);
void OnChangeOverlayTextColour(wxMouseEvent&);
void OnChangeOverlayFont(wxMouseEvent&);
};
#endif // #ifndef BMPFROMOCVPANEL_H