What is the type of the data in your cvMat? I assume it's either float or double?<br><br>Are the publisher and subscriber on the same machine?<br><br>I suspect you meant h_m.mat[j*3+k], but that doesn't explain the totally wrong numbers.<br>
<br>Right before your publish() call, can you print out the contents of h_m.mat and check that they're correct.<br><br>As an aside, the new <a href="http://opencv.willowgarage.com/documentation/cpp/introduction.html">C++ interface</a> to OpenCV is a big improvement over cvMat/IplImage if you like niceties like type safety, automatic freeing of memory and more succinct code.<br>
<br>-Patrick<br><br><div class="gmail_quote">On Thu, Apr 22, 2010 at 5:52 PM, Dan Lazewatsky <span dir="ltr"><<a href="mailto:lazewatskyd@cse.wustl.edu">lazewatskyd@cse.wustl.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi all -<br>
I have a cvMat that I'm trying to send out in a ROS message, but I'm<br>
having some issues getting it to work right.<br>
<br>
My message definition is: float64[9] mat<br>
I'm loading data into the message as follows:<br>
myMessage h_m;<br>
for(int j=0; j<3;++j){<br>
     for(int k=0; k<3; ++k){<br>
         h_m.mat[j+k*3] = cvmGet(&_h, j, k);<br>
     }<br>
}<br>
<br>
No errors here, but when I look at the data from a subscriber (or using<br>
rostopic echo), but numbers are wrong. Numbers that should be in the<br>
range of 0-10 end up in 10^6-10^-5. I've tried creating a<br>
std_msgs::Float64 and casting to a Float64 first, neither of which<br>
worked. I'm at a bit of a loss as to what's going on. Any help would be<br>
appreciated.<br>
<br>
Thanks,<br>
-Dan<br>
_______________________________________________<br>
ros-users mailing list<br>
<a href="mailto:ros-users@code.ros.org">ros-users@code.ros.org</a><br>
<a href="https://code.ros.org/mailman/listinfo/ros-users" target="_blank">https://code.ros.org/mailman/listinfo/ros-users</a><br>
</blockquote></div><br>