Issue with imresize, resizeParseInputs
11 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
https://www.mathworks.com/matlabcentral/answers/2065691-brace-indexing-into-the-result-of-a-function-call-is-not-supported
Error using resizeParseInputs
Expected input number 2, [MROWS NCOLS], to be positive.
Error in matlab.images.internal.resize.resizeParseInputs>scaleOrSize (line 215)
validateattributes(arg, {'numeric'}, {'vector', 'real', 'positive'}, ...
Error in matlab.images.internal.resize.resizeParseInputs>parsePreMethodArgs (line 163)
[scale, output_size] = scaleOrSize(next, next_arg);
Error in matlab.images.internal.resize.resizeParseInputs (line 28)
parsePreMethodArgs(varargin, method_arg_idx, first_param_string_idx);
Error in imresize (line 153)
params = matlab.images.internal.resize.resizeParseInputs(args{:});
Error in focusStack>recontructFromPyramid (line 59)
expanded = imresize(resultImage, size(pyramid{level}), 'bilinear');
Error in focusStack (line 21)
resultImage = recontructFromPyramid(blendedPyramid);
Hello, I had another issue with the code from the link. I understand that the issue may stem form the argument for the for loop being negative when the input for resize needs to be positive. Is there a way to make this work?
2 comentarios
Respuesta aceptada
DGM
el 2 de En. de 2024
Editada: DGM
el 2 de En. de 2024
See the comments. It ran without errors, but I don't know if the output is right or if I'm using it correctly.
%blend the laplacian pyramid to create the final result
function blendedPyramid = blendLaplacianPyramids(pyramid)
numLevels = numel(pyramid{1});
blendedPyramid = cell(1, numLevels);
for level = 1:numLevels % this loop variable is already called 'level'
blendedLevel = zeros(size(pyramid{1}{level}));
for plevel = 1:numel(pyramid) % so name this something different
blendedLevel = blendedLevel + pyramid{1}{plevel};
end
blendedPyramid{level} = blendedLevel;
end
end
%Reconstruct image from blended Laplacian
function resultImage = recontructFromPyramid(pyramid)
numLevels = numel(pyramid);
resultImage = pyramid{numLevels};
for level = numLevels-1:-1:1
% geometry passed to imresize() can't be longer than 2
expanded = imresize(resultImage, size(pyramid{level},1:2), 'bilinear');
resultImage = expanded + pyramid{level};
end
end
1 comentario
Más respuestas (1)
Cris LaPierre
el 2 de En. de 2024
Editada: Cris LaPierre
el 2 de En. de 2024
At least one of your resize dimensions is 0. It appears, then, that your code is producing a result you did not anticipate. Check your code and if necesesary add a check so that your resize dimensions can never be 0.
img = imread("peppers.png");
% This works
img1 = imresize(img,[5,5],"bilinear");
% This reproduces your error
img2 = imresize(img,[0,5],"bilinear");
0 comentarios
Ver también
Categorías
Más información sobre Read, Write, and Modify Image en Help Center y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!