フィルターのクリア

Info

この質問は閉じられています。 編集または回答するには再度開いてください。

how this [1 2] working and giving me the difference ?

1 回表示 (過去 30 日間)
Rizwan Taj
Rizwan Taj 2020 年 8 月 15 日
閉鎖済み: MATLAB Answer Bot 2021 年 8 月 20 日
My code is working well, everything is expected as it should be but i want to go deep and want to learn more how this code is giving me the difference ?
Is [1 2] divide it into blocks ? If yes then how ?
O_IMAGE = imread('boat_256x256.tif');
% The difference
THE_DIFF = blkproc(double(O_IMAGE), [1 2], inline('x(1) - x(2)'));
Anyone who can elaborate it to me ? Thanks in Advance

回答 (1 件)

Walter Roberson
Walter Roberson 2020 年 8 月 15 日
blkproc is considered obsolete and should not be used.
[1 2] means that the function will start in the top left corner and take a 1 pixel by 2 pixel part of the image, and will pass that to the function and will store the result. Then it will move right by 2 pixels and take 1x2 pixels there, pass that to the function, and it will keep sliding the window over two pixels at a time. When it gets to the end of the first row it will start at the beginning of the second row, take 1x2 there, pass it to the function and so on.
The way it does all of this is by using for loops internally. The code did not separate the image into separate variables and process each variable, and did not create cell arrays of subsets and process each subset: it just used for loops.

この質問は閉じられています。

Community Treasure Hunt

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

Start Hunting!

Translated by