Tool/software: Linux
Hi
I am trying to understand the dynamic casting of raw data frame to be used as ToFRawFrame frame or DepthFrame frame.
In the implementation of the Bilateral filter function I see that variables of both ToF are declared -
bool BilateralFilter::_filter(const FramePtr &in, FramePtr &out)
{
ToFRawFrame *tofFrame = dynamic_cast<ToFRawFrame *>(in.get());
DepthFrame *depthFrame = dynamic_cast<DepthFrame *>(in.get());
Then there are checks to see the incoming frame is of which type (whether ToFRawFrame object or DepthFrame object )
if(tofFrame)
{
some code
}
OR
else if(depthFrame)
{
some code
}
How does the casting work here ? Is the incoming frame (FramePtr &in) containing both the raw phases data and also the depth phase data ?
Or does the incoming frame just contain the bytes as seen in the output data frame format of the document on OPT9221 (page 22)
7.3.4.1 Output Data Format
The depth information can be obtained with varying degrees of detail as per the host application’s requirements
using register control. The two options available are listed below:
7.3.4.1.1 4-Byte Mode (default)
• 12 bits amplitude (C)
• 4 bits ambient (A)
• 12 bits phase (P)
• 4 bits flags (F)
A second question is on phase word width ? From the section of Output Data Format on OPT9221 document,
I see that phase is 12 bits wide. Why then the check to see if phaseword width is 1 or 2 or 4 (bytes ?