Filter löschen
Filter löschen

copy cropped image to center of another black image

1 Ansicht (letzte 30 Tage)
eman
eman am 26 Feb. 2015
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

Antworten (0)

Kategorien

Mehr zu MATLAB Support Package for Parrot Drones finden Sie in Help Center und File Exchange

Community Treasure Hunt

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

Start Hunting!

Translated by