talregev / android_cv_bridge

rosjava android cv_bridge
13 stars 8 forks source link

android_cv_bridge_tutorial not running #1

Closed kejriwalnishant1990 closed 9 years ago

kejriwalnishant1990 commented 9 years ago

I am trying to run your tutorial on android_cv_bridge but it is throwing following error. I am subscribing the image topic(/camera/rgb/image_color) from kinect in android phone. I ahve made my laptop as master and android phone as client.

org.ros.android.android_tutorial_cv_bridge E/roid_tutorial_cv_bridge﹕ cv_bridge exception: Unrecognized image encoding [bgr8] org.ros.android.android_tutorial_cv_bridge E/art﹕ No implementation found for void org.opencv.core.Mat.n_delete(long) (tried Java_org_opencv_core_Mat_n_1delete and Java_org_opencv_core_Mat_n_1delete__J) org.ros.android.android_tutorial_cv_bridge E/System﹕ Uncaught exception thrown by finalizer org.ros.android.android_tutorial_cv_bridge E/System﹕ java.lang.UnsatisfiedLinkError: No implementation found for void org.opencv.core.Mat.n_delete(long) (tried Java_org_opencv_core_Mat_n_1delete and Java_org_opencv_core_Mat_n_1delete__J) at org.opencv.core.Mat.n_delete(Native Method) at org.opencv.core.Mat.finalize(Mat.java:2475) at java.lang.Daemons$FinalizerDaemon.doFinalize(Daemons.java:191) at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:174) at java.lang.Thread.run(Thread.java:818)

talregev commented 9 years ago

Thanks for checking. Yes, but compress image not finish. If you can, and it help me a lot, To update the Wiki, and Here ReadMe file.

Need still to investigate why the step is not calculate correctly on msgs. you can look on it if you like and sumbit a patch.

kejriwalnishant1990 commented 9 years ago

I will definitley update wiki page and ReadMe file.

talregev commented 9 years ago

Thanks :) :+1:

kejriwalnishant1990 commented 9 years ago

I want to change graphical interface in android_10 library. is it possbile to do in your code?

talregev commented 9 years ago

It not my code. It android core code. you will need to re-compile it.

kejriwalnishant1990 commented 9 years ago

Why u have used JavaCameraView in main.xml?

talregev commented 9 years ago

You can delete this. It from old code. If it ok, i will remove it myself.

kejriwalnishant1990 commented 9 years ago

I want to display subscribed image in my phone. Is it possible? I tried using ImageView but it is throwing error OpenCV_for_Tegra﹕ Cannot create OpenGL context

kejriwalnishant1990 commented 9 years ago

I am using this code:

Bitmap bmp = null;
bmp = Bitmap.createBitmap(cvImage.image.cols(), cvImage.image.rows(), Bitmap.Config.ARGB_8888);
Utils.matToBitmap(cvImage.image, bmp);
Im.setImageBitmap(bmp);
talregev commented 9 years ago

It possible, but It difficult. I read some code example on stack over flaw. But I fell to do it. If you succeeded, just pull request your code to here.

kejriwalnishant1990 commented 9 years ago

have you seen camera_image_tutorial in android core? In that code, they are displaying the image also.

talregev commented 9 years ago

To display image from camera is easy. but to display your own image (from topic) it more challenge.

talregev commented 9 years ago

What is Im in: Im.setImageBitmap(bmp);?

kejriwalnishant1990 commented 9 years ago
public ImageView Im;        
Im = (ImageView) findViewById(R.id.imageView1);
talregev commented 9 years ago

Which type should be imageView1?

kejriwalnishant1990 commented 9 years ago

In main.xml

 <ImageView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:id="@+id/imageView1"
        android:layout_gravity="center_horizontal" />
talregev commented 9 years ago

I already check the example, from here Maybe i can do it.

kejriwalnishant1990 commented 9 years ago

Are you trying to display image? If you are sucessfull, let me know. I am getting OpenGL error.

talregev commented 9 years ago

Just to show the user the image alter using the opencv. I will update the cv_bridge library code.

kejriwalnishant1990 commented 9 years ago

I didnt get you. Are you adding a patch for displaying image in android?

talregev commented 9 years ago

It will be difficult: Only the original thread that created a view hierarchy can touch its views

kejriwalnishant1990 commented 9 years ago

You have to run this thread in parallel.

talregev commented 9 years ago

i do this code:

runOnUiThread(new Runnable() {
    @Override
    public void run() {
          // This code will always run on the UI thread, therefore is safe to modify UI elements.
          imageView.setImageBitmap(bmp);
    }
});

but it dose show the image, and good thing it not crash.

talregev commented 9 years ago

I succeeded to show the subscribed images on the phone with the circle (that one that will send).

kejriwalnishant1990 commented 9 years ago

I am also able to subscribe the images in cv_bridge tutorial. But in compress image tutorial, images in phone are not displayed properly. Is it working fine with you?

talregev commented 9 years ago

Now I fix the CvCompressedImages :) The basic functionality is working well!! :)

talregev commented 9 years ago

If It works for you, I will close this issue.

kejriwalnishant1990 commented 9 years ago

Yes. it is working fine for me. Thanks

On Sat, Aug 22, 2015 at 5:24 PM, talregev notifications@github.com wrote:

If It works for you, I will close this issue.

— Reply to this email directly or view it on GitHub https://github.com/talregev/android_cv_bridge/issues/1#issuecomment-133681770 .

talregev commented 9 years ago

@kejriwalnishant1990 I write a new library, and a new apss, that don't use opencv manager.