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.

 Réponse acceptée

Jan
Jan le 27 Mai 2017
Modifié(e) : Jan le 27 Mai 2017

1 vote

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 commentaires

KALYAN ACHARJYA
KALYAN ACHARJYA le 27 Mai 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 le 27 Mai 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 le 27 Mai 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 le 27 Mai 2017
Modifié(e) : Stephen23 le 27 Mai 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)"

Connectez-vous pour commenter.

Plus de réponses (1)

KSSV
KSSV le 27 Mai 2017

1 vote

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

1 commentaire

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

Connectez-vous pour commenter.

Catégories

En savoir plus sur Images dans Centre d'aide et File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by