【问题标题】:Face Detection model bounding box人脸检测模型边界框
【发布时间】:2020-08-22 01:03:42
【问题描述】:

我正在使用 claraifai API 检索面部区域以形成边界框,但实际上绘制该框会严重偏离图像中的值。

代码:

 return {
      topRow: face.top_row * height,
      leftCol: face.left_col * width,
      bottomRow: (face.bottom_row * height) - (face.top_row * height),
      rightCol: (face.right_col * width) - (face.left_col * width)
    }

【问题讨论】:

    标签: reactjs clarifai


    【解决方案1】:

    尝试添加一个相对定位在父div内部的div。

    之前:

    const FaceImage = ({image, boxs}) => {
        return (
            <div className="faceimage">
                <img id="imgA" alt='' src={image}/>
                <div className="bounding-box" style={{
                    top: boxs.top_row, 
                    left: boxs.left_col,
                    bottom: boxs.bottom_row,
                    right: boxs.right_col 
                }}></div>
            </div>
        );
    }
    

    之后:

    const FaceImage = ({image, boxs}) => {
        return (
            <div className="faceimage">
                <div className="relative">
                    <img id="imgA" alt='' src={image}/>
                    <div className="bounding-box" style={{
                        top: boxs.top_row, 
                        left: boxs.left_col,
                        bottom: boxs.bottom_row,
                        right: boxs.right_col 
                    }}></div>
                </div>
            </div>
        );
    }
    

    CSS:

    .relative {
        position: relative;
    }
    

    【讨论】:

      猜你喜欢
      • 2011-06-25
      • 2012-04-17
      • 2016-02-25
      • 2019-06-18
      • 1970-01-01
      • 1970-01-01
      • 2020-09-20
      • 2020-11-01
      • 2016-09-14
      相关资源
      最近更新 更多