LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading Image Data from Serial Port

Dear Friends,

I have a Embedded Logger which has a VGA camera attached to it mainly used in  remote monitoring, we are trying different lens for that camera.I need to develop an application in LabView to acquire the image data from the device and display it on my PC so that we can test the camera lens.Basically my embedded device reads the image from camera and it will store it in a buffer. Also that device has a serial interface(RS232) through which I can transfer the buffer to PC. But I need some help on receiving that Image data via serial port of my PC and to display at the fastest rate possible so that we can test our camera easily presently we are doing it using GPRS, I am using TCP functions of LabView but its very slow due to Telco problems, data size of each Image will be around 5KB!.Please suggest me on this.Thank you in advance!

Regards,
Hosangadi
0 Kudos
Message 1 of 15
(5,412 Views)

What are the specs for the camera using the serial port?  I would have expected TCP to be much faster than serial communication.

However, if you do want to use the serial port, you should be able to communicate with it and receive the image using the available examples.  I should probably ask if you have used LabVIEW serial communication before.

In any case, look within the Help menu and select Find Examples.  Do a search on "serial".  Double-click on the work serial in the box below search.  It will list approx 9 examples.  Select the top one called "Advanced Serial Write and Read.vi"

Select the appropriate Visa Resource Name (COM port) and configure the port appropriately for maximum speed, according to the manufacturer's recommendations (specs).  You can also play with the input buffer size  You will need to select if you write with a termination character or not (push buttons).  It is the carriage return.

Your data will be read as a string, so it may not look right.  That's okay... It will most likely be hexadecimal characters.  You will then need to convert this to hexadecimal numbers and write it to a binary file.  If you need help, simply post the character string that you read from the serial port so that we can provide assistance.

Start with this and let us know how it goes.

R

 



Message Edited by JoeLabView on 08-09-2008 08:13 AM
0 Kudos
Message 2 of 15
(5,408 Views)

Dear Friends,

I have a Embedded Logger which has a VGA camera attached to it mainly used in  remote monitoring, we are trying different lens for that camera.I need to develop an application in LabView to acquire the image data from the device and display it on my PC so that we can test the camera lens.Basically my embedded device reads the image from camera and it will store it in a buffer. Also that device has a serial interface(RS232) through which I can transfer the buffer to PC. But I need some help on receiving that Image data via serial port of my PC and to display at the fastest rate possible so that we can test our camera easily presently we are doing it using GPRS, I am using TCP functions of LabView but its very slow due to Telco problems, data size of each Image will be around 5KB!.Please suggest me on this.Thank you in advance!



Have you used a serial communication with LabVIEW before?  I guess You will be getting  ascii values via your  com port(Select proper com port,Use Max for this purpose).


Does your camera support LabVIEW? If yes than how much have you progressed?What is your application? Can you give us more information regarding the camera?


PS: JLV beat me to it.Please answer his questions  too


Message Edited by muks on 08-09-2008 07:19 AM
Message 3 of 15
(5,404 Views)
Hi,
Many thanks for quick response, basically we are not aware of the camera spec as its a third party propriety, but it doesnt matter as I need to acquire Image from a data logger to which that camera is attached, My data logger supports serial communication(Normal 9600 bps). I am quite new to Lab View I am more in to embedded systems.
Yes TCP should be faster but I dont have direct TCP interface with data logger I need to use GPRS to transfwer Image which is taking more time!
The communication is as below:

VGA Camera-----Unknown Protocol------>Datalogger(Programmable)--------RS232---------->PC

I have APIs for camera to capture Images in my Datalogger which I will call in my firmware and API returns Image data in a Buffer.I also have Serial Port APIs to send both string and data.I tried to send small strings from datalogger to PC and read it using Advanced Serial Read.vi it works fine, but when I tried to send Image data about 4.5KB I couldnt receive anything. Also pls let me know whether I can use IMAQ functions as I have IMAQ modules.I am not directly dealing with Camera I communicate with the Datalogger. I think you all clear about my need now!
0 Kudos
Message 4 of 15
(5,394 Views)
Serial communication I can use: 57.600 baud, no parity, 8 data bits, 1 stop bit.
0 Kudos
Message 5 of 15
(5,386 Views)


Hosangadi wrote:

VGA Camera-----Unknown Protocol------>Datalogger(Programmable)--------RS232---------->PC

I have APIs for camera to capture Images in my Datalogger which I will call in my firmware and API returns Image data in a Buffer.I also have Serial Port APIs to send both string and data.I tried to send small strings from datalogger to PC and read it using Advanced Serial Read.vi it works fine, but when I tried to send Image data about 4.5KB I couldnt receive anything. Also pls let me know whether I can use IMAQ functions as I have IMAQ modules.I am not directly dealing with Camera I communicate with the Datalogger. I think you all clear about my need now!


So you are only concerned about the serial interface to and from the Datalogger.  The API that you have available, is it in the form of a dll?  If so, then you may need a different approach.  Can you describe this API?
 
After you have received the image data and saved it as an image file (maybe done by the API??), you will then be able to use the IMAQ functions as you would with any image. 
 
The potential difference between getting the image data directly from the serial communication within LabVIEW versus the API is that the API may prepare the image header information directly into the file, whereas we would have to see the data if you use the serial communication.  It is possible that the camera does this already.  Which is why you would need to describe the API.
 
R
0 Kudos
Message 6 of 15
(5,370 Views)
Hi JLV,
API is not windows API ,I refer to the datalogger API, using which I can take the snapshot from the camera attached to it, This API is for Datalogger firmware not for PC software.API is like thuis:
// Take a snapshot
size := camSnapshot(res := 3, pic := ADDR(buffer), picsize :=SIZEOF(buffer));
here res:Resolution
when I call this API in my firmware application of Datalogger by which datalogger issues a command to the Camera to take the Image and Recieve the Imgae in JPEG format, Last time I tried to tansfer the "buffer" throght GPRS socket to Server and I received it using TCP Listen, Read functions of LabView as a string and I wrote this string from TCP in to a JPEG file using write charecters to file, I ws successful in gettiong the Image that way! but speed is the problem on that approach, I need same buffer to be transferred using Serial port and read it in my PC write data in to a Image file and display the Image on my LabView application, So my major concern is about acquiring this JPEG pixel data through a serial port and displaying it on Labview application.Buffer will be having pixel data which can be directly written in to a JPEG file to get Image.
0 Kudos
Message 7 of 15
(5,366 Views)
So, could you please again specify your problem? You said you know how to get data out of your data logger, you have the commands you have to send by serial communication to get the data logger to transfer images, and you know the serial port properties like 9600 baud...so: where's the point? You don't get an image out, but why? You get unreadable data? No data?

Christian

THINK G!! 😉
------------------------------------------------------------------------------------------------
Using LabView 2010 and 2011 on Mac and Win
Programming in Microsoft Visual C++ (Win), XCode (Mac)
0 Kudos
Message 8 of 15
(5,341 Views)
cschneider,

Problem is in receiving data in PC using labiew via serial porrt, I used advanced serial read/write.vi but I am not getting any data...eventhough my datalogger sends image data....also for your information I need not issue any command frm my  PC to datalogger to get the ?Image as you specified in your post....I think you have not understood my previous posts....kindly go through once again...thanks anyways
0 Kudos
Message 9 of 15
(5,329 Views)

If you open up Hyperterminal, do you see any data coming in?  Are you sure you are using the right kind of cable whether it is a straight through cable or null modem?

Try using Hyperterminal to debug the communications first.  Once you have it working there, and you know you have the right kind of cable and the communication settings correct, then you can use that information to get the LabVIEW serial read/write VI's working.

0 Kudos
Message 10 of 15
(5,322 Views)