Can you help me out:
Images call within for loop k...k values increasing. Already For loop is running original images call, both folders having a same number of images.This approach working in the initial part of code to call original images.

 Respuesta aceptada

Jan
Jan el 27 de Mayo de 2017
Editada: Jan el 27 de Mayo de 2017

1 voto

The error message is clear: you try to access the k.th element of manual_images, but this array has less than k elements. This can have many reasons, but they cannot be found in the code snippet you have posted.
Prefer fullfile instead of "[manual_directory, '/*.gif']". I assume the code is working inspite of the wrong file separator, but fullfile would adjust this.

4 comentarios

KALYAN ACHARJYA
KALYAN ACHARJYA el 27 de Mayo de 2017
Thank for your reply, both original image and manual image folders having equal images (40 images)
As the initial part, the following code perfectly working to call original images. Using same K values inside this loop to call manual images.I also tried to name the only folder name in the manual directory.
Jan
Jan el 27 de Mayo de 2017
Please do not code as screen shot. It is much easier to suggest an improvement, when the code can be copy&pate'd. Thanks.
I do not understand: "I also tried to name the only folder name in the manual directory."
Using absolute path names is much safer.
Did you read my answer? The problem is, that the array manual_images does not contain k elements. The posted code does not show, why you expect, that it does. Examine the creation of this array and check why it is shorter than you expect. Setting some brakpoints and using the debugger will help you.
KALYAN ACHARJYA
KALYAN ACHARJYA el 27 de Mayo de 2017
Thanks a lot, I will try. I am thinking about another alternative as following-
i1=imread(complete path\Manual_Result'num2str(k)'.gif']);
Is this correct approach?
Stephen23
Stephen23 el 27 de Mayo de 2017
Editada: Stephen23 el 27 de Mayo de 2017
"I assume the code is working inspite of the wrong file separator"
Actually every single version of Windows API since DOS 2.0 have accepted both \ and / as file path separators (note: as opposed to in the command line): "Contrary to popular belief, the Windows system API accepts slash, and thus all the above Unix examples should work. But many applications on Windows interpret a slash for other purposes or treat it as an invalid character, and thus require you to enter backslash — notably the cmd.exe shell (often called the "terminal" as it typically runs in a terminal window)"

Iniciar sesión para comentar.

Más respuestas (1)

KSSV
KSSV el 27 de Mayo de 2017

1 voto

i1 = imread(manual_images(k).name) ;

1 comentario

KALYAN ACHARJYA
KALYAN ACHARJYA el 27 de Mayo de 2017
Thank for your reply, Still, shows error as following
Error in drive_seg_result (line 58)
i1=imread(manual_images(k).name);

Iniciar sesión para comentar.

Categorías

Más información sobre Images en Centro de ayuda y File Exchange.

Preguntada:

el 27 de Mayo de 2017

Editada:

el 27 de Mayo de 2017

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by