" Local Otsu of a image passes through colfilt() " go through the code i'm getting error in this code
1 vue (au cours des 30 derniers jours)
Afficher commentaires plus anciens
function document_threshold()
iImage = imread('C:\Users\ChAnDrU\Documents\MATLAB\Test\1.jpg');
subplot(2, 2, 1);
imshow(iImage, []);title('Original Image');
[rows, columns, numberOfColorBands] = size(iImage);
if numberOfColorBands > 1
grayImage = iImage(:, :, 2);
end
subplot(2, 2, 2);
imshow(grayImage, []);title('Gray Image');
fun = @(x) LocalOtsu(x); A = im2double(grayImage); localThresh = colfilt(A, [15, 15],'sliding', fun); subplot(2, 2, 3); imshow(localThresh, []);title('Local Otsu Image');
function oneThresholdedPixel = LocalOtsu(grayImagePatch) oneThresholdedPixel = false; try [rows, columns] = size(grayImagePatch); middleRow = ceil(rows/2); middleColumn = ceil(columns/2); level = graythresh(grayImagePatch); % Threshold the center pixel only. oneThresholdedPixel = ~im2bw(grayImagePatch(middleRow, middleColumn), level); catch ME errorMessage = sprintf('Error in function %s() at line %d.\n\nError Message:\n%s', ... ME.stack(1).name, ME.stack(1).line, ME.message); fprintf(1, '%s\n', errorMessage); uiwait(warndlg(errorMessage)); end return;

%
0 commentaires
Réponses (0)
Voir également
Catégories
En savoir plus sur Deep Learning Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!