04-23-2018 05:55 AM
Hello,
I try to load a picture into my CVI programm with above code,but also failed.
for ( i = 0; i < NUM_OCR_IMAGES; i++ )
{
ocrImagesArray[i] = imaqCreateImage (IMAQ_IMAGE_U8, 10);
imaqReadFile( ocrImagesArray[i], "OCR", NULL, NULL );
i try to load images on folder nam OCR in this array ocrImagesArray[i] like loop
but there is error i try ti use this code too but without succes
//imaqReadFile( ocrImagesArray[1], "OCR\\Image %d%d.bmp", NULL, NULL);
all my image in this folder are names Image 00 Image 01 ....... .bmg
thks for help
Solved! Go to Solution.
05-03-2018 02:26 AM
Hello Bylka,
Did you try using a simple project shipped with CVI?
C:\Users\Public\Documents\National Instruments\CVI\Samples\Vision\1. Getting Started
have a nice day,
M-Junior
05-03-2018 02:47 AM
Hello
yes I have already seen the example but in my case I want to use the function imaqReadFile while taking as a parameter not an image but an array of images with the name of the folder where my images are
thank you
05-03-2018 11:38 AM
Ok thank you Bylka.
In that case, why don't you use a for loop with the array of images in input and the imaqreadfile inside the for loop? This way you can create an array of reference with all the pictures.
Thanks
M-Junior
05-04-2018 02:32 AM
Hello M-Junior, thank you for answering me
at begining i do this and its work without error
/* Create all global images */
for ( i = 0; i < NUM_OCR_IMAGES; i++ ) {
ocrImagesArray[i] = imaqCreateImage (IMAQ_IMAGE_U8, 10);
/* Load all the OCR images */
imaqReadFile( ocrImagesArray[0], "OCR\\Image 00.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[1], "OCR\\Image 01.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[2], "OCR\\Image 02.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[3], "OCR\\Image 03.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[4], "OCR\\Image 04.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[5], "OCR\\Image 05.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[6], "OCR\\Image 06.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[7], "OCR\\Image 07.bmp", NULL, NULL);
imaqReadFile( ocrImagesArray[8], "OCR\\Image 08.bmp", NULL, NULL);
}
all images on this file its shown on my interface
but when i try to do somthink lik standar without mentioning all the photos on my folder like this
for ( i = 0; i < NUM_OCR_IMAGES; i++ ) {
ocrImagesArray[i] = imaqCreateImage (IMAQ_IMAGE_U8, 10);
/* Load all the OCR images */
imaqReadFile( ocrImagesArray[i], "OCR\\Image 0.%d.bmp", NULL, NULL);
}
i have error
NON-FATAL RUN-TIME ERROR: "OCR.c", line 118, col 5, thread id 4004: Function imaqReadFile: (errorCode == -1074395995 [0xbff604a5]). File not found.
i dont know what i can make here that my code understands that they have to take the photos found in the OCR folder;
imaqReadFile( ocrImagesArray[i], "OCR\\...............bmp", NULL, NULL);
thks for help
05-09-2018 06:27 AM
for ( i = 0; i < NUM_OCR_IMAGES; i++ )
Hello
i do this modification and it's work
ocrImagesArray[i] = imaqCreateImage (IMAQ_IMAGE_U8, 10);
for (r=0; r <10; r++) {
sprintf(nom, "OCR\\Image %02hu.bmp", r);
printf("nom=[%s]\n", nom);
imaqReadFile( ocrImagesArray[r], nom, NULL, NULL);
thks