Recherche avancée

Médias (0)

Mot : - Tags -/upload

Aucun média correspondant à vos critères n’est disponible sur le site.

Autres articles (58)

  • Des sites réalisés avec MediaSPIP

    2 mai 2011, par

    Cette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
    Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page.

  • Qu’est ce qu’un éditorial

    21 juin 2013, par

    Ecrivez votre de point de vue dans un article. Celui-ci sera rangé dans une rubrique prévue à cet effet.
    Un éditorial est un article de type texte uniquement. Il a pour objectif de ranger les points de vue dans une rubrique dédiée. Un seul éditorial est placé à la une en page d’accueil. Pour consulter les précédents, consultez la rubrique dédiée.
    Vous pouvez personnaliser le formulaire de création d’un éditorial.
    Formulaire de création d’un éditorial Dans le cas d’un document de type éditorial, les (...)

  • Contribute to translation

    13 avril 2011

    You can help us to improve the language used in the software interface to make MediaSPIP more accessible and user-friendly. You can also translate the interface into any language that allows it to spread to new linguistic communities.
    To do this, we use the translation interface of SPIP where the all the language modules of MediaSPIP are available. Just subscribe to the mailing list and request further informantion on translation.
    MediaSPIP is currently available in French and English (...)

Sur d’autres sites (6132)

  • How To Call JAVA Methods from inside of a Thread in JNI

    16 novembre 2019, par Falcuun

    TL ;DR ; I’m having a problem with passing my FFMPEG raw data from C++ code to JAVA code, for displaying, through a thread.

    There is a server set up that sends out encoded frames to its clients. Those encoded frames are encoded with some FFMPEG magic. When received on client side, the fore-mentioned frames are getting decoded into raw RGB data (as a unsigned char *). The problem now is that frames are being received in a "listener" of sorts. Just a thread running in the background polling the server and running specific onFrame function once a new frame is available.

    The current solution for displaying the frames in a video-format is to save each frame to internal storage in C++, and then have a FileObserver on java side that displays an image as soon as it’s written in the memory. Sadly, that approach yields a 6 FPS video on phone, for a 10 FPS video from Server.

    I need a way of passing that unsigned char * (jbytearray) to my JAVA code so I can decode it and display it from RAM rather than Disk.

    It’s worth mentioning that onFrame function cannot have JNIEnv* && jobject inside it’s arguments list (Library requirements).

    What I have tried so far is making a native method in my MainActivity through which I pass JNIEnv and jobject and assign those to global variables

    JNIEnv* m_globalEnv = env;
    jobject m_globalObject = thiz;
    JavaVM m_jvm = 0;
    jclass mainActivity = m_globalEnv->GetObjectClass(m_globalObject);
    jmethodID testMethod = m_globalEnv->GetMethodID(mainClass, "testMethod", "(I)V");

    m_globalEnv->GetJavaVM(&m_jvm);

    After that, in my onFrame I call
    jvm->AttachCurrentThread(&m_globalEnv, NULL);
    And then I try to call a JAVA method from somewhere inside the code (It’s irrelevant where/when in the onFrame I call it) by doing :

    m_globalEnv->CallVoidMethod(m_globalObject, "testMethod", 5);

    And then all crashes with either :

    1- JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xffe8ea7c
    2- JNI DETECTED ERROR IN APPLICATION: Thread is making JNI calls without being attached
    .
    .
    .

    EDIT 1

    After Trying out the code from Michael’s solution, I got the
    java_vm_ext.cc:542] JNI DETECTED ERROR IN APPLICATION: use of invalid jobject 0xc94f7f8c error.
    After running the app in debug mode to catch the error, I got to the jni.h ; Line of code that triggers the error is :
    m_env->CallVoidMethod(m_globalObject, testMethod, 5);
    (5 being the number I am trying to pass for testing purposes).
    The line of code inside jni.h that is being highlighted by the debugger is inside of
    void CallVoidMethod(jobject obj, jmethodID methodID, ...)
    and it’s
    functions->CallVoidMethodV(this, obj, methodID, args);
    which is defined on line 228 :
    void (*CallVoidMethodV)(JNIEnv*, jobject, jmethodID, va_list);

  • Javacv : Mat data becomes null after using methods

    5 avril 2017, par rarrouba

    I’m working on an android application for object detection and counting. For the image processing I am using JavaCV (Java wrapper for OpenCV and FFmpeg). After importing the library, I’m able to successfully use the FFmpegFrameGrabber to get the frames of a video.

    My problem : After I convert the Frame to a Mat object and perform some operation on that Mat object the data becomes null.

    Code :

    MainActivity

       public class MainActivity extends AppCompatActivity {



       OpenCVFrameConverter.ToMat converterToMat = new OpenCVFrameConverter.ToMat();


       private CountModule countModule;
       FFmpegFrameGrabber retriever;

       ArrayList frames;
       boolean frameloaded = false;

       File folder = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MOVIES);
       File video = new File(folder, "test.mp4");

       AndroidFrameConverter converterToBitmap = new AndroidFrameConverter();



       private static WebStreamer webStreamer;

       static {
           System.loadLibrary("native-lib");
       }

       @Override
       protected void onCreate(Bundle savedInstanceState) {
           super.onCreate(savedInstanceState);
           setContentView(R.layout.activity_main);


           final Button button = (Button) findViewById(R.id.btnLdFrames);
           final ImageView img = (ImageView) findViewById(R.id.imageView);


           button.setOnClickListener(new View.OnClickListener() {
               public void onClick(View v) {
                   ((TextView) button).setText("Loading");
                   new Thread(new Runnable() {
                       public void run() {

                           try {
                               button.setClickable(false);
                               button.setAlpha((float) 0.3);
                               LoadFrames();
                               button.setAlpha((float) 1);

                           } catch (FrameGrabber.Exception e) {
                               e.printStackTrace();
                           }
                       }
                   }).start();

               }
           });
       }
       private void LoadFrames() throws FrameGrabber.Exception {
           if (!frameloaded){



               frameloaded = true;

               retriever = new FFmpegFrameGrabber(video);
               frames = new ArrayList<>();
               Log.d("Frame",": Start of loop");

               retriever.start();
               final ImageView img = (ImageView) findViewById(R.id.imageView);
               for (int i=0;i<50;i++){//155430
                   retriever.setFrameNumber(i*100);
                   Frame temp = new Frame();
                   temp = retriever.grab();

                   frames.add(converterToMat.convert(temp));

                   Log.d("Frame",": " + i*100);



               }
               retriever.stop();

               countModule = new CountModule(frames);
               Log.d("Frame","CountModule instantiated");

           }
       }
    }

    Constructor of Countmodule

    public CountModule(ArrayList<mat> frames){

       fgGBG = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());
       gbg = createBackgroundSubtractorMOG2();
       Mat maTemp = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());

       median = new Mat(frames.get(0).rows(),frames.get(0).cols(),frames.get(0).type());
       frames.get(0).copyTo(median);
       ;
       median = getMedian(frames);
       kernel2 = Mat.ones(11,11,CV_8U).asMat();
       kernel = Mat.ones(3,1,CV_8U).asMat();
       gbg.apply(median,fgGBG,0.001);

    }
    </mat>

    Variables (images) :

    After convert from Frame to Mat. Data has values.

    Data=null when using the method frame.copyTo(median). Data of Mat also null when using method Mat.ones()


    As you can see everytime I use a OpenCV specific method, the returned Mat is not what is expected.

  • Anomalie #2861 (Nouveau) : L’option de déclarer un article comme étant la traduction s’est perdue

    17 septembre 2012, par Paolo -

    Il manque en SPIP 3 le lien, qui était présent dans le bloc de traduction de SPIP 2 : « Cet article est une traduction de l’article numéro : » qui permettait de relier des articles entre eux comme traductions, si on l’avait loupé au moment de la création. Ce lien n’est pas là, ni en SPIP 3.0.4 ni en (...)