Ask Your Question
0

Using a single node to process 2 input image files [closed]

asked 2019-01-28 03:20:37 -0500

chbloca gravatar image

I was reading a tutorial using OpenCV Image Processing (Python) in ROS and I got some doubts.

The exercise consists on:

Creating a new node to determine the angular pose of a pump housing using the OpenCV image processing library. The pump’s orientation is computed using a series of processing steps to extract and compare geometry features:

Resize the image (to speed up processing)

Threshold the image (convert to black & white)

Locate the pump’s outer housing (circle-finding)

Locate the piston sleeve locations (blob detection)

Estimate primary axis using bounding box

Determine orientation using piston sleeve locations

Calculate the axis orientation relative to a reference (horizontal) axis

Firstly, out of a static image file (.jpg) it creates a node just for making an image_publisher so that it's transferred to a topic. I don't get this point since the python scrip could just open it from the input image directory, isn't it?

Secondly, I was wondering if a node can publish two different topics or in affirmative previous case open two inputs.

In third place, if the mentioned case is affirmative (1st Q), is it possible to create just a single node to do all the work? That is, getting the file inputs and output (a file) like a normal python script.

The point of everything is that I want to process two file images saved in a certain directory using a ros node which outputs a processed image file which should be saved in a certain directory.

Thanks for the support :)

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by chbloca
close date 2019-02-26 12:02:16.308936

1 Answer

Sort by » oldest newest most voted
1

answered 2019-01-28 04:14:34 -0500

gvdhoorn gravatar image

updated 2019-01-28 04:17:51 -0500

The point of everything is that I want to process two file images saved in a certain directory using a ros node which outputs a processed image file which should be saved in a certain directory.

Can you explain why you'd want to do that with a ROS node?

If you're going to read files from a directory and write the output to files in (a different) directory, that sounds like something that could be realised without using ROS -- or at least, without using any of the communication infrastructure ROS offers for input/output of the images (you could of course still use ROS for other functionality).

Answers to all of your questions would be: "yes".

The point of the exercise you link to is to show you how to setup a message processing pipeline with different nodes using topics to communicate (intermediate) results and to make you familiar with the OpenCV integration provided by cv_bridge.

If you're not looking for distributing computation or are comfortable with using file I/O for everything, then that would certainly be ok. But it wouldn't be a ROS image processing application.

edit flag offensive delete link more

Comments

I intend to compare two maps (obtained by laser scanners) and output another map (image file .pgm) which would represent the differences between them (subtract in CV). The point of using a ROS node is that I want to integrate this function in the set of packages I am using for my project. Thanks!

chbloca gravatar imagechbloca ( 2019-01-28 04:26:43 -0500 )edit

Question Tools

2 followers

Stats

Asked: 2019-01-28 03:20:37 -0500

Seen: 39 times

Last updated: Jan 28