" Local Otsu of a image passes through colfilt() " go through the code i'm getting error in this code

조회 수: 1 (최근 30일)
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개)

카테고리

Help CenterFile Exchange에서 Deep Learning Toolbox에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by