Recherche avancée

Médias (1)

Mot : - Tags -/censure

Autres articles (75)

  • Le profil des utilisateurs

    12 avril 2011, par

    Chaque utilisateur dispose d’une page de profil lui permettant de modifier ses informations personnelle. Dans le menu de haut de page par défaut, un élément de menu est automatiquement créé à l’initialisation de MediaSPIP, visible uniquement si le visiteur est identifié sur le site.
    L’utilisateur a accès à la modification de profil depuis sa page auteur, un lien dans la navigation "Modifier votre profil" est (...)

  • Configurer la prise en compte des langues

    15 novembre 2010, par

    Accéder à la configuration et ajouter des langues prises en compte
    Afin de configurer la prise en compte de nouvelles langues, il est nécessaire de se rendre dans la partie "Administrer" du site.
    De là, dans le menu de navigation, vous pouvez accéder à une partie "Gestion des langues" permettant d’activer la prise en compte de nouvelles langues.
    Chaque nouvelle langue ajoutée reste désactivable tant qu’aucun objet n’est créé dans cette langue. Dans ce cas, elle devient grisée dans la configuration et (...)

  • XMP PHP

    13 mai 2011, par

    Dixit Wikipedia, XMP signifie :
    Extensible Metadata Platform ou XMP est un format de métadonnées basé sur XML utilisé dans les applications PDF, de photographie et de graphisme. Il a été lancé par Adobe Systems en avril 2001 en étant intégré à la version 5.0 d’Adobe Acrobat.
    Étant basé sur XML, il gère un ensemble de tags dynamiques pour l’utilisation dans le cadre du Web sémantique.
    XMP permet d’enregistrer sous forme d’un document XML des informations relatives à un fichier : titre, auteur, historique (...)

Sur d’autres sites (8137)

  • OpenCV returns an Array of All Zeros on video.read

    19 janvier 2020, par Ikechukwu Anude

    Below is the relevant code

    import cv2 as cv
    import numpy as np

    video = cv.VideoCapture(0) #tells obj to use built in camera\

    #create a face cascade object
    face_cascade  =
    cv.CascadeClassifier(r"C:\Users\xxxxxxx\AppData\Roaming\Python\Python36\site-
    packages\cv2\data\haarcascade_frontalcatface.xml")

    a = 1
    #create loop to display a video
    while True:
       a = a + 1
       check, frame = video.read()
       print(frame)

       #converts to a gray scale img
       gray = cv.cvtColor(frame, cv.COLOR_BGR2GRAY)

       #create the faces
       faces = face_cascade.detectMultiScale(gray, scaleFactor=1.5, minNeighbors=5)

       for(x, y, w, h) in faces:
           print(x, y, w, h)

       #show the image
       cv.imshow('capturing', gray)

       key = cv.waitKey(1) #gen a new frame every 1ms

       if key == ord('q'): #once you enter 'q' the loop will be exited
           break

    print(a) #this will print the number of frames

    #captures the first frame
    video.release() #end the web cam

    #destroys the windows when you are not defined
    cv.destroyAllWindows()

    The code displays a video captured from my webcam camera. Despite that, OpevCV doesn’t seem to be processing any frames as all the frames look like this

    [[0 0 0]
     [0 0 0]
     [0 0 0]
     ...
     [0 0 0]
     [0 0 0]
     [0 0 0]]]

    which I assume means that they are empty.

    This I believe is preventing the algorithm from being able to detect my face in the frame. I have a feeling that the issue lies in the ffmpeg codec, but I’m not entirely sure how to proceed even if that is the case.

    OS : Windows 10
    Language : Python

    EDIT : The Frame is not empty but all the values in the array seem to be ’0’

    Why is the frame empty and how can I get OpenCV to detect my face in the frame ?

  • AVCodecContex returns zero for width and height in android

    7 mars 2014, par Whoami

    Not sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android.

    QUESTION :
    Why Width and Height of the CodecContext gives me always zero ?..

    int main(int argc, char *argv[])
    {

       int flags;
       flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;

       if (SDL_Init (flags)) {
           LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());
       }
       else
           LOGD (" SUCCESS: SDL_Init ");

       // ffmpeg Register all services..
       ffmpeg_register_all ();


       pFrame = avcodec_alloc_frame ();
       context = avformat_alloc_context();

       err = avformat_open_input (&context, "rtsp:ip:port", NULL, NULL);
       if ( err < 0) {
           __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");

           return -1;
       }

       for (i = 0; i < context->nb_streams; i++)
       {              
           // Find the Decoder.
           codec = avcodec_find_decoder(context->streams[i]->codec->codec_id);
           if (codec->type  == AVMEDIA_TYPE_VIDEO ) {
               __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming..  ");
               videoStreamIndex = i;

           }
       }

       // Play RTSP
       av_read_play(context);

       // Get Codec Context.
       pCodecCtx = context->streams[videoStreamIndex]->codec;
       if ( pCodecCtx == NULL )
           __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL>>> ");
       else
           __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is &lt;&lt;<ok>>> ");


       //Find the Decoder.
       pCodec = avcodec_find_decoder (pCodecCtx->codec_id);
       avcodec_open2 (pCodecCtx, pCodec, NULL);


       int w = pCodecCtx->width;  // Why me getting 0 ?
       int h = pCodecCtx->height;

       window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);
       // What this HIGHDPI Means ??

       if ( window != NULL )
       {
           LOGD (" WINDOW CREATED.. , create Renderer ..");
           renderer = SDL_CreateRenderer (window, -1, 0);  
       }
       else
       {
           LOGD (" Invalid SDL Window ");  
       }
    __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h);
       return 0;
    }
    </ok>
  • AVCodecContex returns zero for width and height in android

    17 février 2023, par Whoami

    Not sure what was my mistake in the below code. I m trying with ffmpeg 0.11 and SDL2.0 in android.

    &#xA;&#xA;

    QUESTION :&#xA;Why Width and Height of the CodecContext gives me always zero ?..

    &#xA;&#xA;

    int main(int argc, char *argv[])&#xA;{&#xA;&#xA;    int flags;&#xA;    flags = SDL_INIT_VIDEO | SDL_INIT_TIMER;&#xA;&#xA;    if (SDL_Init (flags)) {&#xA;        LOGD ("Could not intialize Video for SDL: %s \n", SDL_GetError());&#xA;    }&#xA;    else &#xA;        LOGD (" SUCCESS: SDL_Init ");&#xA;&#xA;    // ffmpeg Register all services..&#xA;    ffmpeg_register_all (); &#xA;&#xA;&#xA;    pFrame = avcodec_alloc_frame ();&#xA;    context = avformat_alloc_context();&#xA;&#xA;    err = avformat_open_input (&amp;context, "rtsp:ip:port", NULL, NULL);&#xA;    if ( err &lt; 0) {&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Unable to open rtsp... ");&#xA;&#xA;        return -1;&#xA;    }&#xA;&#xA;    for (i = 0; i &lt; context->nb_streams; i&#x2B;&#x2B;)&#xA;    {               &#xA;        // Find the Decoder.&#xA;        codec = avcodec_find_decoder(context->streams[i]->codec->codec_id);&#xA;        if (codec->type  == AVMEDIA_TYPE_VIDEO ) {&#xA;            __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Found Video Streaming..  ");&#xA;            videoStreamIndex = i;&#xA;&#xA;        }&#xA;    }&#xA;&#xA;    // Play RTSP&#xA;    av_read_play(context);&#xA;&#xA;    // Get Codec Context.&#xA;    pCodecCtx = context->streams[videoStreamIndex]->codec;&#xA;    if ( pCodecCtx == NULL )&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is NULL>>> ");&#xA;    else&#xA;        __android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "CodecCtx is &lt;&lt;<ok>>> ");&#xA;&#xA;&#xA;    //Find the Decoder.&#xA;    pCodec = avcodec_find_decoder (pCodecCtx->codec_id);&#xA;    avcodec_open2 (pCodecCtx, pCodec, NULL);&#xA;&#xA;&#xA;    int w = pCodecCtx->width;  // Why me getting 0 ? &#xA;    int h = pCodecCtx->height;&#xA;&#xA;    window = SDL_CreateWindow ("Test ffmpeg",SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, w, h, SDL_WINDOW_SHOWN|SDL_WINDOW_ALLOW_HIGHDPI);&#xA;    // What this HIGHDPI Means ??&#xA;&#xA;    if ( window != NULL ) &#xA;    {&#xA;        LOGD (" WINDOW CREATED.. , create Renderer ..");&#xA;        renderer = SDL_CreateRenderer (window, -1, 0);  &#xA;    }&#xA;    else&#xA;    {&#xA;        LOGD (" Invalid SDL Window ");  &#xA;    }&#xA;__android_log_print(ANDROID_LOG_DEBUG, "ffmpegguard", "Width and Height of PCodeccCtx.. %d .. %d " , w, h); &#xA;    return 0;&#xA;}&#xA;</ok>

    &#xA;