필터 지우기
필터 지우기

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 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