Kinect 裁剪图像
我正在尝试裁剪视频 RGB 的矩形区域。首先,我找到了头部关节的坐标,并用这个坐标在 RGB 视频上画了一个矩形。现在我想在另一个视频中仅显示第一个图像中的rentangle 内部的图像。任何帮助都会很棒。
视频 RGB 显示在“RGBvideo”图像控件中。 我想在“faceImage”图像控件中显示裁剪后的图像
我在网上搜索但找不到解决方案。我很困惑。
太感谢了
I'm trying to crop a rectangular region of a video RGB. First i found the coordinates of head joint and with this coordinates i drew a rectangle over the RGB video. Now i want to show in another video just the image that is inside of the rentangle in the first image. Any help would be great.
video RGB is displayed in a "RGBvideo" Image Control.
cropped image i want to display in a "faceImage" Image Control
I've search online but couldn't find a solution to it. I am confuse.
thank you so much
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
欢迎来到 Stack Overflow,请不要多次询问同一问题。对于像 Kinect 这样不太受欢迎的标签,人们可能需要一些时间才能回答(该标签只有 79 个关注者)。
为简单起见,我假设您想要裁剪出设定大小的图像(例如,从原始 800x600 中裁剪出 60x60 像素)。在 VideoFrameReady 方法中,您从事件参数获取 PlanarImage。此 PlanarImage 具有位字段,其中包含图像的所有 RGB 数据。通过一些数学运算,您可以剪切一小部分数据并将其用作较小的图像。
请确保您理解代码,而不是仅仅复制/粘贴它。两个 for 循环用于基本数组复制,并考虑每个像素的字节数(BGR32 为 4)。然后,您使用原始数据的一小部分来创建新的 BitmapSource。您需要根据需要更改宽度/高度,并根据头部跟踪确定 X 和 Y 坐标。
Welcome to Stack Overflow, please don't ask the same question multiple times. With less popular tags like Kinect, it can take some time for people to answer (the tag only has 79 followers).
For simplicity, I'm going to assume you want to crop out a set size image (for example, 60x60 pixels out of the original 800x600). In your VideoFrameReady method, you get the PlanarImage from the event args. This PlanarImage has the bits field, which contains all of the RGB data for the image. With a little math, you can cut out a small chunk of that data and use it as a smaller image.
Please make sure you understand the code, instead of just copy/pasting it. The two for loops are for basic array copying, with the number of bytes per pixel taken into account (4 for BGR32). Then you use that small subset of the original data to create a new BitmapSource. You'll need to you can change the width/height as you see fit, and determine the X and Y coordinates from the head tracking.