This example requires Qt5 >= 5.9 setup for building.
This example requires Qt5 >= 5.9 setup for building.
You may build it with Ubuntu 18.04's default Qt5 after installing:
- qt5-default
- qtdeclarative5-dev
- qml-module-qtquick2
15#include <QApplication>
23#include <cvb/ui/image_view_item.hpp>
24#include <cvb/foundation/blob.hpp>
25#include <cvb/image.hpp>
27#include "blob_result_model.hpp"
29int main(
int argc,
char* argv[])
36 Cvb::String path(Cvb::InstallPath() + CVB_LIT(
"tutorial/Foundation/Images/Blob/Microswitch.bmp"));
38 path = Cvb::ExpandPath(path);
43 auto blobResults = Cvb::Foundation::BinarizeAndSearchBlobs(image->Plane(0),
Cvb::ValueRange<int>(0, 62), filter);
45 BlobResultModel blobResultModel(blobResults);
60 context->setContextProperty(
"blobResultModel", &blobResultModel);
67 imageController.
Refresh(std::move(image));
Class to build a filter for the blob search.
Definition: blob.hpp:387
static std::unique_ptr< Image > Load(const String &fileName)
Loads an image with the given file name.
Definition: detail_image.hpp:32
Controller object for the QML image view item.
Definition: image_view_item.hpp:252
void Refresh(const ImagePtr &image, AutoRefresh autoRefresh=AutoRefresh::Off)
Share the image and refresh the view.
Definition: image_view_item.hpp:294
static void Register()
Convenience method to register this type in QML.
Definition: image_view_item.hpp:90
static void Register()
Convenience method to register this type in QML.
Definition: image_view_item.hpp:667
void setContextProperty(const QString &name, QObject *value)
void setResizeMode(QQuickView::ResizeMode)
QQmlContext * rootContext() const const
void setSource(const QUrl &url)
QUrl fromLocalFile(const QString &localFile)
void resize(const QSize &newSize)
void setIcon(const QIcon &icon)
UI definition using QML:
2import CvbQuick 1.0 as CvbQuick
16 model : blobResultModel
20 imageX : boundingBox.x
21 imageY : boundingBox.y
22 boxWidth : boundingBox.width
23 boxHeight : boundingBox.height
29 model : blobResultModel