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.
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.
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 13:53.
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?
Post error message,there must be some error message above this " 1. collect2: ld returned 1 exit status" .
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?
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.
I have tried
Qt Code:
CvCapture * camera; IplImage * image; qint64 nWrite; image=cvQueryFrame(camera); 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?
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)
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 ishere MessageBox shows that 8 bytes transferred which is the size of file.Qt Code:
QByteArray ba; pic.save(&buffer,"PNG"); // writes image into ba in PNG format nWrite = gtcpSocket->write((const char *)ba); tr("Size of Image sent to client: %1."));To copy to clipboard, switch view to plain text mode
Now at client side I have written code asbut nothing is saved at D drive and no image is set in label. but it shows it received 8 bytes of data...Qt Code:
QByteArray ba; //nRead = in.device()->read((char *)&ba,sizeof(ba)); ba = tcpSocket->read(100); //empty image //load pixel data into empty image from QByteArray //load pixel data into empty image from QByteArray image.save("d:/pic.png","PNG"); ui->label_3->show(); tcpSocket->disconnectFromHost();To copy to clipboard, switch view to plain text mode
how to construct Qimage from raw data and how to save the data/image received over socket to local hard drive ?
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?
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.
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
But no image is displayed also tell me some way how to save received image on local hard driveQt Code:
QPixmap pixmap; QByteArray ba; ba = tcpSocket->read(100); pixmap.loadFromData(ba,"PNG"); ViewObj->ui.label->setPixmap(pixmap);To copy to clipboard, switch view to plain text mode
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 11:34.
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
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?
I m getting a runtime error in my server application
when I compile it it gives errorQt Code:
C:\Qt\2010.02.1\qt\examples\widgets\WebServer\debug\QtOpenCV.exe exited with code -1073741515To 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 givesQt Code:
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?
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
The messageBox shows ba.length() to be 9437 and nWrite to be 8 only.Qt Code:
QByteArray ba; pic.save(&buffer,"PNG"); // writes image into ba in PNG format nWrite = gtcpSocket->write(ba.data());To copy to clipboard, switch view to plain text mode
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?
Bookmarks