Discussion:
write 16 bit images into AVI file
(too old to reply)
DSA
2007-10-07 15:10:08 UTC
Permalink
Hello Michael,




 It?s hard to tell if
the « ImaqAVIColorImage » buffer is correct because it is not really
viewable (see attachment).




 But if I reconvert it
immediately after saving it the AVI frame and then display it, it is always ok.
But when reading back the AVI file, the problem remains.






 I try several
approaches :

Not stopping the BackgroundWorker between
two acquisitions ;
Not closing the acquisition session and
interface between two acquisitions ;
Not disposing the image buffers between
two acquisitions ;
Using a ?void*? instead of the ?unsigned
long int *? pointer to use with the imaqArrayToImage and imaqImageToArray
functions ;
Forcing a really new AVI session by not
closing the previous AVI before calling the imaqCreateAVI function  (otherwise, the AVI session is always
?33?) ;
Try the application on another computer
with another frame grabber (same model) ;
Other things I don?t remember !





 The result is always
the same : black stripes on the second AVI.




 So, unless you or
someone else have another idea, I think I will try something else (as saving
directly the image arrays to a binary file).




 The only thing I could
think of is that a memory location is locked by the first AVI session (or
something in my code) and it is only released when stopping completely the
application.




 Thank you for your
help !




 David


ImaqAVIColorImage18.PNG:
Loading Image...
DSA
2007-10-12 13:10:14 UTC
Permalink
<a name="OLE_LINK2" target="_blank"></a><a name="OLE_LINK1" target="_blank"> Michael,</a>


I?m using a PCI-1410 frame
grabber tested with three video sources (standard RS-170) : infrared camera,
handycam, DV-R. This was tested on two computers with distinct PCI-1410 card. I
don?t see this problem if I save 8bits AVI files. I believe this most be a
software issue concerning the image conversion to the pseudo 16 bits grayscale
AVI.


For troubleshooting purpose, I
use a simplified version of my software were I only grab a new image, convert
it to RGB image and then save it to the AVI file. There is no resampling,
resizing, processing or anything else done on the image. But perhaps I could
try to do a bit shift or a resampling and see if the lines are still black (my
images are 10bits grayscale). Maybe this will point out some bugs in my conversion
algorithm.


And maybe I will just use 8
bits images. I?m not sure the 2 remaining bits worth all the time spent to try
to save them.


David


&nbsp;


PS.: Sorry for the
long delay between replies. The new firewall settings prevent me to use the NI
forums at work and I must post at home when I can :-(.
DSA
2007-10-16 14:40:08 UTC
Permalink
Michael,


As you suggested, I
tried to use new buffers and arrays for the second AVI. I also tried to use a
completely separate backgroundworker for the second acquisition sequence
(consequently, with absolutely new buffers, arrays, etc.). I still get the same
result. I get the same result using another computer too.






&nbsp;Now, I?m really out of
idea !


David
DSA
2007-10-17 13:40:06 UTC
Permalink
Hi Michael,




There is a very
simplified version of my code which can grab an AVI file (in pseudo-16bits
format) and playback the acquired files. I was able to reproduce my issue with
this code.




The files were saved
in the folder path you can type in the text box and a pop-up window will ask
for a file to read. Just select to play an AVI or grab from the card then click
the start button.




To reproduce my issue,
I grab two AVI files (or more) without closing the application. Every times, the
second and other AVI have the black stripes when playing it back.




There is the info on
the developing environment :




Microsoft Visual
Studio 2005Version
8.0.50727.42&nbsp; (RTM.050727-4200)
Microsoft .NET
FrameworkVersion 2.0.50727
Installed Edition:
Standard
Microsoft Visual C++
2005&nbsp;&nbsp; 77633-235-2943881-41426
VISION 7.1.1 and IMAQ
3.7.1
Windows XP Professional.


























Thanks again for your
help !




David


U-GLARES_CO2 - AVI grabbing and playback only.zip:
http://forums.ni.com/attachments/ni/170/278630/1/U-GLARES_CO2 - AVI grabbing and playback only.zip
DSA
2007-10-17 18:10:12 UTC
Permalink
Michael,

I'm glad that my code works well : I can blame something or someone else
:smileyvery-happy:.

Actually, I can't read the AVI in windows media player : I only get a pink
distorted picture (see snapshot "ImaqAVIcolorImage" in one of my
previous replies).






I suspect one of the
DLL loaded by the application to be in fault, probably caused by software
installed on both of my computers.




All those DLLs are
loaded on the AVI creation :


'U-GLARES_CO2.exe': Loaded 'C:\WINDOWS\system32\clbcatq.dll',
No symbols loaded.


'U-GLARES_CO2.exe': Loaded 'C:\WINDOWS\system32\comres.dll',
No symbols loaded.


'U-GLARES_CO2.exe': Loaded 'C:\WINDOWS\system32\qcap.dll', No
symbols loaded.


'U-GLARES_CO2.exe': Loaded 'C:\WINDOWS\system32\msvfw32.dll',
No symbols loaded.


'U-GLARES_CO2.exe': Loaded
'C:\WINDOWS\system32\quartz.dll', No symbols loaded.






And those two ones
when saving the first AVI frame :


'U-GLARES_CO2.exe': Loaded 'C:\WINDOWS\system32\devenum.dll',
No symbols loaded.


'U-GLARES_CO2.exe': Loaded
'C:\WINDOWS\system32\msdmo.dll', No symbols loaded.


&nbsp;




When I first use
VISION and AVI reading on my computer, I get a conflict with a file from NERO
(media player and/or disc burner). So, I now think that any software can interfere
with my application !




I?m quite busy for the
next days, but if I have some time, I will try with another computer (again !)
with less stuff on it.


David

Continue reading on narkive:
Loading...