コード例 #1
0
        public SegementationFilter(ResourceSet resource, int w = 1920, int h = 1080)
        {
            this.resource = resource;

            config             = new Config(resource, w, h);
            worker             = ModelLoader.Load(resource.model).CreateWorker();
            buffers.preprocess = new ComputeBuffer(config.InputFootPrint, sizeof(float));
            buffers.segment    = RTUtil.NewFloat(config.OutputWidth, config.OutputHeight);
            buffers.parts      = RTUtil.NewFloat(config.OutputWidth * 24, config.OutputHeight);
            buffers.heatmaps   = RTUtil.NewFloat(config.OutputWidth * KeyPointCount, config.OutputHeight);
            buffers.offsets    = RTUtil.NewFloat(config.OutputWidth * KeyPointCount * 2, config.OutputHeight);
            buffers.mask       = RTUtil.NewUAV(config.OutputWidth, config.OutputHeight);
            buffers.keypoints  = new GraphicsBuffer(GraphicsBuffer.Target.Structured, KeyPointCount, sizeof(float) * 4);
        }
コード例 #2
0
        protected override void Start()
        {
            base.Start();
            positionMap = RTUtil.NewUAV(detector.KeypointCount, 1, 0, RenderTextureFormat.ARGBFloat);

            linePairMap = RTUtil.NewUAV(BlazePoseDefinition.BODY_LINE_NUM, 1, 0, RenderTextureFormat.ARGBFloat, GraphicsFormat.R32G32_SFloat);

            cs.SetInt("_LinePairCount", BlazePoseDefinition.BODY_LINE_NUM);
            cs.SetTexture(0, "_LinePairMap", linePairMap);
            cs.SetBuffer(0, "_WorldKeyPoints", detector.outputWorldBuffer);
            cs.SetVectorArray(Shader.PropertyToID("_LinePair"), BlazePoseDefinition.LinePairs.ToArray());
            cs.DispatchThreads(0, 1, 1, 1);

            mirror = new RenderTexture(source.Texture.width, source.Texture.height, 0, source.Texture.graphicsFormat);
            mirror.enableRandomWrite = true;
        }
コード例 #3
0
        public BlazePoseDetector(BlazePoseResource resource, LandmarkModelType modelType)
        {
            this.resource = resource;

            detector   = new PoseDetector(resource.detectionResource);
            landmarker = new PoseLandMarker(resource.landmarkResource, modelType);

            letterboxTexture = RTUtil.NewUAV(DETECTION_INPUT_IMAGE_SIZE, DETECTION_INPUT_IMAGE_SIZE, 0, RenderTextureFormat.ARGB32, GraphicsFormat.R8G8B8A8_UNorm);
            croppedTexture   = RTUtil.NewUAV(LANDMARK_INPUT_IMAGE_SIZE, LANDMARK_INPUT_IMAGE_SIZE, 0, RenderTextureFormat.ARGB32, GraphicsFormat.R8G8B8A8_UNorm);

            poseRegionBuffer       = new ComputeBuffer(1, sizeof(float) * 24);
            deltaOutputBuffer      = new ComputeBuffer(landmarker.KeypointCount, sizeof(float) * 4);
            deltaOutputWorldBuffer = new ComputeBuffer(landmarker.KeypointCount, sizeof(float) * 4);

            // feature 33 + human exist flag 1
            outputBuffer      = new ComputeBuffer(landmarker.KeypointCount + 1, sizeof(float) * 4);
            outputWorldBuffer = new ComputeBuffer(landmarker.KeypointCount + 1, sizeof(float) * 4);
        }
コード例 #4
0
 void Start()
 {
     outputTex = RTUtil.NewUAV(w, h, 0);
 }