Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

perspective (processTransform3d) not work #2678

Open
i7soft opened this issue Oct 6, 2024 · 0 comments
Open

perspective (processTransform3d) not work #2678

i7soft opened this issue Oct 6, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@i7soft
Copy link

i7soft commented Oct 6, 2024

Description

I use skia with react-native-vision-camera, and want to Transform the video frame, rotateY is work, but perspective not work

Version

1.4.2

Steps to reproduce

1.use with react-native-vision-camera

2.on the camera frameProcessor event, try to Transform the video frame

Snack, code example, screenshot, or link to a repository

`
import { Matrix4, PaintStyle, perspective, processTransform3d, processTransformProps, rotateX, scale, Skia,SkImage, TileMode } from '@shopify/react-native-skia';
import { useEffect } from 'react';
import { StyleSheet, Text } from 'react-native';

import {
    Camera,
    useCameraDevice,
    useCameraPermission,
    useSkiaFrameProcessor,
    useFrameProcessor
} from 'react-native-vision-camera';




export function CameraRealtimeDetection() {
    const device = useCameraDevice('back');
    const { hasPermission, requestPermission } = useCameraPermission();



    useEffect(() => {
        requestPermission();
    }, [requestPermission]);



    const frameProcessor2 = useSkiaFrameProcessor((frame) => {
        'worklet';

        var matrix = processTransform3d([
            { rotateY: 45 },       // work √
            { perspective: 100 },   // no work ×
        ])

    
        frame.concat(matrix)

        frame.render()
        
        
    }, []);

    if (!hasPermission) {
        return <Text>No permission</Text>;
    }

    if (device == null) {
        return <Text>No device</Text>;
    }

    return (
        <Camera
            style={[{height:300,width:200}]}
            device={device}
            isActive={true}
            frameProcessor={frameProcessor2}
        />
    );
}

`

@i7soft i7soft added the bug Something isn't working label Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant