Subscript indices must either be real positive integers or logicals

조회 수: 1 (최근 30일)
EL
EL 2017년 10월 25일
댓글: Geoff Hayes 2017년 10월 25일
I am trying to move values from an array to another. In particular I am taking the value of the red, green and blue of the specific pixel of the image using the command
img(x,y,:) %where img is my image
and I want to put it in an array defined as pix1 = zeros(3,1). When I do the simple equation pix1(:,1) = img(x,y,:) I get the error ' Subscript indices must either be real positive integers or logicals'. If I understood well this is due to the fact that the rgb values are floats? How do I get to put them in the array pix1 without rounding the value?
Thanks
  댓글 수: 5
EL
EL 2017년 10월 25일
I am rotating an image and then scrolling each pixel to do the bilinear interpolation with the four surrounding pixels. So I must get the value of the image at x = u-1 which at a certain point becomes zero. I guess I'll just shift the image so as to be constantly in the positive domain.

댓글을 달려면 로그인하십시오.

답변 (1개)

Andrei Bobrov
Andrei Bobrov 2017년 10월 25일
편집: Andrei Bobrov 2017년 10월 25일
pix1 = reshape(img(x,y,:),[],1);

카테고리

Help CenterFile Exchange에서 Images에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by