11 auto InstrParams = DynExp::dynamic_Params_cast<DummyCamera>(Instance.
ParamsGetter());
12 auto InstrData = DynExp::dynamic_InstrumentData_cast<DummyCamera>(Instance.
InstrumentDataGetter());
14 InstrData->DummyImage = QImage(QString::fromStdString(InstrParams->ImagePath.GetPath().string()));
15 if (InstrData->DummyImage.isNull())
27 auto InstrData = DynExp::dynamic_InstrumentData_cast<DummyCamera>(Instance.
InstrumentDataGetter());
29 Image = InstrData->DummyImage;
30 ImageTransformation = InstrData->GetImageTransformation();
35 auto ImageBlobPtr = Image.bits();
37 long long MaxIndex = 0;
38 switch (Image.format())
40 case QImage::Format::Format_ARGB32:
41 case QImage::Format::Format_RGB32:
42 MaxIndex = Image.width() * Image.height() * 4;
44 case QImage::Format::Format_Grayscale8:
45 case QImage::Format::Format_Grayscale16:
46 MaxIndex = Image.width() * Image.height();
52 for (
long long i = 0; i < MaxIndex; ++i)
53 if (Image.format() == QImage::Format::Format_Grayscale16)
55 uint16_t Pixel = *(ImageBlobPtr) | (*(ImageBlobPtr + 1) << 8);
59 *(ImageBlobPtr) = Pixel & 0xff;
60 *(ImageBlobPtr + 1) = (Pixel & 0xff00) >> 8;
66 *ImageBlobPtr =
TransformPixel(*ImageBlobPtr, ImageTransformation);
76 DummyImage = QImage();
82 :
Camera(OwnerThreadID, std::move(Params))
Implementation of a camera instrument without any related physical hardware loading image files from ...
bool IsEnabled
Determines whether the image transformation is to be applied (enabled).
Meta instrument for an image capturing (camera) device.
void ResetImpl(dispatch_tag< CameraData >) override final
void InitFuncImpl(dispatch_tag< CameraTasks::InitTask >, DynExp::InstrumentInstance &Instance) override final
Initializes the respective instrument within the instrument inheritance hierarchy....
virtual QImage ObtainImage(DynExp::InstrumentInstance &Instance) override
Retrieves the current image from the underlying hardware device, applies image transformations (e....
void ResetImpl(dispatch_tag< Camera >) override final
Refer to DynExp::Object::Reset(). Using tag dispatch mechanism to ensure that ResetImpl() of every de...
DummyCamera(const std::thread::id OwnerThreadID, DynExp::ParamsBasePtrType &&Params)
Refer to DynExp::ParamsBase::dispatch_tag.
Refer to ParamsBase::dispatch_tag.
Defines data for a thread belonging to a InstrumentBase instance. Refer to RunnableInstance.
const InstrumentBase::InstrumentDataGetterType InstrumentDataGetter
Getter for instrument's data. Refer to InstrumentBase::InstrumentDataGetterType.
Refer to ParamsBase::dispatch_tag.
const Object::ParamsGetterType ParamsGetter
Invoke to obtain the parameters (derived from ParamsBase) of Owner.
Data to operate on is invalid for a specific purpose. This indicates a corrupted data structure or fu...
Thrown when a requested feature is either under development and thus not implemented yet or when a sp...
DynExp's instrument namespace contains the implementation of DynExp instruments which extend DynExp's...
T TransformPixel(T Pixel, const CameraData::ImageTransformationType &ImageTransformation)
Applies an image transformation to a single pixel.
std::unique_ptr< ParamsBase > ParamsBasePtrType
Alias for a pointer to the parameter system base class ParamsBase.
Accumulates include statements to provide a precompiled header.