小编Vel*_*lth的帖子

Kinect横向骨架跟踪

目前我使用Microsoft Kinect测量关节之间的角度.大多数测量都正常工作.每当一个人侧身坐在椅子上(在椅子上)时,Kinect就不会准确地跟踪骨架.为了说明我的问题,我添加了3张Kinect深度视图的图片.

使用骨架跟踪进行侧向测量

在没有骨架跟踪的情况下进行侧向测量

使用骨架跟踪进行侧向测量

正如您所看到的,3个测量中有2个"正确"工作.每当我抬起腿时,Kinect都会正确地停止骨骼跟踪.有没有人能解决这个问题,或者这只是Kinect的限制?

谢谢.

更新1:JointTrackingState-Enumeration在屏幕截图2对这些跟踪关节所示被标记为Inferred,然而深度视图正在跟踪我的全身.

更新2: 截图2我试图跟踪我的前腿,突出显示为绿色.我知道另一条腿没有跟踪但是这没关系,我想.

更新3: 以下代码选择骨架:

private Skeleton StickySkeleton(Skeleton[] skeletons)
{
    if (skeletons.Count<Skeleton>(skeleton => skeleton.TrackingId == _trackedSkeletonId) <= 0)
    {
        _trackedSkeletonId = -1;
        _skeleton = null;
    }

    if (_trackedSkeletonId == -1)
    {
        Skeleton foundSkeleton = skeletons.FirstOrDefault<Skeleton>(skeleton => skeleton.TrackingState == SkeletonTrackingState.Tracked);

        if (foundSkeleton != null)
        {
            _trackedSkeletonId = foundSkeleton.TrackingId;
            return foundSkeleton;
        }
    }

    return _skeleton;
}
Run Code Online (Sandbox Code Playgroud)

每当跟踪骨架时,数据将用于绘制关节点并计算关节之间的角度.

更新4: 我测试坐在一个"块",比椅子简化得多.不幸的是,Kinect的行为仍然相同.

以下2个截图:

坐在街区1

坐在一个街区2

c# kinect

42
推荐指数
1
解决办法
1万
查看次数

JScrollPane中JPanel上的JTextArea没有正确调整大小

我想实现以下目标:

+------------------Other container(s)-----------------+
|        +------JScrollPane (vertical)-------+        |
|        | JTextField                        |        |
|        | Box.createRigidArea (vertical)    |        | 
|        | JTextArea                         |        |
|        | { etc.. any other J-component }   |        |
|        |                                   |        |
|        |                                   |        |
|        |                                   |        |
|        |                                   |        |
|        +-----------------------------------+        |
+-----------------------------------------------------+
Run Code Online (Sandbox Code Playgroud)

我能得到的最接近的是以下(伪)代码:

JPanel container = new JPanel(new BorderLayout());
JPanel innerContainer = new JPanel();
innerContainer.setLayout(new BoxLayout(_innerContainer, BoxLayout.Y_AXIS));
JScrollPane scrollPane = new JScrollPane(innerContainer);
container.add(scrollPane, BorderLayout.NORTH);
Run Code Online (Sandbox Code Playgroud)

每当我想添加组件时,它们都会添加到内部容器中:

innerContainer.add(new JTextField());
innerContainer.add(Box.createRigidArea(new Dimension(0, …
Run Code Online (Sandbox Code Playgroud)

java swing awt jscrollpane jtextarea

8
推荐指数
1
解决办法
6841
查看次数

无法在以感叹号结尾的目录中打开资源(!)

每当在以感叹号结尾的目录中运行可执行jar时,getResourceAsStream -method都返回null.

对于以下示例,我有一个Eclipse项目具有以下目录结构:

src\ (Source Folder)
    main\ (Package)
        Main.java
    res\ (Source Folder)
        images\
            Logo.png
Run Code Online (Sandbox Code Playgroud)

我正在阅读Logo.png如下:

public static void main(String[] args) throws IOException {
    try (InputStream is = Main.class.getClassLoader().getResourceAsStream("images/Logo.png")) {
        Image image = ImageIO.read(is);
        System.out.println(image);
    }   
}
Run Code Online (Sandbox Code Playgroud)

请参阅2个测试用例的附件.首先,可执行jar从目录"D:\ test123!@#"启动而没有任何问题.其次,可执行jar从目录"D:\ test123!@#!!!"启动,有问题.

是否不支持以感叹号结尾的目录?代码错了吗?

提前致谢.

在以!结尾的目录中运行可执行jar时出错!

java resources classpath classloader javax.imageio

6
推荐指数
1
解决办法
4887
查看次数

詹金斯注入环境变量

在Jenkins的工作中,我正在执行一些驻留在前置步骤构建中的操作,例如执行shell脚本.使用Jenkins插件"EnvInject"我想将环境变量注入我的maven构建(单元测试),以便可以在我的Java单元测试中使用它们.在shell脚本里面我做了类似的事情:

echo "ip=$IP" >> unit-test.properties
Run Code Online (Sandbox Code Playgroud)

构建Jenkins时输出以下内容:

[EnvInject] - Injecting environment variables from a build step.
[EnvInject] - Injecting as environment variables the properties file path 'unit-test.properties'
[EnvInject] - Variables injected successfully.
Run Code Online (Sandbox Code Playgroud)

但是我的Java代码(单元测试)中没有"ip"变量.当我对两者进行完整打印时,System.getProperties() and System.getenv()我没有看到"ip"入伍.

我是否需要对maven执行任何特殊操作才能将变量传递给我的Java代码?还有别的错吗?

从这一点开始,我几乎陷入困境,我确实希望key=value从我的Java代码中预先注入一个步骤.

java maven jenkins jenkins-plugins

6
推荐指数
1
解决办法
2万
查看次数

Regular expression to extract SQL query

Is there a regex which extracts SQL queries from a string? I'm NOT interested to validate any SQL syntax, rather and only extracting a selection of SQL commands. This to parse a given SQL file/string in a flexible manner.

Given is the following SQL file/string example:

SELECT
    *
FROM
    test_table
WHERE
    test_row = 'Testing ; semicolon';

SELECT * FROM another_test_table;

INSERT INTO 
    table_name 
VALUES 
    (value1,'value which contains semicolon ;;;;',value3,...);
Run Code Online (Sandbox Code Playgroud)

Some pseudocode example would be: ^(UPDATE|SELECT|INSERT INTO)(.*)(;)$. In the future …

java regex matcher

5
推荐指数
1
解决办法
2万
查看次数

使用JAXB根据属性创建引用对象

考虑以下xml:

<Config>
    <Paths>
        <Path reference="WS_License"/>
    </Paths>

    <Steps>
        <Step id="WS_License" title="License Agreement" />
    </Steps>
</Config>
Run Code Online (Sandbox Code Playgroud)

以下JAXB类:

public class Path {

    private String _reference;

    public String getReference() {
        return _reference;
    }

    @XmlAttribute
    public void setReference( String reference ) {
        _reference = reference;
    }

}
Run Code Online (Sandbox Code Playgroud)

public class Step {

    private String _id;
    private String _title;

    public String getId() {
        return _id;
    }

    @XmlAttribute
    public void setId( String id ) {
        _id = id;
    }

    public String getTitle() {
        return _title;
    }

    @XmlAttribute …
Run Code Online (Sandbox Code Playgroud)

java xml jaxb

3
推荐指数
1
解决办法
4569
查看次数