copy cropped image to center of another black image

1 次查看(过去 30 天)
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 CenterFile Exchange 中查找有关 MATLAB 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