LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Synchronize video monitor frame to the image generated with IMAQ

Hi LV'ers,

 

I am writing a program for laser beam scanning with TI LightCrafter for an optical microscopy research project at Koc University, Istanbul. When bitmap images are displayed on LightCrafter, and setup accordingly each pixel can be controlled. LightCrafter is connected through HDMI and is DVI complied. It is handled as a second monitor to the Windows OS (mine is Win7). Frame refresh rate 60Hz, and gets RGB data stream.

 

What I do, is very basically, generating a white pixel and let it move accross the mxn pixels screen. This is the basis of scanning I am after. All of the required processes are very well handled under LabView & IMAQ. However I am stuck into a serious condition:

 

I am unable to guarantee the displayed pixel's persistance time on the screen, and whether each pixel is displayed or not. Well, I am trying to use Wait function within IMAQ WindDraw procedure, in agreement with the frame rate (about 16.6 ms total for 60Hz rate).  Still my application requires exact operation, and I need to make sure that each active/ highlighted pixel is displayed once (or preset number), and all of those pixels are displayed when they are commanded.

 

I understand that video monitor runs itself, and whenever a new frame is sent to the screen with WindDraw, it is displayed. And will continue to be displayed until a new frame/ image is sent. For this operation I have no feedback and no data. 

 

My question is: Do any of you have an idea how to realize this operation with LabView tools, or external code?

 

I will appreciate your advise a lot.

Best Regards,
Adnan Kurt

 

PS.   I will post a similar message to TI E2E Forum to get their advise as well.

PSS. I am attaching my vi, for the sake of completeness. Sorry for the spaghetti code, but written for testing the principles and tools.

 

0 Kudos
Message 1 of 10
(6,145 Views)

Hi Adnan,

 

I think you best described the issue when you said "I understand the video monitor runs itself". You don't have control as to when or for exactly how long a pixel is displayed.

 

It seems to me that this is the main issue - controlling the monitor. Perhaps the company that made the monitor would be a good resource to contact.

 

Kind Regards,

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
Message 2 of 10
(6,081 Views)

Dear Andrew,

 

Thanks for your reply. Once again, I've thought about the process. And I think I've found a solution: I am disposing each image after a frame period+delta (i.e. 17mS) with IMAQ Dispose function. Then the image sequence becomes a controlled flow, I suppose. I will measure the pixel scan, and will be sure about the result. 

 

Regards,
Adnan

0 Kudos
Message 3 of 10
(6,056 Views)

I have checked the operation. Unfortunately, I have not succeeded in using IMAQ Dispose function. It did not work with this problem. I still need an advise on how to "clear video buffer" in LabView. Or a technique to sync to the monitor frame operations.

 

Adnan

0 Kudos
Message 4 of 10
(6,043 Views)

Hi Adnan,

 

Based on your VI, it looks like you only ever have one IMAQ image. What are you referring to by "video"?

 

Kind Regards,

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 5 of 10
(6,019 Views)

Hi Andrew,

 

I am using an image, but changing color of a single pixel at each run, and have the pixel sweep on the screen. That is achieved by displaying the image at the frame rate of the monitor, and each frame has a different pixel location activated.

 

If not clear, I may try giving more detail. What is crucial is not to miss a frame, or repeat a given frame without control.

 

Regards,

Adnan.

 

PS. I am trying to call Directx functions in order to use getverticalblankstatus or a similar method, such as WaitForVerticalBlank. However, I have faced with a problem in calling Directx class from .Net constructor node. It returns "An error occured while loading assembly...". I have tried installing newer versions of Directx, did not help. My LV is 32bit, and Windows7 is 64bits. I do not know whether it is the cause. 

 

Anyway, I will try to get VerticalBlank information, hoping that might help. I am referring to this message thread: http://forums.ni.com/t5/LabVIEW/Implenting-WaitForVerticalBlank/td-p/432112

0 Kudos
Message 6 of 10
(6,003 Views)

Hi Adnan,

 

From your VI, I see that you’re working with a second image which you modify repeatedly. Before I only saw the first image near the top of your Block Diagram.  I'm guessing this second image is what you're referring to as the video since you're changing it quickly and drawing each iteration. Could you attach updated code showing how you are now using IMAQ Dispose?

 

Is your main concern / question still regarding the timing of an image’s display?

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
0 Kudos
Message 7 of 10
(5,969 Views)

Hi Andrew,

 

"I'm guessing this second image is what you're referring to as the video since you're changing it quickly and drawing each iteration." Yes, that is exactly the issue.

"Could you attach updated code showing how you are now using IMAQ Dispose?"  Unfortunately, IMAQ Dispose did not work. I am trying to get some understanding of DirectX. I wonder whether I can command using DirectX .dll's within LabView, and control video swap chains. 

 

"Is your main concern / question still regarding the timing of an image’s display?" Yes, I am still trying to program the display with precision timing and get vertical scan trigger from the windows OS. I am referring to these sources mainly:

 

http://www.directxtutorial.com/Lesson.aspx?lessonid=111-4-3

https://wiki.libsdl.org/CategoryVideo

https://msdn.microsoft.com/en-us/library/windows/desktop/hh446797(v=vs.85).aspx

 

Regards,
Adnan

0 Kudos
Message 8 of 10
(5,937 Views)

Hi Adnan,

 

Here's a good overview of how to call DLLs in LabVIEW. Here's a more detailed guide, and here's an example program that shows calling a DLL in action. I'm not familiar with DirectX functions, but perhaps someone else on this forum is. I'm not sure if they will help you accomplish your goal of controlling the scan trigger in Windows OS, but based on the research you've done / links you've posted, it looks like they might.

Andrew T.
"His job is to shed light, and not to master" - Robert Hunter
Message 9 of 10
(5,910 Views)

Andrew thanks for your efforts in support. Those documents I've had and studied a long time ago, and they are good to have. I am on understanding and using DirectX SDK. It is very complicated and lots of things to study. I am also looking to SDL library. I hope to find a robust answer. If I can succeed, then will post the details here for reference.

 

Regards,
Adnan

0 Kudos
Message 10 of 10
(5,901 Views)