ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

How to read two in row image frames from kinect v2

asked 2016-10-07 17:16:41 -0500

patrchri gravatar image

updated 2016-10-08 07:54:54 -0500

EDITED:

Hello,

I am new to image processing in ROS, but I have some experience with opencv and what I want to do is to read two frames in row from kinect, take their absolute difference and detect a moving object in real time.

To be more specific, I want to implement the logic of :

videoCapture::read(cv::Mat frame1);
videoCapture::read(cv::Mat frame2);

in the logic of ROS (the logic of messages).

How can I achieve that?

I have previously worked with the kinect v2 and managed to detect an object with its color, so I think I know most of the basics about image transportation, but I am a bit confused on how could I implement the logic of the following frames above in ROS.

Thanks for answering and for your time in advance, Chris

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2016-10-07 21:21:48 -0500

JoshMarino gravatar image

updated 2016-10-09 20:33:27 -0500

Do you already have access to the Kinect data? If not, I would check out these tutorials here.

Edit: Alright, I understand your issue now. What you are describing with image processing does not really depend on ROS, I imagine you would be using OpenCV like you mentioned in original post.

Not sure how you are getting your frame data from Kinect, but just store it in a buffer array (allocate memory) and wait for the next frame and do the same (allocate memory). Then compute your image processing functions. Overwrite the old frame with the new frame, and obtain the next frame and store it in the new frame. Repeat. If you need more assistance with image processing, try a basic search online, there are many tutorials out there for it.

edit flag offensive delete link more

Comments

I have access, because I have implemented object detection with the object's color. I am also using Kinect v2.

patrchri gravatar image patrchri  ( 2016-10-08 07:55:25 -0500 )edit

Sorry, what I meant to ask is can you get the Kinect data through using ROS with something like openni_launch package? If so, it is a matter of subscribing to the topic (image data) and then using whatever algorithms you want to.

JoshMarino gravatar image JoshMarino  ( 2016-10-08 14:58:54 -0500 )edit

I can get data from another node....My issue is not the data...

patrchri gravatar image patrchri  ( 2016-10-09 07:40:02 -0500 )edit

I do not understand your problem then. You asked how read two frames from the Kinect, but you are saying you can already do that?

JoshMarino gravatar image JoshMarino  ( 2016-10-09 10:58:14 -0500 )edit

I am asking how to read two in a row frames and do something with their difference. This means that I have to keep one frame/message temporarily, get its following one, do something with these 2 frames/messages, discard the temporary message and do this process again...

patrchri gravatar image patrchri  ( 2016-10-09 15:39:15 -0500 )edit
0

answered 2016-10-10 13:37:51 -0500

patrchri gravatar image

updated 2016-10-10 13:38:19 -0500

After JohnMarino's initial idea I implemented the capturing of 2 following frames with a vector <mat> and did some basic processing with it. If I find an issue with something with it, I will come back.

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2016-10-07 17:16:41 -0500

Seen: 391 times

Last updated: Oct 10 '16