Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

Problems in snapping pictures and writing BMP files

Good day,
 
I am using the IMAQ Vision library to write BMP files for pictures taken by en IEEE 1394 camera. I have many problems here..
 
- am using a ready-made example to snap the picture, and want to alter it so I save the picture to a file ( should be easy, no? )
 
I tried to do that in two steps: 1) create an image and see if I get a file  2) use the snap function that saves to file instead of saving to a buffer!
The first step is not working
 
   const char file1='abc';
   Image* image1 = imaqCreateImage(IMAQ_IMAGE_U8, borderSize);
   int aa= imaqSetImageSize(image1, iwidth, iheight);
   int aaa = imaqWriteBMPFile(image1, &file1, TRUE, NULL);
 
aaa keeps giving zero ( failure).
 
To use the snap to image fucntion, i use
    imaq1394SnapImage (Sid, image1, rectangle)
 
 
Please if you have any examples about writing and reading images by IMAQ fucntion, upload it here.
Appreciate your inputs.
 
moh

Message Edited by Moh on 10-29-2006 03:00 PM

0 Kudos
Message 1 of 10
(6,542 Views)
well , seems i was missing a lot in the syntax .. it's working now, i used the vision library ..
 
however, I couldn't move the same code to a simple file without the GUI ..
The help at NI says that i could find examples at the directory CVI/vision which i couldnt find it although i got the library ..
 
i am , as you might have noticed, not fluent in c++ ... any examples please?! 🙂
 
 
0 Kudos
Message 2 of 10
(6,529 Views)

Hi,

  the examples in the CVI/Vision directory are plane CVI examples, and not C++ ones

Try the following directory :

C:\Program Files\National Instruments\Vision\Examples\MSVC   for the vision examples and
C:\Program Files\National Instruments\NI-IMAQ for IEEE-1394\Examples\MSVC for the IMAQ 1394 examples.

Which c++ version are you using?
What version of NI-IMAQ 1394 are you using, and what version of NI-Vision?

You said "I couldn't move the same code to a simple file without the GUI .." but what exactly doesn't work?

Thanks

Sacha Emery
National Instruments (UK)

 

// it takes almost no time to rate an answer Smiley Wink
Message 3 of 10
(6,501 Views)
Hi ,
I am using visual C++ 2003 ..
To create a simple cpp file, I created an empty project and added a cpp file!
 
The error pops up right after the linking , it says " An exception ' system.TypeLoad exception has occured.
 
The ccp file is attached,
 
appreciate you help.
moh
0 Kudos
Message 4 of 10
(6,497 Views)

Hi,

  which empty project - I'm using Visual Studio .Net 2003.

I create a new project based on either the Win32 console project or Win32 project.

What exactly are you doing?

What version of NI-IMAQ 1394 are you using?

Thanks

Sacha Emery
National Instruments (UK)

// it takes almost no time to rate an answer Smiley Wink
Message 5 of 10
(6,487 Views)

Hi Sacha,

It's just I create the Empty project (.NET) ( it's there in the choices when you create a new project ) then add a cpp file .. however, I tried and created a Win32 console project. It's the same.

The version is 2.0.2, it should be ok , since the version of the GUI is working fine ..

Ever faced this problem? it's not a compiling or linking as I told u before. You know, it's simple thing but stopping my work.

appreciate ur help.

moh

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

Hi,

  also, have you tried the shipping example in here :

C:\Program Files\National Instruments\NI-IMAQ for IEEE-1394\Examples\MSVC\Snap1394 IMAQ Vision

Then you can start stripping it back to remove the window stuff and go back to a console style application

Hope that helps

Thanks

Sacha Emery
National Instruments (UK)

// it takes almost no time to rate an answer Smiley Wink
0 Kudos
Message 7 of 10
(6,475 Views)
HI ,
yes I am working on that example . I stripped it and it's working .. but the question is : that's not a console application? that's to say, a simple example,  if I try to use "printf", i get nothing, no console screen.
 
I beleive there is some settings or something?!
Did you ever tried to use a 1394 camera on a console app ?
 
Please advice.Thanks
0 Kudos
Message 8 of 10
(6,473 Views)

Hi,

  I created an empty Win32 console app.

Then modified my tools>>options>>project>>VC++ Directories and setup the include and the library directories to also reference the visions and ni-imaq1394 directories.

I then copied over the code you provided (modified the Sid to read SessionID but no actual change) and added in a printf so it holds the image on screen.

Please let me know if that works.

Thanks

Sacha Emery
National Instruments (UK)

// it takes almost no time to rate an answer Smiley Wink
Message 9 of 10
(6,432 Views)
Surprisingly working!
 
I don't know exactly what's the difference between the two projects, might be the libraries that i was including under the recourses instead of under the main solution. However, the system needs tuning, initializing the grabbing process takes much time ( several seconds are much relatively to what needed  ).
 
 
Anyways, thank a lot Sacha, appreciate your time.
 
Moh
0 Kudos
Message 10 of 10
(6,421 Views)