Start a new topic
Solved

Input API

Hi,


we are trying to let the SDK process our own data, however, all our test were unsuccessful. We were not able to get any results. during the first test we want to provide a bmp file as an input. Could you provide us a sample code, how to correctly process a bmp file? 


Hi Cvar,


Where exactly are you trying to input the file, as an augmented image? 


If yes then please note that we have switched to a more flexible and robust resource caching and image loading. With this transition we also dropped support for BMP as the preferred image formats are PNG and JPEG. I suggest to convert them to PNG.


Thanks

Eva

Hi Eva,


Unfortunately, the augmented image is probably not the issue. 


We are facing the issue somewhere else. See attached picture with very rough description of our process.The red are shows where the problem is. 


We are trying to load external data from image/video stream to the Wikitude and process it via InputAPI. The problem is currently in InputAPI, we are trying to load raw pixels data as it is in your examples. The InputAPI should recognise targets in loaded data based on wtc target file, but it does not. In fact we have no even idea if the data we are putting into InputAPI are correct or not. Is there any flag or anything else to inform us that data are in correct format?


We would really appreciate, if you or anybody else, could provide us how the target in external image, stored in external storage, could be processed via InputAPI, not just via build-in device camera.


Thanks.

process.png
(95.5 KB)

Good morning,



as an input plugin simply requires a pointer to image data as its input, the source this image data is derived from is irrelevant. 


There are, however, additional parameters to be supplied. Given that you are providing image data from a bitmap file, I am assuming the resulting image data is in RGB format (R8G8B8 that is). You therefore need to return the wikitude::sdk::FrameColorSpace::RGB constant in the input plugins getInputFrameColorSpace() function. 



wikitude::sdk::FrameColorSpace YourInputPluginClass::getInputFrameColorSpace() {

    return wikitude::sdk::FrameColorSpace::RGB;

}



You accordingly need to return the horizontal field of view as well the input frame size in the getHorizontalAngle() function and in the getInputFrameSize() function respectively.



float YourInputPluginClass::getHorizontalAngle() {

    return 60.0f;

}


wikitude::sdk::Size<int> YourInputPluginClass::getInputFrameSize() {

    return {640, 480};

}



To verify the setup, I recommend overriding the requestsInputFrameRendering() function and returning true to have the input frame rendered by the Wikitude SDK. Should the rendering be correct, you can safely assume that the input data is correctly submitted for processing as well.



bool YourInputPluginClass::requestsInputFrameRendering() {

    return true;

}



Allow me to direct you to the input plugin documentation pages which are quite explicit regarding this parameterisation.



Kind regards

Daniel


Login or Signup to post a comment