Error in calculating max(max(corrImageR)) during batch image processing after completing 1st iteration (error on 2nd image to be processed)

1 次查看(过去 30 天)
I'm batch processing images. The algorithm involved the included line of code. The first image processes successfully, but on the 2nd image the following error is given. Note, even when not processing in batches, if an image is processed, and then the code is ran again without clearing variables, clear all, the same error is given.
Subscript indices must either be real positive integers or logicals.
Error in batchExudateAnalysisDR (line 30) [maxIdxR,maxIdyR] = find(corrImageR == max(max(corrImageR)));

采纳的回答

Image Analyst
Image Analyst 2015-5-18
Did you redefine max()? Set a breakpoint at that line and when it stops, type this in the command window:
which -all max
whos max
Or try splitting up your code into smaller chunks and examine each one:
maxValue = max(corrImageR(:))
mapOfMaxima = corrImageR == maxValue;
[rowsOfMax, columnsOfMax] = find(mapOfMaxima);
It looks like when you use [maxIdxR, maxIdyR], you might be making the common mistake of thinking (x,y) = (row, column). It is not. They're not the same. find() returns rows, y, first, and the second argument is columns, x. You seem to be reversing that. So you'd want [maxIdxR, maxIdyR], not [maxIdyR, maxIdxR]

更多回答(0 个)

Community Treasure Hunt

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

Start Hunting!

Translated by