Create a grid on an image

조회 수: 2 (최근 30일)
Alber
Alber 2020년 7월 3일
답변: Image Analyst 2020년 7월 3일
Hello, this is my code:
for P = shaping
% Position beacon
img(1:n, 1:n,1+flag) = 255;
img(end-n:end, end-n:end,1+flag) = 255;
img(1:n, end-n:end,1+flag) = 255;
img(end-n:end,1:n,1+flag) = 255;
% We add the information only on the blue channel and add beacon
encodedBuffer(:,:,:,index) = frameBuffer(:,:,:,index);
encodedBuffer(:,:,3,index) = encodedBuffer(:,:,3,index) + ...
P*codeImage+img(:,:,1+flag);
index = index + 1;
end
I want to create some beacons on an image I have created, in which every time I enter this function (this loop belongs to a function) the value of flag will be changed to negative flag. Initially flag is 0. It creates the 4 squares inside the image but instead of being red or green it becomes blue (the image I'm adding it to is blue).

답변 (1개)

Image Analyst
Image Analyst 2020년 7월 3일
You forgot to attach your image or screenshot. And you forgot to tell us what shaping and flag are. But it looks like this loop only adds to the blue channel so the red and green channel will stay as they were. To get it to show up as blue, you can't let the red and green stay as they were or else you'll just get a blue tint to the image. If you want pure blue you will have to set the red and green channels to zero in the same locations where you set the blue channel to 255.

카테고리

Help CenterFile Exchange에서 Convert Image Type에 대해 자세히 알아보기

태그

제품


릴리스

R2019b

Community Treasure Hunt

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

Start Hunting!

Translated by