Page 2 of 3 FirstFirst 123 LastLast
Results 21 to 40 of 55

Thread: Wireless Video

  1. #21
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video



    linking LIB files as dll solved my problem

    I changed it as

    LIBS += -lcv200.dll -lhighgui200.dll

    also I needed to place the dll's where my qt project EXE resides.

    Thanks to all who helped me.

  2. #22
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default

    modifying

    LIBS += -lcvl -lhighguil

    to

    LIBS += -lcv200.dll -lhighgui200.dll

    solved my problem

    also I had to place

    1) libcv200.dll
    2) libcvaux200.dll
    3) libhighgui200.dll
    4) libcxcore200.dll


    above dll's in release folder where project exe resides


    Thanx to all who helped me


    My another question is if we attached webcam to a PC in LAN,can we access and view it in other PC using Qt?

    Last edited by wysota; 12th June 2010 at 14:53.

  3. #23
    Join Date
    Jun 2010
    Posts
    8
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    hello, can i ask you something, i'm currently doing a similar program with yours, im trying to send a video feed from a mobile robot into my laptop using qt and open cv,

    i also use the same source code that have tried to open the webcam in opencv using Qt,

    but after compiling the QtOpenCV i got thsi eror messages:

    1. collect2: ld returned 1 exit status

    can u share help me to solve this error?

  4. #24
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    Post error message,there must be some error message above this " 1. collect2: ld returned 1 exit status" .

  5. #25
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: Wireless Video

    Quote Originally Posted by Qt Coder View Post
    Can we access and view webcam on my PC which is attached to other PC in LAN using Qt
    Of course you can. Create a little server on the pc having the webcam. Send it to all the other clients that are connected.

  6. #26
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    I m able to create server and client,but my question is


    1) How to send IplImage over socket?

    2) How to use threads to handle more than one client requests?

  7. #27
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    You don't need to use threads to handle more than one client request. Use signals, slots and asynchronous methods instead.

    You can transfer the image as binary data.

  8. #28
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    I have tried

    Qt Code:
    1. CvCapture * camera;
    2. IplImage * image;
    3. qint64 nWrite;
    4.  
    5. image=cvQueryFrame(camera);
    6. nWrite = gtcpSocket->write((char*)image,sizeof(image));
    To copy to clipboard, switch view to plain text mode 

    But nWrite shows only 4 bytes transferred..

    How to send image as binary data?

  9. #29
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    sizeof(image) is a pointer, so 4 bytes is what I'd expect it to write.

    image->imageData may be more suitable (or wherever the data is stored)

  10. #30
    Join Date
    May 2010
    Posts
    12
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Wireless Video

    Quote Originally Posted by hatred View Post
    hello, can i ask you something, i'm currently doing a similar program with yours, im trying to send a video feed from a mobile robot into my laptop using qt and open cv,

    i also use the same source code that have tried to open the webcam in opencv using Qt,

    but after compiling the QtOpenCV i got thsi eror messages:

    1. collect2: ld returned 1 exit status

    can u share help me to solve this error?
    What I do in this situation is go into my project directory via console and run make from console. Usually, but not always, it will show some more info regarding why ld returned 1 exit status. More often than not, it is because a library wasn't found. Hope this helps!

  11. #31
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    Hey I m able to send image over socket ,but at clients side I m not able to see any image

    My server application code for sending image is
    Qt Code:
    1. QImage pic("Viraat.png","PNG");
    2.  
    3. QBuffer buffer( &ba );
    4. buffer.open(QIODevice::WriteOnly);
    5. pic.save(&buffer,"PNG"); // writes image into ba in PNG format
    6. nWrite = gtcpSocket->write((const char *)ba);
    7.  
    8. QMessageBox::critical(this, QString::number(int(nWrite)),
    9. tr("Size of Image sent to client: %1."));
    To copy to clipboard, switch view to plain text mode 
    here MessageBox shows that 8 bytes transferred which is the size of file.


    Now at client side I have written code as
    Qt Code:
    1. QDataStream in(tcpSocket);
    2. in.setVersion(QDataStream::Qt_4_6);
    3.  
    4. QBuffer buffer( &ba );
    5. buffer.open(QIODevice::ReadOnly);
    6.  
    7. //nRead = in.device()->read((char *)&ba,sizeof(ba));
    8. ba = tcpSocket->read(100);
    9.  
    10.  
    11. //empty image
    12. QImage image(2048,1024,QImage::Format_Indexed8);
    13.  
    14. //load pixel data into empty image from QByteArray
    15. image = QImage::fromData(ba,"PNG");
    16.  
    17. //load pixel data into empty image from QByteArray
    18.  
    19.  
    20. QMessageBox::critical(this,tr("Data Received: %1."),QString::number(ba.length()));
    21. image.save("d:/pic.png","PNG");
    22. ui->label_3->setPixmap(QPixmap:: fromImage( QImage(image)));
    23. ui->label_3->show();
    24. tcpSocket->disconnectFromHost();
    To copy to clipboard, switch view to plain text mode 
    but nothing is saved at D drive and no image is set in label. but it shows it received 8 bytes of data...

    how to construct Qimage from raw data and how to save the data/image received over socket to local hard drive ?

  12. #32
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Wireless Video

    You expect the whole image data to fit into 8 bytes? Or even into 100 bytes?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  13. #33
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    I dont know how much would be the image size so I have given maximum of 100 bytes data to read. what to give read size otherwise if you dont know how much size of data is going to arrive on socket?

  14. #34
    Join Date
    Sep 2009
    Location
    UK
    Posts
    2,447
    Thanks
    6
    Thanked 348 Times in 333 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    So why not send the size of the data your sending before sending the actual image data? Then you know the size you are expecting.

  15. #35
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Angry Re: Wireless Video

    I m able to receive data on socket but I need to construct image from it and set it as pixmap to my label

    My client side code is

    Qt Code:
    1. QPixmap pixmap;
    2. QDataStream in(tcpSocket);
    3. in.setVersion(QDataStream::Qt_4_6);
    4.  
    5. QBuffer buffer( &ba );
    6. buffer.open(QIODevice::ReadOnly);
    7. ba = tcpSocket->read(100);
    8.  
    9. pixmap.loadFromData(ba,"PNG");
    10.  
    11. ViewObj->ui.label->setPixmap(pixmap);
    To copy to clipboard, switch view to plain text mode 
    But no image is displayed also tell me some way how to save received image on local hard drive

  16. #36
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Wireless Video

    Please, answer these questions:
    • How many bytes (roughly) would a BMP image with 2048x1024 size and an 8 bit colormap take?
    • How many bytes are sent on the socket on the transmitting side?
    • How many bytes should be sent on the socket assuming a maximal possible image compression available is about 1:12?
    • How are those three figures related to each other?
    • What is the size of byte array on the receiving end before calling loadFromData()?

    If you don't know how to answer those questions, please look for answers in the Internet. Answers to the last two should give you a hint why an image is not displayed.
    Last edited by wysota; 15th June 2010 at 12:34.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  17. #37
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    Currently The image which I m sending is of
    1)Image resolution - 128 by 128
    2)format - "PNG"
    3)size on disk - 8,192 bytes

    but at server side it shows only 8 bytes transferred...

    As I searched on internet 8 bit Grayscale means 1 byte per pixel

    so answer to your first question is

    1) 2048x1024 = 2097152 pixels which would mean 2097152 bytes
    2) in my case only 8 bytes are sent on the socket on the transmitting side
    3) if we consider above bmp image with the 2048*1024 resolution then 174762 bytes should be sent assuming a maximal possible image compression available is about 1:12

    correct me if I m wrong

  18. #38
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Wireless Video

    So what does it mean if 8 bytes are sent on the transmitting end if the image has volume of 8kB? Can the image be recreated on the receiving end from those 8 bytes?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  19. #39
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    I m getting a runtime error in my server application

    when I compile it it gives error
    Qt Code:
    1. C:\Qt\2010.02.1\qt\examples\widgets\WebServer\debug\QtOpenCV.exe exited with code -1073741515
    To copy to clipboard, switch view to plain text mode 


    it use to run fine before ,

    I tried adding messegebox in main() at very first step but control dont even reaches there, if I run exe manually it gives
    Qt Code:
    1. Runtime error !.. This application has requested the runtime to terminate it in an unusual way.
    To copy to clipboard, switch view to plain text mode 

    I m not able to debug it also..

    How to fix this runtime error?

  20. #40
    Join Date
    Mar 2009
    Posts
    116
    Thanks
    1
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Wireless Video

    Hey I got where this runtime error lies

    I need to place those OpenCV dll's in my debub folder.

    Now my server side code is

    Qt Code:
    1. QImage pic("monkey_off_128x128.png","PNG");
    2.  
    3. QBuffer buffer( &ba );
    4. buffer.open(QIODevice::WriteOnly);
    5. pic.save(&buffer,"PNG"); // writes image into ba in PNG format
    6. nWrite = gtcpSocket->write(ba.data());
    7. QMessageBox::critical(this, QString::number(ba.length()),QString::number((int)nWrite));
    To copy to clipboard, switch view to plain text mode 
    The messageBox shows ba.length() to be 9437 and nWrite to be 8 only.
    where as the file size is 7045 bytes and size on disk 8192 bytes ,I dont know from where it has added extra bytes.

    also why it sends only 8 bytes over socket?

Similar Threads

  1. Playing video using Phonon video widget
    By Leolander in forum Newbie
    Replies: 0
    Last Post: 26th February 2010, 07:15
  2. Replies: 3
    Last Post: 5th July 2009, 18:22
  3. Video freezes during mpeg video playback using Phonon
    By davejames in forum Qt Programming
    Replies: 2
    Last Post: 12th January 2009, 09:45
  4. Video
    By mahiapkum in forum Qt Programming
    Replies: 3
    Last Post: 22nd April 2008, 12:38

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.