I’m looking to do something like this, AR Basketball App Mug - YouTube.
I haven’t seen anyone try to use 3d tracking of QR codes for augmented reality, or even simply a phone’s camera yet.
I don’t think that UE4 APIs can even get camera input, you would need to implement that
Qualcomm provides an augmented reality SDK known Vuforia: https://www.vuforia.com/
It seems to only support mobile platforms, but since you specifically mentioned “a phone’s camera” that might be suitable for your purposes. They have support for a concept known as “frame markers”](https://developer.vuforia.com/resources/dev-guide/frame-markers) which are very similar to QR codes.
Definitely possible!
You will have to create something like a Plugin or Module to accomplish this though. A simple way to do this would be to create a custom UObject or even as an Actor you can place in the scene. If you create a UObject, make sure that it implements FTickableGameObject. In your constructor, create an instance of your webcam using something like OpenCV. In your Tick() method, get the current frame from the webcam, and then pass the image data to a library that can detect if a QR Code is present or not. There are restrictions so when you test, make sure the QR Code has somewhat of a white margin surrounding it as the algorithms need some form of whitespace surrounding the QR Code.
If you need a hand implementing FTickableGameObject if you choose to go the route of a custom UObject, you can find some sample code I wrote below for you… Good Luck!
UCLASS(Blueprintable, BlueprintType)
class UQRCodeProcessor: public UObject, public FTickableGameObject
{
GENERATED_UCLASS_BODY()
virtual void Tick(float DeltaTime) OVERRIDE;
virtual bool IsTickable() const OVERRIDE
{
return true;
}
virtual bool IsTickableWhenPaused() const OVERRIDE
{
return true;
}
virtual TStatId GetStatId() const OVERRIDE
{
RETURN_QUICK_DECLARE_CYCLE_STAT(UQRCodeProcessor, STATGROUP_Tickables);
}
};
Hey, did you manage to integrate Vuforia with UE4?
Sorry, but no. I didn’t really try much, so there’s still a chance.