Results 1 to 2 of 2

Thread: Using QDataStream

  1. #1
    Join Date
    Feb 2007
    Posts
    13
    Thanks
    5
    Qt products
    Qt4
    Platforms
    Windows

    Default Using QDataStream

    Hi

    I want to use QDataStream to stream images thru QUdpSocket. The images are on OpenCv's IplImage format, and structure like this:

    typedef struct _IplImage
    {
    int nSize; /* sizeof(IplImage) */
    int ID; /* version (=0)*/
    int nChannels; /* Most of OpenCV functions support 1,2,3 or 4 channels */
    int alphaChannel; /* ignored by OpenCV */
    int depth; /* pixel depth in bits: IPL_DEPTH_8U, IPL_DEPTH_8S, IPL_DEPTH_16S,
    IPL_DEPTH_32S, IPL_DEPTH_32F and IPL_DEPTH_64F are supported */
    char colorModel[4]; /* ignored by OpenCV */
    char channelSeq[4]; /* ditto */
    int dataOrder; /* 0 - interleaved color channels, 1 - separate color channels.
    cvCreateImage can only create interleaved images */
    int origin; /* 0 - top-left origin,
    1 - bottom-left origin (Windows bitmaps style) */
    int align; /* Alignment of image rows (4 or 8).
    OpenCV ignores it and uses widthStep instead */
    int width; /* image width in pixels */
    int height; /* image height in pixels */
    struct _IplROI *roi;/* image ROI. when it is not NULL, this specifies image region to process */
    struct _IplImage *maskROI; /* must be NULL in OpenCV */
    void *imageId; /* ditto */
    struct _IplTileInfo *tileInfo; /* ditto */
    int imageSize; /* image data size in bytes
    (=image->height*image->widthStep
    in case of interleaved data)*/
    char *imageData; /* pointer to aligned image data */
    int widthStep; /* size of aligned image row in bytes */
    int BorderMode[4]; /* border completion mode, ignored by OpenCV */
    int BorderConst[4]; /* ditto */
    char *imageDataOrigin; /* pointer to a very origin of image data
    (not necessarily aligned) -
    it is needed for correct image deallocation */
    }
    ------------------------------------------------------------------



    So, what operator from QDataStream can I use to get this working?

    Thanks

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Using QDataStream

    Why don't you flatten all the members in this struct to the data stream, in the order they are defined?

    It's no easy way of doing this...
    I see there are a couple of member structs...

    I say you do a "big" function that flattens this struct, and another one that reads it from a QDataStream.

    regards

Similar Threads

  1. QDataStream vs. fwrite
    By s43lee in forum Newbie
    Replies: 6
    Last Post: 26th January 2007, 09:12
  2. QDataStream reading into QString
    By jakamph in forum Qt Programming
    Replies: 4
    Last Post: 15th October 2006, 09:22
  3. avaiability of data from QDataStream
    By quickNitin in forum Newbie
    Replies: 1
    Last Post: 19th June 2006, 12:32
  4. Reading QByteArray from QDataStream Qt3.3
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2006, 20:23
  5. QDataStream >> QString
    By smalls in forum Qt Programming
    Replies: 2
    Last Post: 17th January 2006, 22:14

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.