Should I use Debian or Ubuntu linux?

This is where you talk about the EV3 software itself, installation issues, and programming talk.

Moderators: roger, gloomyandy, skoehler

clplaneguy
Novice
Posts: 29
Joined: Sat Feb 18, 2017 3:44 pm

Should I use Debian or Ubuntu linux?

Postby clplaneguy » Fri May 11, 2018 11:22 pm

I am trying to write a program to run on the EV3 with two cameras. I suppose I must use EV3 Linux and EV3 OpenCV. I can distinguish them, I here, with v4l which only works with Linux. LeJOS is written in Debian Linux. To write the program for EV3 Linux(Debian), should I use Ubuntu Linux or Debian Linux? Since I am already in Ubuntu, is it worth switching to Debian?

User avatar
esmetaman
Advanced Member
Posts: 377
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Should I use Debian or Ubuntu linux?

Postby esmetaman » Sun May 13, 2018 9:04 am

Hi @clplaneguy,

image processing is a heavy task for a EV3 Brick because the CPU/RAM specifications are very limited for that kind of tasks.
If you add 2 cameras, the CPU load is double.

You don´t need to switch to Ubuntu Linux to Debian, let me clarify some concepts about the JVM architecture:

Every computer install a JVM compiled previously for a specific platform/hardware and the JVM understand the Java program because when you compile your Java programs, the compiler (javac) generates an intermediate language as the output for the process, the bytecodes. Finally, the bytecodes are processed by the JVM. So, you can code in any OS and the final Jar generated by your project build system (Maven/Gradle/Ant) could run in your Brick.


Remember if you use are thinking to use Debian, I recommend to continue using Debian Jessie.
With Debian Jessie from the last week, Is possible to install OpenJDK 10.

For OpenCV, the stable version for Debian Jessie is:

Code: Select all

sudo apt-get install libopencv2.4-java


Some easy examples with OpenCV for Java:
https://github.com/ev3dev-lang-java/exa ... ava/opencv

Code: Select all

root@ev3dev:/home# java -Djava.library.path=/usr/lib/jni/ -cp HelloCV2.jar:/usr/share/OpenCV/java/opencv-249.jar Main
Welcome to OpenCV 2.4.9.1
/usr/lib/jni/
m = [1, 0, 0;
  0, 1, 0;
  0, 0, 1]


I suppose that using mutiple VideoCapture objects, you could use multiple cameras. Frankly I didn´t test. Connect a USB hub in your EV3 Brick with multiple webcams and it should run.

Code: Select all

VideoCapture camera = new VideoCapture(0);
VideoCapture camera2 = new VideoCapture(1);



Code: Select all

public class Webcam1 {

    public static void main( String[] args ) {
        System.out.println("Welcome to OpenCV " + Core.VERSION);
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
       
        VideoCapture camera = new VideoCapture(0);
        if(!camera.isOpened()) {
            System.out.println("Camera Error");
        }

        Mat frame = new Mat();

        camera.read(frame);
        System.out.println("Frame Obtained");
        System.out.println("Captured Frame Width " + frame.width());

        Highgui.imwrite("camera.jpg", frame);
        camera.release();
    }
}


Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
esmetaman
Advanced Member
Posts: 377
Joined: Wed Sep 13, 2006 12:16 am
Location: UK, Milton Keynes
Contact:

Re: Should I use Debian or Ubuntu linux?

Postby esmetaman » Sun May 20, 2018 4:51 pm

I have just tested that it is possible to manage multiple webcams with EV3 and it is true.

In the example, I manage 3 webcams to store in disk some frames.
It is a simple image but it is a good way to understand the concept.
You plug the new webcam in the USB 2.0 hub and the OS will detect the webcam to operate with it.

Code: Select all

package example.opencv;

import org.opencv.core.Core;
import org.opencv.core.Mat;
import org.opencv.highgui.Highgui;
import org.opencv.highgui.VideoCapture;

/**
 * Multiple webcams
 *
 */
public class MultipleWebcam {

    public static void main( String[] args ) {
        System.out.println("Welcome to OpenCV " + Core.VERSION);
        System.loadLibrary(Core.NATIVE_LIBRARY_NAME);

        for(int i = 0; i < 3; i++) {

            VideoCapture camera = new VideoCapture(i);
            if (!camera.isOpened()) {
                System.out.println("Camera Error");
            }

            Mat frame = new Mat();
            camera.read(frame);
            System.out.println("Frame Obtained");
            System.out.println("Captured Frame Width " + frame.width());

            Highgui.imwrite("camera" + i +".jpg", frame);

            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
            }
            System.out.println("Iteration:" + i);

            camera.release();
        }
    }
}


Review the issue:
https://github.com/ev3dev-lang-java/ev3 ... -390476535

Because, I have some problem on Jessie with some dependency to run OpenCV in latest version.

Cheers

Juan Antonio
Juan Antonio Breña Moral
http://www.juanantonio.info/lejos-ebook/
http://ev3dev-lang-java.github.io/#/
https://github.com/jabrena/livingrobots

User avatar
gloomyandy
leJOS Team Member
Posts: 6047
Joined: Fri Sep 28, 2007 2:06 pm
Location: UK

Re: Should I use Debian or Ubuntu linux?

Postby gloomyandy » Sun May 20, 2018 6:21 pm

Just to be clear Juan is using ev3dev and not leJOS to run his tests. This may or may not work with leJOS. Remember that when you use a USB hub you will be sharing the single USB connection between the various cameras so will almost certainly be getting a low frame rate, this will be further reduced if you also have a WiFi dongle connected to the EV3 and choose to stream any of the video back to a PC.
leJOS news https://lejosnews.wordpress.com/


Return to “EV3 Software”

Who is online

Users browsing this forum: No registered users and 2 guests