You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 5, 2023. It is now read-only.
HI! I'm just begin to run the sample android_tutorial_cv_bridge_image and I got some problems.
I have already followed the tutorials to build the environment for rosjava.
Here I want to play a ROS bag file with topic /image_raw and run the app cv bridge image on my phone (Samsung Galaxy J7 Pro) to show the converted video stream.
All I have changed in the MainActivity.java is the topic name which is /camera/image/raw originally. Just like below:
@Override
public void onStart(ConnectedNode connectedNode) {
this.node = connectedNode;
final org.apache.commons.logging.Log log = node.getLog();
imagePublisher = node.newPublisher("/image_converter/output_video/raw", Image._TYPE);
imageSubscriber = node.newSubscriber("/image_raw", Image._TYPE);
imageSubscriber.addMessageListener(new MessageListener<Image>() {
@Override
public void onNewMessage(Image message) {
CvImage cvImage;
try {
cvImage = CvImage.toCvCopy(message, ImageEncodings.RGB8);
} catch (Exception e) {
log.error("cv_bridge exception: " + e.getMessage());
return;
}
Log.i(TAG, Integer.toString(cvImage.image.cols()));
Log.i(TAG, Integer.toString(cvImage.image.rows()));
//make sure the picture is big enough for my circle.
if (cvImage.image.rows() > 110 && cvImage.image.cols() > 110) {
//place the circle in the middle of the picture with radius 100 and color red.
Imgproc.circle(cvImage.image, new Point(cvImage.image.cols() / 2, cvImage.image.rows() / 2), 100, new Scalar(255, 0, 0));
}
cvImage.image = cvImage.image.t();
Core.flip(cvImage.image, cvImage.image, 1);
bmp = Bitmap.createBitmap(cvImage.image.cols(), cvImage.image.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(cvImage.image, bmp);
runOnUiThread(displayImage);
Core.flip(cvImage.image, cvImage.image, 1);
cvImage.image = cvImage.image.t();
try {
imagePublisher.publish(cvImage.toImageMsg(imagePublisher.newMessage()));
} catch (IOException e) {
log.error("cv_bridge exception: " + e.getMessage());
}
}
});
Log.i(TAG, "called onStart");
}
I played the bag file in my host computer with ROS_IP setting to 192.168.x.x and my app can successfully connect to the address.
However the imageView still shows nothing and Log.i(TAG, Integer.toString(cvImage.image.cols()));, Log.i(TAG, Integer.toString(cvImage.image.rows()));
has no info output.
It seems that the MessageListener didn't work and no message is received.
Did I miss something? Hope there's someone can help me! Thanks!
HI! I'm just begin to run the sample
android_tutorial_cv_bridge_image
and I got some problems.I have already followed the tutorials to build the environment for rosjava.
Here I want to play a ROS bag file with topic
/image_raw
and run the app cv bridge image on my phone (Samsung Galaxy J7 Pro) to show the converted video stream.All I have changed in the
MainActivity.java
is the topic name which is/camera/image/raw
originally. Just like below:I played the bag file in my host computer with
ROS_IP
setting to192.168.x.x
and my app can successfully connect to the address.However the imageView still shows nothing and
Log.i(TAG, Integer.toString(cvImage.image.cols()));
,Log.i(TAG, Integer.toString(cvImage.image.rows()));
has no info output.
It seems that the MessageListener didn't work and no message is received.
Did I miss something? Hope there's someone can help me! Thanks!
Below is my gradle file:
And the RQT graph:
when I run
rostopic echo /image_converter/output_video/raw
:The text was updated successfully, but these errors were encountered: