Good morning,
while I can't say for sure why the cropping is not working, your explanation sounds reasonable to me. Especially so since the ImageReader we are using asks for the full resolution of the frame.
ImageReader.newInstance(frameWidth, frameHeight, ImageFormat.YUV_420_888, 2);
Have you tried adjusting these values as well?
If getting a cropped frame from the Camera directly is not working out, you will have to do the cropping yourself. You could either do this on the CPU by working with the character data in the C++ part of the plugin, or on the GPU by rendering the camera frame yourself in the plugin and simply altering the texture coordinates or vertex positions of your full screen quadrilateral.
I suspect the former will be easier to implement. The plugin already has a function that operates on the frame data in order to remove any strides that might be in the frame. You would need to "just" alter the addresses this function copies from.
- Daniel
Thanks Daniel,
the cause of the problem turned out to be trivial - the cropping is not happening on emulator for some reason but works on the device.
I am marking this as solved but I have run into another issue here: https://support.wikitude.com/support/discussions/topics/5000090364.
- Tomas
Tomas Kohout
Hello,
I am trying to get the pinch to zoom functionality working on Android (Android Javascript API). I am working with the Camera v2. I have pulled some examples online but can't get it to work together with Wikitude. I am using example WikitudeCamera2 from the SimpleInputPlugin. This is where the most of the zooming logic is happening.
The zoom rect is calculated correctly but somehow the
builder.set(CaptureRequest.SCALER_CROP_REGION, zoom);
is not making any effect. I suspect it is because you are using ImageReader to pipe the data to the wikitude input plugin, but all the camera zooming examples are using their own SurfaceViews.
Could you advise on how would you go implementing this feature?
Thank you