talregev / android_cv_bridge Goto Github PK
View Code? Open in Web Editor NEWrosjava android cv_bridge
rosjava android cv_bridge
First I want to apologise if this not the right place to raise this query.
I am developing an android app. to show a video stream from a camera on a robot. I have done this successfully using ROSImageView linked to a ROS compressedImage topic using ROSJava.
Now I want to try the same approach used by the cv_bridgeCompressedImage app. adapting the code for my Android app. I still don't understand github nor how to get from this code to a dependency in my build.gradle in my app. Is there a step-by-step set of instructions for beginners that you can refer me to?
I open a project in Android Studio but I am unsure what to do next. I run 'Make Project' and get this error: 'SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable.'
Again, I am sorry if this is not an 'issue', I cam trying to get somewhere but I'm frustrated by coming up to 'brick walls'.
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)
Hi, @talregev ! I'm new to ros and, recently I need transport a local image(from SD card) to ROS in android. I know I should transport it by the cv_bridge, and I had import the OpenCV-for-Android package in my Android Studio. However, I don't know how to make a local image transformed into CvImage by OpenCV, and finally make it to sensor_msgs.Image/CompressedImage messages. Do you have a good suggestion to make this possible?
My idea is something like this:
filePath = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES).toString() + "xxx.jpg";
try {
fileInputStream = new FileInputStream(filePath);
}
catch (IOException e) {
e.printStackTrace();
}
bmp = BitmapFactory.decodeStream(fileInputStream);
// compress
byteArrayOutputStream = new ByteArrayOutputStream();
bmp.compress(Bitmap.CompressFormat.JPEG, 200, byteArrayOutputStream);
int quality = 200;
while (byteArrayOutputStream.toByteArray().length / 1024 > 200) {
byteArrayOutputStream.reset();
bmp.compress(Bitmap.CompressFormat.JPEG, quality, byteArrayOutputStream);
quality -= 10;
}
byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
bmp = BitmapFactory.decodeStream(byteArrayInputStream, null, null);
channelBufferOutputStream.buffer().writeBytes(byteArrayOutputStream.toByteArray());
// bmp to mat
mat_image = new Mat();
Bitmap copyBmp = bmp.copy(Bitmap.Config.ARGB_8888, false);
Utils.bitmapToMat(copyBmp, mat_image);
What about the next to deal with the mat_image (or other way) ?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.