@beaker noted in a commentと同じ理由で、イメージサイズがブロックのサイズで割り切れないことが原因です。ここでは、blockproc
に関数に渡された各ブロックのサイズを確認し、簡単な例です:あなたが一番右側に見ることができるように
dctY = rand(24,34); % first dim is divisible, second is not
funtmp = @(block_struct) size(block_struct.data);
blockproc(dctY,[8 8],funtmp)
は、これは、各ブロックの最後のブロックを
ans =
8 8 8 8 8 8 8 8 8 2
8 8 8 8 8 8 8 8 8 2
8 8 8 8 8 8 8 8 8 2
を返します。行は、サイズが[8, 2]
の部分的なものです。
あなたはthe PadPartialBlocks
option of blockproc
を使用することができます。
'PadPartialBlocks' A logical scalar. When set to true, blockproc will
pad partial blocks to make them full-sized (M-by-N)
blocks. Partial blocks arise when the image size
is not exactly divisible by the block size. If
they exist, partial blocks will lie along the right
and bottom edge of the image. The default is
false, meaning the partial blocks are not padded,
but processed as-is.
blockproc uses zeros to pad partial blocks when
necessary.
これは、アプリケーションに応じて、
>> blockproc(dctY,[8 8],funtmp,'padpartialblocks',true)
ans =
8 8 8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8 8
8 8 8 8 8 8 8 8 8 8
になり、あなたは最後の部分ブロックをオフにトリミングではなく、与えられたとパディングとしたほうが良いかもしれません値。オプションでTrimBorder
とBorderSize
オプションを使用してこれを実行することができます。これらはピクセルを対称的に削除します。
「4290」は8の倍数ではないためです。 – beaker
スクリプト全体と画像を共有できますか? – Royi