To integrate opencv into 4.27
- Import lib and dll in build.cs.
- I made a WebcamReader according to the tutorial.
https://unreal.gg-labs.com/wiki-archives/ar-vr/integrating-opencv-into-unreal-engine-4
Here is a link to the tutorial you referenced.
But I think the tutorial is an older version of Unreal.
I’m using 4.27, and I somehow solved it in build.cs, but I don’t know what to do with ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER.
When I searched, the latest version changed to ENQUEUE_RENDER_COMMAND and told me to do it instead, but how should I use it?
Below is the part from the tutorial.
ENQUEUE_UNIQUE_RENDER_COMMAND_TWOPARAMETER(
UpdateTextureRegionsData,
FUpdateTextureRegionsData*, RegionData, RegionData,
bool, bFreeData, bFreeData,
{
for (uint32 RegionIndex = 0; RegionIndex < RegionData->NumRegions; ++RegionIndex)
{
int32 CurrentFirstMip = RegionData->Texture2DResource->GetCurrentFirstMip();
if (RegionData->MipIndex >= CurrentFirstMip)
{
RHIUpdateTexture2D(
RegionData->Texture2DResource->GetTexture2DRHI(),
RegionData->MipIndex - CurrentFirstMip,
RegionData->Regions[RegionIndex],
RegionData->SrcPitch,
RegionData->SrcData
+ RegionData->Regions[RegionIndex].SrcY * RegionData->SrcPitch
+ RegionData->Regions[RegionIndex].SrcX * RegionData->SrcBpp
);
}
}
if (bFreeData)
{
FMemory::Free(RegionData->Regions);
FMemory::Free(RegionData->SrcData);
}
delete RegionData;
});