From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

VI IMAQ Create: wenn ich die Bordergröße ungleich 0 eingebe, ist Bild verzerrt

Ich möchte eine USB-Kamera mit einem LabView-Programm steuern. Dafür habe ich vom Hersteller ein Beispielprogramm erhalten. Jetzt bin ich dabei dieses Beispielprogramm nachzuvollziehen. Ich möchte es dann anschließend erweitern. In diesem Programm sind diverse SubVIs enthalten:

 

- IMAQ Create: An diesem SubVI sind außen folgende Anschlüsse: Bildname, Bildrahmen, Bildtyp

 

-> wenn ich bei dem Bildrahmen einen Wert größer als 0 eingebe, dann ist mein Ausgabebild verzerrt. Warum?

-> der Bildtyp gibt mir an wie mein Bild dargestellt wird? In welchem Format?

-> wenn ich das SubVI öffne, muss ich dort auch noch die gleichen Werte eingeben, die ich an den Anschlüssen draußen angegeben habe?

0 Kudos
Message 1 of 28
(3,376 Views)

BeatricePötschick wrote:

-> wenn ich bei dem Bildrahmen einen Wert größer als 0 eingebe, dann ist mein Ausgabebild verzerrt. Warum?

-> der Bildtyp gibt mir an wie mein Bild dargestellt wird? In welchem Format?

-> wenn ich das SubVI öffne, muss ich dort auch noch die gleichen Werte eingeben, die ich an den Anschlüssen draußen angegeben habe?


  • You did not iunclude any of the subVIs.
  • Are the values received by IMAQ Setimagesize" correct?
  • You should delete the "image type" constant, right-click the terminal, and create a new constatnt. You current constant is incorrect (old?)
  • If the front panel of the subVI is closed during run, the controls will not update. If keep the front panel open (only for debugging), the correct values will show once they are recevied during run. Also note that it is reentrant, so you need to make sure you open the correct instance.

The three-frame sequence in the while loop seems unecessary. Execution order is fully determined by dataflow. What determines the loop rate?

0 Kudos
Message 2 of 28
(3,358 Views)

BeatricePötschick wrote:

 

-> wenn ich bei dem Bildrahmen einen Wert größer als 0 eingebe, dann ist mein Ausgabebild verzerrt. Warum?

 


Hi, Beatrice,

 

You just forgot about alignment. The IMAQ Image stored in the memorty with alignment:

 

AL.png

 

The alignment is 64 bytes (for latest Vision) So, if your image, for example 256x256 and the Borser is zero, then the image already aligned. I will copy gradirent array to with MemMove function:

 

Mm01.png

 

As you can see Line Width is 256 pixels - same as image width.

 

With Border = 3 (which is default) situation quite different. Now image with border is not aligned (256+2*3 = 262 bytes), so for each line 58 additional bytes added - so each line aligned to 64 bytes. If you will just copy array in the same way as above, you will see such image:

 

MM02.png

 

For proper copy I will add padding to rthe each line:

 

MM03.png

 

Now the image is transferred correctly also with default border.

 

Refer to IMAQ GetImagePixelPtr Example

 

Hope it helps for understanding,

 

Andrey.

 

Download All
Message 3 of 28
(3,332 Views)

Nice work, Andrey.

The VI provided by Beatrice doesn't allow us to see if the terminals of the XC_GetFrame.vi allows to specify the border size of the IMAQ image.  I would - like Beatrice did - stay with a border size of 0 for IMAQ images that will be passed to that XC_GetFrame.vi.  If any image processing operations (done later) requires a border, "IMAQ ImageBorderSize VI" can do the job (although I do not remember to ever have used it ...).  

0 Kudos
Message 4 of 28
(3,319 Views)
0 Kudos
Message 5 of 28
(3,319 Views)

@BeatricePötschick wrote:
-> der Bildtyp gibt mir an wie mein Bild dargestellt wird? In welchem Format?

 


For help on Image Types take a look at the help of IMAQ Create VI and/or the NI Vision Concepts Help, that you should find on your disk in NI / Vision / Documentation / NI Vision / NIVisionConcepts.chm: The topic "Image Types" handles the representation of the different images types in memory.

0 Kudos
Message 6 of 28
(3,313 Views)

@BeatricePötschick wrote:

-> wenn ich das SubVI öffne, muss ich dort auch noch die gleichen Werte eingeben, die ich an den Anschlüssen draußen angegeben habe?


No. The values on the wires make the dataflow in LabVIEW.  (Opening a subVI and setting the values there in not a good practice.) You usually place subVIs on the block diagram and just wire from/to the terminals.

0 Kudos
Message 7 of 28
(3,307 Views)

Hello altenbach, the loop rate is the number of the captured pictures minus 1.

0 Kudos
Message 8 of 28
(3,270 Views)

Hello altenbach, the loop rate is the number of the captured pictures minus 1.

0 Kudos
Message 9 of 28
(3,269 Views)

Hello everybody, I not really understand why I need to use the SubVI IMAQ GetImagePixelPtr VI?

0 Kudos
Message 10 of 28
(3,261 Views)