Log in or register to post comments

VideoPlayback offset

April 30, 2013 - 2:53am #1

Hello,

I am trying to add an offset to the video frame to be centered in another position instead of the target center.

I have done some changes in the renderFrame in order to add an offset (X and Y axis) to the video frame. In the SampleUtils::translatePoseMatrix i am doing something like this:

renderFrame(..){
    SampleUtils::translatePoseMatrix(targetOffSet.data[0], targetOffSet.data[1], targetPositiveDimensions[currentTarget].data[0],&modelViewMatrixKeyframe.data[0]);
}

The image offset works but the isTapOnScreenInsideTarget method is not working properly, it seems it still keeping the center of target as the center of the video frame, so some areas of the video frame are recognizing the tap. I have already tried to changed the isTapOnScreenInsideTarget

if ( (intersection.data[0] >= -(targetOffSet.data[0])) && (intersection.data[0] <= (targetOffSet.data[0])) &&
         (intersection.data[1] >= -(targetOffSet.data[1])) && (intersection.data[1] <= (targetOffSet.data[1])))

But still doesn't work. 

Thanks

VideoPlayback offset

April 30, 2013 - 6:10am #2

Hi, that's not the correct way of doing the intersection test (i.e. adding the targetOffset);

if you take the code in that function, you will see this line:

 

SampleMath::projectScreenPointToPlane(inverseProjMatrix, modelViewMatrix[target], screenWidth, screenHeight,
                              QCAR::Vec2F(x, y), QCAR::Vec3F(0, 0, 0), QCAR::Vec3F(0, 0, 1), intersection, lineStart, lineEnd);
 
The projectScreenPointToPlane takes the modelViewMatrix[target] as parameter;
so, you need to apply the offset to that matrix (using the SampleUtils::translatePoseMatrix(targetOffSet.data[0], targetOffSet.data[1])
similarly to what you do already for the modelviewMatrixKeyframe matrix.
 
 

 

Log in or register to post comments