LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP/IP USB camera

hi..
      I was wondering how is it possible to send the images i capture using my USB camera wirelessly using TCP/IP to another computer (COM2) enabling it to show the same continous image on both computers. Below is my program so far.. For the file ( USB + Joystick Integration 2) Images can be seen in the VI file in (COM1) however unable to show on the (COM2) which is already connected togther using TCP/IP.. The file (faffafafaf) is the VI i use on the (COM2)..
 
COM1 is the computer with the USB camera**
 
Btw, one more question, Lets say i got a joystick connected to a computer(COMA) does it means COMA have to be the server of the program is i were to transfer the data to another computer(COMB) .. Can it be the Client also??
Download All
0 Kudos
Message 1 of 24
(5,857 Views)
I don't have IMAQ, so I can't test your VI, but I suspect the problem is that you need to specify a datatype to the "Type Cast" function in your client VI so that it can properly interpret the string. Create a local variable of the "Image" indicator, change it to Read, and wire it to the "Type Cast" function's type input.

I don't quite understand your second question regarding the joystick.
0 Kudos
Message 2 of 24
(5,828 Views)

 

 

    I tried wiring the "Image" indicator to the Type Cast however the problem stil exists..

Regarding the second question, what i mean is,

If i got  a joystick connected to COMA, i wanna use it to control something in COMB using wirelessly.. Does it means that COMA have to be the TCP/IP server? can it be the TCP/IP CLient? Lastly, if lets say other than the joystick, i got another instrument (SICK) connected to COMB, the ouput are to be shown on COMA,  then i wanna combine both together joystick Client and SICK server, is it possible?

0 Kudos
Message 3 of 24
(5,816 Views)
After some thinking I suspected the problem was likely due to the fact that you were dealing with a reference, rather than an actual variable, so I did a quick search, and this post seems to confirm this. I would suggest doing what is suggested in that post, and converting the image to an array before sending it.

In regads to the joystick question, a computer can be both a server and a client. You will want to use separate ports to keep things straight. When you say you want to do this wirelessly I assume you have a wireless ethernet connection between the two computers?

Using the TCP/IP method is basically the "raw" method. While you can get it to work, you may want to consider alternative methods such DataSockets or Shared Variables, especially if both computers will be running a LabVIEW-built application.

Side-note: You should try not to use the terms "COM1", "COM2", "COMA", etc in referring to your computers since those terms are typically used to refer to serial ports, and when I first read your post I thought you were confused about serial ports and TCP/IP.
0 Kudos
Message 4 of 24
(5,804 Views)


 

Hi, Thanks for the help.. and i will take note of the side-note...

I understand a computer can be both a client or a server, actually what i mean is cause my joystick is connected to a labtop, data will be obtained from the labtop then send out to the desktop... so i wondering if i make my labtop as the client, can it still perform the same operation like sending data over to the desktop>?

Yup, My computers is connected together a wireless network together..

Below are the attached VIs..  i Began to get errors like ( Invalid Image) and the image i can view in the computer my USB camera connected to is no longer viewable.. In the file( Testing Camera 1)  i convert the image into 2D Array as instructed then i flatten it into string and send it over wirelssly.. Did i make any mistake?  At the labtop side ( Testing Camera1-Client) , I Unflatten the data i obtained from (Testing Camera1) and convert the 2D Array back into an image however no image is being processed still.. Please help.. Thanks..

Download All
0 Kudos
Message 5 of 24
(5,774 Views)
While I can't test your VIs since I don't have IMAQ, I do see one mistake: In the server VI you have a 2D array of U8 integers. In the client VI where you're unflattening the string, you're wiring in an array of DBL. The unflatten function must have the same datatype as the array that was flattened. Otherwise, the values you get are garbage. Change the 2D array constant in your "Client" VI to be a 2D array of U8 integers (right-click on the numeric constant of 0.00 and select Representation->U8).

To answer your other question: yes. As I said, a computer can be both a server and a client and it can perform those roles at the same time. You just need separate VIs running to perform your operations. In other words, you have the server/client VIs for the camera image, and the server/client VIs for the joystick. You can obviously combine these two, but I suspect that for now it would be simpler to keep these as separate VIs. You then just need to run the server/client VIs in parallel based on which machine is the server or client for that particular operation. Thus, if computer 1 is the image server and the joystick client, you'd run the image server VI and joystick client VI in parallel. Similar operation holds for computer 2. As before, be sure to use separate ports to keep things simple.
0 Kudos
Message 6 of 24
(5,764 Views)

 
I found the mistake regarding the invalid image type.. I started to change the ArraytoImage to ArraytoColorImage.Vi and ColortoArrayImage.VI.. It began to work.. I'm able to view the images from the computer with the usb camera, however it still does not appears on the laptop.. But Before i'm able to get the images, the VI on the laptop have to be running before the image will start to appear, so i presume somehow there is some TCP/IP connection.. Below are my latest Vis.. Thanks..
 
Regarding the second question, if i keep it as separate VIs, its able to work definitely however i'm instructed to integrate them together so i can view the result in just in a VI..  So is there any helps you can provide me? Thanks.. 
Download All
0 Kudos
Message 7 of 24
(5,753 Views)
On the client machine that is receiving the image, are you getting any data from the TCP Read? It appears as though your logic for encoding and then decoding the image is correct. Are you getting no image, or a garbled image? If it's no image, can you verify for me that you are actually receiving data?
0 Kudos
Message 8 of 24
(5,723 Views)

(((On the client machine that is receiving the image, are you getting any data from the TCP Read? It appears as though your logic for encoding and then decoding the image is correct. Are you getting no image, or a garbled image? If it's no image, can you verify for me that you are actually receiving data?)))

I'm getting no image and unable to verify that i'm getting data from it.. how can i verify that i'm getting data from it?

0 Kudos
Message 9 of 24
(5,708 Views)
Hi.. update to my latest reply... I created a few indicators on my client side.. All the indicators show that there is data being sent over from the server.. however , the image is still not able to be shown on the client side.. Can someone explain this? Btw, the camera i'm using is a PHILIPS SPC900 NC/00 PC Camera..
0 Kudos
Message 10 of 24
(5,698 Views)