PDA

View Full Version : Receiving Image through serial port in QT



jakr13
1st February 2013, 02:00
Hi everyone,

I created an image processing GUI in Qt with openCV, where I opened an image from specific path and processed it. Now I am planning to implement like getting an image from serial port and send that image for further processing. I don't have any idea in doing this,. Any help will be appreciated!

void finalv1::openimage()
{
QString filename=QFileDialog::getOpenFileName(this,tr("Load Image"),".",tr("Image Files(*.png *.jpg *.jpeg *.bmp)"));
imageop = cvLoadImage(filename.toAscii().data());
cvNamedWindow("image",1);
cvShowImage("image",imageop);
}

void finalv1::on_pushButton_open_clicked()
{
openimage();
}

I provided my code for opening an image and the image is an 'IplImage*'.

Thanx!

Santosh Reddy
1st February 2013, 10:10
Do you already have a serial port access lib, if not select one first. This post lists some useful links

http://www.qtcentre.org/threads/52943-Best-serial-port-library

Then using one the library get the file from serial port, save it on disk, and open it as usual.

jakr13
4th February 2013, 05:08
Hi Santosh,

Is it mandatory to have Qextserialport or some other library to do serial communication in Qt? can't we write in C++ directly without having those libraries?

thanx

Santosh Reddy
4th February 2013, 05:14
You can always write using native OS APIs.