The blocproc code works only for moon.tif. why ?

조회 수: 1 (최근 30일)
RAMYASRIDEVI
RAMYASRIDEVI 2014년 11월 18일
편집: Walter Roberson 2016년 11월 21일
i executed the code for blockproc given in mathworks.com it gets executed but when i used the same code for my own image that is stored in bin folder of MATLAB i get an error. why is that so.
myfun = @(block_struct) ...
uint8(mean2(block_struct.data)*...
ones(size(block_struct.data)));
I2 = blockproc('FP.png',[32 32],myfun);
figure;
imshow('FP.png');
figure;
imshow(I2,[]);
??? Error using ==> blockproc>parse_inputs at 841
Invalid input image. The input image to BLOCKPROC should be either a numeric matrix, a
string filename, or an ImageAdapter object. See the documentation for BLOCKPROC for a
list of readable file formats and their extensions. See the documentation for
ImageAdapter for information on making ImageAdapter objects.
Error in ==> blockproc at 215 input_args = parse_inputs(input_args,Input,block_size,fun,varargin{:});

채택된 답변

Jonathan
Jonathan 2016년 11월 21일
편집: Walter Roberson 2016년 11월 21일
Try this:
myfun = @(block_struct)...
uint8(mean2(block_struct.data)*ones(size(block_struct.data)));
I=imread('FP.png');
I2 = blockproc(I,[32 32],myfun);
figure;
imshow(I,[]);
figure;
imshow(I2,[]);

추가 답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by