フィルターのクリア

copy cropped image to center of another black image

1 回表示 (過去 30 日間)
eman
eman 2015 年 2 月 26 日
i need to copy a cropped image to the center of another black one but i have this error "Subscripted assignment dimension mismatch." i can't find where is the error my code is:
blackimg=uint8(zeros(32,32));
blackimg=im2bw(blackimg);
% // Get the centre of the picture frame
[rowsblack, colsblack] = size(blackimg);
picblackCenRow = round(rowsblack / 2);
picblackCenCol = round(colsblack / 2);
% // Get dimensions of parrot image
[rowscrop, colscrop] = size(crop);
% Determine the pasting boundaries.
r1 = picblackCenRow-round(rowscrop/2);
c1 = picblackCenCol-round(colscrop/2);
r2 = picblackCenRow+round(rowscrop/2)-1;
r2 = min([r2, rowsblack]);
c2 = picblackCenCol+round(colscrop/2)-1;
c2 = min([c2, colsblack]);
% // Place the parrot in the centre
blackimg(r1 : r2, c1:c2) = crop;
my crop image size is 28*7 where is the error please thanks in advance

回答 (0 件)

カテゴリ

Help Center および File ExchangeMATLAB Support Package for Parrot Drones についてさらに検索

Community Treasure Hunt

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

Start Hunting!

Translated by